2006-06-23 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+ PR c++/28112
+ * parser.c (cp_parser_attribute_list): Skip attributes with invalid
+ arguments. Fix comment.
+
PR c++/11468
* init.c (build_new_1): Handle error_mark_nodes returned by
build_java_class_ref.
if (token->type == CPP_NAME
|| token->type == CPP_KEYWORD)
{
+ tree arguments = NULL_TREE;
+
/* Consume the token. */
token = cp_lexer_consume_token (parser->lexer);
/* If it's an `(', then parse the attribute arguments. */
if (token->type == CPP_OPEN_PAREN)
{
- tree arguments;
-
- arguments = (cp_parser_parenthesized_expression_list
- (parser, true, /*cast_p=*/false,
- /*non_constant_p=*/NULL));
- /* Save the identifier and arguments away. */
+ arguments = cp_parser_parenthesized_expression_list
+ (parser, true, /*cast_p=*/false,
+ /*non_constant_p=*/NULL);
+ /* Save the arguments away. */
TREE_VALUE (attribute) = arguments;
}
- /* Add this attribute to the list. */
- TREE_CHAIN (attribute) = attribute_list;
- attribute_list = attribute;
+ if (arguments != error_mark_node)
+ {
+ /* Add this attribute to the list. */
+ TREE_CHAIN (attribute) = attribute_list;
+ attribute_list = attribute;
+ }
token = cp_lexer_peek_token (parser->lexer);
}
--- /dev/null
+// PR c++/28112
+// { dg-do compile }
+
+int i __attribute__((init_priority(;))); // { dg-error "before" }
+int j __attribute__((vector_size(;))); // { dg-error "before" }
+int k __attribute__((visibility(;))); // { dg-error "before" }
+struct A {} __attribute__((aligned(;))); // { dg-error "before" }
+struct B {} __attribute__((mode(;))); // { dg-error "before" }
+void foo() __attribute__((alias(;))); // { dg-error "before" }
+void bar() __attribute__((nonnull(;))); // { dg-error "before" }
+void baz() __attribute__((section(;))); // { dg-error "before" }