summaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index fc5090e2415..e92fff78a8f 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -22645,7 +22645,8 @@ cp_parser_std_attribute_spec (cp_parser *parser)
static tree
cp_parser_std_attribute_spec_seq (cp_parser *parser)
{
- tree attr_specs = NULL;
+ tree attr_specs = NULL_TREE;
+ tree attr_last = NULL_TREE;
while (true)
{
@@ -22655,11 +22656,13 @@ cp_parser_std_attribute_spec_seq (cp_parser *parser)
if (attr_spec == error_mark_node)
return error_mark_node;
- TREE_CHAIN (attr_spec) = attr_specs;
- attr_specs = attr_spec;
+ if (attr_last)
+ TREE_CHAIN (attr_last) = attr_spec;
+ else
+ attr_specs = attr_last = attr_spec;
+ attr_last = tree_last (attr_last);
}
- attr_specs = nreverse (attr_specs);
return attr_specs;
}