"attributes at the beginning of statement are ignored");
}
+/* Append ATTR to attribute list ATTRS. */
+
+static tree
+attr_chainon (tree attrs, tree attr)
+{
+ if (attrs == error_mark_node)
+ return error_mark_node;
+ if (attr == error_mark_node)
+ return error_mark_node;
+ return chainon (attrs, attr);
+}
+
/* Parse the label for a labeled-statement, i.e.
identifier :
else if (!cp_parser_parse_definitely (parser))
;
else
- attributes = chainon (attributes, attrs);
+ attributes = attr_chainon (attributes, attrs);
}
if (attributes != NULL_TREE)
else
{
decl_specs->std_attributes
- = chainon (decl_specs->std_attributes,
- attrs);
+ = attr_chainon (decl_specs->std_attributes, attrs);
if (decl_specs->locations[ds_std_attribute] == 0)
decl_specs->locations[ds_std_attribute] = token->location;
}
}
}
- decl_specs->attributes
- = chainon (decl_specs->attributes,
- attrs);
+ decl_specs->attributes
+ = attr_chainon (decl_specs->attributes, attrs);
if (decl_specs->locations[ds_attribute] == 0)
decl_specs->locations[ds_attribute] = token->location;
continue;
identifier = cp_parser_identifier (parser);
/* Parse any attributes specified after the identifier. */
- attribs = chainon (attribs, cp_parser_attributes_opt (parser));
+ attribs = attr_chainon (attribs, cp_parser_attributes_opt (parser));
}
if (cp_lexer_next_token_is_not (parser->lexer, CPP_SCOPE))
decl = grokfield (declarator, decl_specifiers,
initializer, !is_non_constant_init,
/*asmspec=*/NULL_TREE,
- chainon (attributes, prefix_attributes));
+ attr_chainon (attributes, prefix_attributes));
if (decl && TREE_CODE (decl) == FUNCTION_DECL)
cp_parser_save_default_args (parser, decl);
cp_finalize_omp_declare_simd (parser, decl);
/* Check for attributes first. */
if (cp_next_tokens_can_be_attribute_p (parser))
{
- type_specifier_seq->attributes =
- chainon (type_specifier_seq->attributes,
- cp_parser_attributes_opt (parser));
+ type_specifier_seq->attributes
+ = attr_chainon (type_specifier_seq->attributes,
+ cp_parser_attributes_opt (parser));
continue;
}
parser->default_arg_ok_p = saved_default_arg_ok_p;
/* After the declarator, allow more attributes. */
decl_specifiers.attributes
- = chainon (decl_specifiers.attributes,
- cp_parser_attributes_opt (parser));
+ = attr_chainon (decl_specifiers.attributes,
+ cp_parser_attributes_opt (parser));
/* If the declarator is a template parameter pack, remember that and
clear the flag in the declarator itself so we don't get errors
late_attributes = cp_parser_attributes_opt (parser);
}
- attributes = chainon (attributes, late_attributes);
+ attributes = attr_chainon (attributes, late_attributes);
/* Remember which attributes are prefix attributes and
which are not. */
first_attribute = attributes;
/* Combine the attributes. */
- attributes = chainon (prefix_attributes, attributes);
+ attributes = attr_chainon (prefix_attributes, attributes);
/* Create the bitfield declaration. */
decl = grokbitfield (identifier
which are not. */
first_attribute = attributes;
/* Combine the attributes. */
- attributes = chainon (prefix_attributes, attributes);
+ attributes = attr_chainon (prefix_attributes, attributes);
/* If it's an `=', then we have a constant-initializer or a
pure-specifier. It is not correct to parse the
cp_finalize_oacc_routine (parser, decl, false);
/* Reset PREFIX_ATTRIBUTES. */
- while (attributes && TREE_CHAIN (attributes) != first_attribute)
- attributes = TREE_CHAIN (attributes);
- if (attributes)
- TREE_CHAIN (attributes) = NULL_TREE;
+ if (attributes != error_mark_node)
+ {
+ while (attributes && TREE_CHAIN (attributes) != first_attribute)
+ attributes = TREE_CHAIN (attributes);
+ if (attributes)
+ TREE_CHAIN (attributes) = NULL_TREE;
+ }
/* If there is any qualification still in effect, clear it
now; we will be starting fresh with the next declarator. */
cp_parser_skip_to_end_of_statement (parser);
/* Add these new attributes to the list. */
- attributes = chainon (attributes, attribute_list);
+ attributes = attr_chainon (attributes, attribute_list);
}
return attributes;
which are not. */
first_attribute = attributes;
/* Combine the attributes. */
- attributes = chainon (prefix_attributes, attributes);
+ attributes = attr_chainon (prefix_attributes, attributes);
if (width)
/* Create the bitfield declaration. */
objc_add_instance_variable (decl);
/* Reset PREFIX_ATTRIBUTES. */
- while (attributes && TREE_CHAIN (attributes) != first_attribute)
- attributes = TREE_CHAIN (attributes);
- if (attributes)
- TREE_CHAIN (attributes) = NULL_TREE;
+ if (attributes != error_mark_node)
+ {
+ while (attributes && TREE_CHAIN (attributes) != first_attribute)
+ attributes = TREE_CHAIN (attributes);
+ if (attributes)
+ TREE_CHAIN (attributes) = NULL_TREE;
+ }
token = cp_lexer_peek_token (parser->lexer);
which are not. */
first_attribute = attributes;
/* Combine the attributes. */
- attributes = chainon (prefix_attributes, attributes);
-
+ attributes = attr_chainon (prefix_attributes, attributes);
+
decl = grokfield (declarator, &declspecs,
NULL_TREE, /*init_const_expr_p=*/false,
NULL_TREE, attributes);
return error_mark_node;
/* Reset PREFIX_ATTRIBUTES. */
- while (attributes && TREE_CHAIN (attributes) != first_attribute)
- attributes = TREE_CHAIN (attributes);
- if (attributes)
- TREE_CHAIN (attributes) = NULL_TREE;
+ if (attributes != error_mark_node)
+ {
+ while (attributes && TREE_CHAIN (attributes) != first_attribute)
+ attributes = TREE_CHAIN (attributes);
+ if (attributes)
+ TREE_CHAIN (attributes) = NULL_TREE;
+ }
DECL_CHAIN (decl) = decls;
decls = decl;