[Ecls-list] Missing braces in initializer

Jerry James loganjerry at gmail.com
Mon Jun 3 22:26:13 UTC 2013

GCC warns about missing braces in initializers, due to these
definitions in src/h/ecl-inl.h:

#define ecl_def_string_array(name,static,const)                         \
        static const union {                                            \
                struct ecl_base_string elt;                             \
                cl_fixnum padding[(sizeof(struct ecl_base_string)+3)/4*4]; \
        } name[]

#define ecl_def_string_array_elt(chars) {                      \
                (int8_t)t_base_string, 0, ecl_aet_bc, 0,            \
                        ECL_NIL, (cl_index)(sizeof(chars))-1,      \
                        (cl_index)(sizeof(chars))-1,            \
                        (ecl_base_char*)(chars) }

When ecl_def_string_array is used, the initializer needs to be for an
array of unions.  So we need one set of curly braces for the array,
then for each element we need a set of curly braces for the union, and
a second set for the structure that is the first element of the union.
 This definition is missing the second set.  The attached patch fixes
the problem.

Jerry James
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecl-braces.patch
Type: application/octet-stream
Size: 822 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20130603/a8925e5b/attachment.obj>

More information about the ecl-devel mailing list