[PATCH] add __attribute__ ((designated_init))

Joseph S. Myers joseph@codesourcery.com
Thu Jan 23 17:59:00 GMT 2014

On Mon, 20 Jan 2014, Tom Tromey wrote:

> I wrote a new test case covering the same cases that the sparse test
> case covers.  I also added tests for applying the attribute to
> non-struct types; note that in this case sparse issues a warning but
> gcc issues an error.  I think an error is more appropriate.

I think the test should also cover cases with designators such as .d.x = 

> +static tree handle_designated_init (tree *, tree, tree, int, bool *);

handle_designated_init_attribute would seem a better name.

> +      error ("designated_init attribute is only valid on struct type");

%<designated_init%> (or use %qE with the attribute name as passed to the 
function, as is usual for such diagnostics).

Joseph S. Myers

More information about the Gcc-patches mailing list