This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] add __attribute__ ((designated_init))
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 24 Jan 2014 17:07:36 +0000
- Subject: Re: [PATCH] add __attribute__ ((designated_init))
- Authentication-results: sourceware.org; auth=none
- References: <874n4ygzay dot fsf at fleche dot redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1401231756090 dot 31884 at digraph dot polyomino dot org dot uk> <87r47y1bta dot fsf at fleche dot redhat dot com>
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