Hi -
It looks like we are exactly at a border here. ;-)
My super-simplified code based on Dany's snipped is
struct foo {int bar;};
typedef struct foo foo_t;
foo_t foos[] = {{-1}, {0}, {1}};
foo_t more_foos[] = {{0}, {8}, {15}, {}};
Now, gcc(1) shrieks
$ gcc --version
gcc (Debian 4.6.2-9) 4.6.2
$ gcc -Wall -Wextra -c empty-array-init.c
empty-array-init.c:4:1: warning: missing initializer
[-Wmissing-field-initializers]
empty-array-init.c:4:1: warning: (near initialization for
‘more_foos[3].bar’) [-Wmissing-field-initializers]
$ nm -S empty-array-init.o
0000000000000000 000000000000000c D foos
0000000000000010 0000000000000010 D more_foos
whereas a pretty new version of CLang remains calm
$ clang --version
clang version 3.1 (trunk 149859)
$ clang -Wall -Wextra -c empty-array-init.c
and good ol' Splint whacks me over the head
$ splint empty-array-init.c
Splint 3.1.2 --- 20 Feb 2009
empty-array-init.c:4:40: Parse Error. (For help on parse errors, see splint
-help parseerrors.)
*** Cannot continue.
The CIL Documentation, Chapter 4,
"Compiling C to CIL" says in Item 7: "Array
lengths are computed based on the initializers
or by constant folding." which is not helpful in
this particular case.
Based on Gcc's reaction with option "-Wextra"
I'd tend to want a CIL warning, too.
/Chris
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
CIL-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cil-users