Compiler problems with zero-length array in the middle of a struct
Some compiler reject a zero-length array in the middle of a structure, and report it as an error.
So could we please redo the change, that has recently been done to include/linux/raid/md_p.h (see patch below).
/Carsten
--
_ _ ____ ___ Carsten Langgaard Mailto:[email protected] |\ /|||___)(___ MIPS Denmark Direct: +45 4486 5527 | \/ ||| ____) Lautrupvang 4B Switch: +45 4486 5555 TECHNOLOGIES 2750 Ballerup Fax...: +45 4486 5556 Denmark http://www.mips.com
Index: include/linux/raid/md_p.h
===================================================================
RCS file: /home/cvs/linux/include/linux/raid/md_p.h,v retrieving revision 1.3
linux/raid/md_p.h +2 -0
@@ -151,10 +151,12 @@*/ mdp_disk_t disks[MD_SB_DISKS ]; +#if MD_SB_RESERVED_WORDS /* * Reserved */ __u32 reserved[MD_SB_RESERVED_WORDS ]; +#endif /* * Active descriptor
Quoted 4 lines · Carsten Langgaard
Some compiler reject a zero-length array in the middle of a structure, and report it as an error.
So could we please redo the change, that has recently been done toinclude/linux/raid/md_p.h(see patch below).
Hmm... What compiler version is that? The gcc documentation explicitly permits empty arrays.
Ralf
It should be a problem in gcc-3.0, also the SDE compiler has a problem with that, but it's going to be fixed.
/Carsten
Quoted 11 lines · Ralf Baechle
Quoted 4 lines · Carsten Langgaard
Some compiler reject a zero-length array in the middle of a structure, and report it as an error.
So could we please redo the change, that has recently been done toinclude/linux/raid/md_p.h(see patch below).Hmm... What compiler version is that? The gcc documentation explicitly permits empty arrays.
Ralf
--
_ _ ____ ___ Carsten Langgaard Mailto:[email protected] |\ /|||___)(___ MIPS Denmark Direct: +45 4486 5527 | \/ ||| ____) Lautrupvang 4B Switch: +45 4486 5555 TECHNOLOGIES 2750 Ballerup Fax...: +45 4486 5556 Denmark http://www.mips.com
Quoted 2 lines · Carsten Langgaard
Quoted 2 lines
Hmm... What compiler version is that? The gcc documentation explicitly permits empty arrays.
There was some discussion about this and what to do with zero sized objects. In the C++ universe it seems to be horribly complicated with rules about two objects not having the same address.