scripts/dtc: Replace zero-length array with DECLARE_FLEX_ARRAY() helper
PATCH 1/1 scripts/dtc: Replace zero-length array with DECLARE_FLEX_ARRAY() helper
From: guo ziliang <[email protected]>
Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new DECLARE_FLEX_ARRAY() helper macro.
--- scripts/dtc/libfdt/fdt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/dtc/libfdt/fdt.h +2 -2
@@ -35,14 +35,14 @@ struct fdt_reserve_entry {struct fdt_node_header {fdt32_t tag; -char name[0 ]; + DECLARE_FLEX_ARRAY(char, name); };struct fdt_property {fdt32_t tag;fdt32_t len;fdt32_t nameoff; -char data[0 ]; + DECLARE_FLEX_ARRAY(char, data); };#endif /* !__ASSEMBLY */
--
1.8.3.1
Quoted 21 lines · On Tue, Nov 15, 2022 at 09:03:27AM +0800, [email protected] wrote:
From: guo ziliang <[email protected]>
Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new
DECLARE_FLEX_ARRAY()helper macro.Signed-off-by guo ziliang <[email protected]>--- scripts/dtc/libfdt/fdt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)scripts/dtc/libfdt/fdt.h +0
-1@@ -35,14 +35,14 @@ struct fdt_reserve_entry {struct fdt_node_header {fdt32_t tag; -char name[0 ];
scripts/dtc/libfdt/fdt.h struct fdt_reserve_entry { · line 46
Quoted 10 lines
scripts/dtc/libfdt/fdt.h +2
-1+DECLARE_FLEX_ARRAY (char, name); };struct fdt_property {fdt32_t tag;fdt32_t len;fdt32_t nameoff; -char data[0 ]; + DECLARE_FLEX_ARRAY(char, data); };
This was addressed in commit:
5224f7909617 ("treewide: Replace zero-length arrays with flexible-array members")
My question here is why these changes were reverted by commit:
ea3723a541c1 ("scripts/dtc: Update to upstream version v1.6.1-63-g55778a03df61")?? :O
Thanks
--
Gustavo
Quoted 8 lines · On Mon, Nov 14, 2022 at 7:03 PM <[email protected]> wrote:
From: guo ziliang <[email protected]>
Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new
DECLARE_FLEX_ARRAY()helper macro.
Quoted 4 lines
Signed-off-by guo ziliang <[email protected]>--- scripts/dtc/libfdt/fdt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Changes to dtc/libfdt must go upstream first and then we sync upstream back to the kernel.