c-parser.c (c_parser_struct_declaration): Add a comment.

c/
	* c-parser.c (c_parser_struct_declaration): Add a comment.
	(c_parser_declarator): Don't allow _Alignas here.
testsuite/
	* gcc.dg/c1x-align-5.c: Add more testing.

From-SVN: r204007
This commit is contained in:
Marek Polacek 2013-10-24 10:42:43 +00:00 committed by Marek Polacek
parent 54c09437d1
commit f28aa681d3
4 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2013-10-24 Marek Polacek <polacek@redhat.com>
* c-parser.c (c_parser_struct_declaration): Add a comment.
(c_parser_declarator): Don't allow _Alignas here.
2013-10-17 Andrew MacLeod <amacleod@redhat.com>
* c-parser.c: Include omp-low.h.

View File

@ -2645,6 +2645,11 @@ c_parser_struct_declaration (c_parser *parser)
}
specs = build_null_declspecs ();
decl_loc = c_parser_peek_token (parser)->location;
/* Strictly by the standard, we shouldn't allow _Alignas here,
but it appears to have been intended to allow it there, so
we're keeping it as it is until WG14 reaches a conclusion
of N1731.
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1731.pdf> */
c_parser_declspecs (parser, specs, false, true, true,
true, cla_nonabstract_decl);
if (parser->error)
@ -2959,7 +2964,7 @@ c_parser_declarator (c_parser *parser, bool type_seen_p, c_dtr_syn kind,
struct c_declarator *inner;
c_parser_consume_token (parser);
c_parser_declspecs (parser, quals_attrs, false, false, true,
true, cla_prefer_id);
false, cla_prefer_id);
inner = c_parser_declarator (parser, type_seen_p, kind, seen_id);
if (inner == NULL)
return NULL;

View File

@ -1,3 +1,7 @@
2013-10-24 Marek Polacek <polacek@redhat.com>
* gcc.dg/c11-align-5.c: Add more testing.
2013-10-23 Pat Haugen <pthaugen@us.ibm.com>
* gcc.target/powerpc/direct-move.h: Fix header for executable tests.

View File

@ -14,6 +14,14 @@ void foo (int a[_Alignas (0) 10]) { } /* { dg-error "expected expression before"
void
test (void)
{
int *_Alignas (long) p; /* { dg-error "expected" } */
int *const _Alignas (long) *q; /* { dg-error "expected" } */
struct s { int n; };
__builtin_offsetof (struct s _Alignas (int), n); /* { dg-error "expected" } */
__typeof (long double _Alignas (0)) e; /* { dg-error "expected" } */
sizeof (int _Alignas (int)); /* { dg-error "expected" } */
_Alignas (int _Alignas (float)) int t; /* { dg-error "expected" } */
__builtin_types_compatible_p (signed _Alignas (0), unsigned); /* { dg-error "expected" } */
int a[_Alignas (int) 10]; /* { dg-error "expected expression before" } */
int b[10];
foo (b);