aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2014-05-09 08:24:37 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2014-05-09 08:24:37 +0000
commit661a0813da5f8b3d3085ec3481e6928e6cadca03 (patch)
tree35edbf8e14134b0cba3c9df371c7f28c16b8e69b /gcc/c
parentee3958cfe190f6c0925deb9f3c573b87dc6c9ca4 (diff)
downloadgcc-661a0813da5f8b3d3085ec3481e6928e6cadca03.zip
gcc-661a0813da5f8b3d3085ec3481e6928e6cadca03.tar.gz
gcc-661a0813da5f8b3d3085ec3481e6928e6cadca03.tar.bz2
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
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-parser.c11
2 files changed, 14 insertions, 3 deletions
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 <polacek@redhat.com>
+
+ 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 <polacek@redhat.com>
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);