This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] add __attribute__ ((designated_init))


On Thu, 23 Jan 2014, Tom Tromey wrote:

> In this error, should I use "%<struct%>" rather than just plain "struct"
> as well?

I think that's best (generally, %<%> or %q with anything quoting a 
source-code construct - anything that would go in a fixed-width font in 
documentation - "struct" is such a case, the English word is "structure").

> +  if (!implicit && warn_designated_init && !was_designated
> +      && TREE_CODE (constructor_type) == RECORD_TYPE
> +      && lookup_attribute ("designated_init",
> +			   TYPE_ATTRIBUTES (constructor_type)))
> +    warning_init (OPT_Wdesignated_init,
> +		  "positional initialization of field "
> +		  "in struct declared with designated_init attribute");

Also %<struct%> and %<designated_init%> here.

> +@item designated_init
> +This attribute may only be applied to struct types.  It indicates that

And @code{struct} (or "structure") here.

Is there a reason someone using the attribute might not want the warning?  
That is, why isn't -Wdesignated-init enabled by default, given that it's 
only relevant to people using an attribute whose sole function relates to 
the warning?

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]