[Bug c/59855] Support sparse-style __attribute__((designated_init)) on structures, requiring designated initializers

josh at joshtriplett dot org gcc-bugzilla@gcc.gnu.org
Mon Jan 20 23:01:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59855

--- Comment #2 from Josh Triplett <josh at joshtriplett dot org> ---
Very nice!  Looks reasonable to me.

I agree with making designated_init on a non-struct an error.  Sparse tends to
almost never mark anything as an error unless it mangles Sparse's internal
state somehow, because errors will suppress subsequent warnings (to avoid
cascading issues).  GCC should make it an error.

In theory, designated_init could be meaningful on a union or array; for the
union it would warn on the un-designated initialization of the first member of
the union, and for an array it could require numeric designation.  However, the
latter case seems highly unlikely, and for the former there probably ought to
be a general warning -Wpositional-union-init.  I'd suggest going with this
patch.



More information about the Gcc-bugs mailing list