This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Warn for _Alignas in an array declarator (PR c/58267)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 19 Oct 2013 19:23:20 +0000
- Subject: Re: [C PATCH] Warn for _Alignas in an array declarator (PR c/58267)
- Authentication-results: sourceware.org; auth=none
- References: <20131016113405 dot GC10967 at redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1310161221520 dot 10873 at digraph dot polyomino dot org dot uk> <20131016151956 dot GE10967 at redhat dot com>
On Wed, 16 Oct 2013, Marek Polacek wrote:
> @@ -2946,7 +2957,8 @@ c_parser_declarator (c_parser *parser, b
> struct c_declspecs *quals_attrs = build_null_declspecs ();
> struct c_declarator *inner;
> c_parser_consume_token (parser);
> - c_parser_declspecs (parser, quals_attrs, false, false, true, cla_prefer_id);
> + c_parser_declspecs (parser, quals_attrs, false, false, true,
> + true, cla_prefer_id);
> inner = c_parser_declarator (parser, type_seen_p, kind, seen_id);
> if (inner == NULL)
> return NULL;
Looking at this again, shouldn't the new argument be "false" (with
associated testcase)? This is parsing pointer declarators, and _Alignas
isn't allowed there any more than it is in array declarators....
> @@ -3715,7 +3730,8 @@ c_parser_type_name (c_parser *parser)
> struct c_declarator *declarator;
> struct c_type_name *ret;
> bool dummy = false;
> - c_parser_declspecs (parser, specs, false, true, true, cla_prefer_type);
> + c_parser_declspecs (parser, specs, false, true, true, false,
> + cla_prefer_type);
> if (!specs->declspecs_seen_p)
> {
> c_parser_error (parser, "expected specifier-qualifier-list");
And this should get a testcase added, that _Alignas is correctly rejected
in type names where previously it would have been wrongly accepted.
(Strictly by the standard it should be "false" in
c_parser_struct_declaration as well - the syntax there doesn't allow
_Alignas - but it appears to have been intended to allow it there, so
probably best not to change anything there until WG14 reaches a conclusion
on the issues I raised in N1731.)
--
Joseph S. Myers
joseph@codesourcery.com