From 661a0813da5f8b3d3085ec3481e6928e6cadca03 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 9 May 2014 08:24:37 +0000 Subject: re PR c/50459 (alignof doesn't work on plain old constant, works with expressions containing it) PR c/50459 c-family/ * c-common.c (check_user_alignment): Return -1 if alignment is error node. (handle_aligned_attribute): Don't call default_conversion on FUNCTION_DECLs. (handle_vector_size_attribute): Likewise. (handle_tm_wrap_attribute): Handle case when wrap_decl is error node. (handle_sentinel_attribute): Call default_conversion and allow even integral types as an argument. c/ * c-parser.c (c_parser_attributes): Parse the arguments as an expression-list if the attribute takes identifier. testsuite/ * c-c++-common/attributes-1.c: Move test line to a new test. * c-c++-common/attributes-2.c: New test. * c-c++-common/pr50459.c: New test. * c-c++-common/pr59280.c: Add "undeclared" to dg-error. * gcc.dg/nonnull-2.c: Likewise. * gcc.dg/pr55570.c: Modify dg-error. * gcc.dg/tm/wrap-2.c: Likewise. From-SVN: r210262 --- gcc/c/ChangeLog | 6 ++++++ gcc/c/c-parser.c | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 1c8c435..4b73461 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2014-05-09 Marek Polacek + + PR c/50459 + * c-parser.c (c_parser_attributes): Parse the arguments as an + expression-list if the attribute takes identifier. + 2014-05-08 Marek Polacek PR c/61053 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 6e8f33b..6e16d8b 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -3955,11 +3955,16 @@ c_parser_attributes (c_parser *parser) In objective-c the identifier may be a classname. */ if (c_parser_next_token_is (parser, CPP_NAME) && (c_parser_peek_token (parser)->id_kind == C_ID_ID - || (c_dialect_objc () - && c_parser_peek_token (parser)->id_kind == C_ID_CLASSNAME)) + || (c_dialect_objc () + && c_parser_peek_token (parser)->id_kind + == C_ID_CLASSNAME)) && ((c_parser_peek_2nd_token (parser)->type == CPP_COMMA) || (c_parser_peek_2nd_token (parser)->type - == CPP_CLOSE_PAREN))) + == CPP_CLOSE_PAREN)) + && (attribute_takes_identifier_p (attr_name) + || (c_dialect_objc () + && c_parser_peek_token (parser)->id_kind + == C_ID_CLASSNAME))) { tree arg1 = c_parser_peek_token (parser)->value; c_parser_consume_token (parser); -- cgit v1.1