diff options
author | Jakub Jelinek <jakub@redhat.com> | 2023-12-08 20:58:38 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2023-12-08 20:58:38 +0100 |
commit | 662a613dd381e327b90b42bb850cb393a01e7f7e (patch) | |
tree | 644d3c7a2898793da86820f6aecb6128422d9f51 /gcc/gcc.cc | |
parent | 6ddaf06e375e1c15dcda338697ab6ea457e6f497 (diff) | |
download | gcc-662a613dd381e327b90b42bb850cb393a01e7f7e.zip gcc-662a613dd381e327b90b42bb850cb393a01e7f7e.tar.gz gcc-662a613dd381e327b90b42bb850cb393a01e7f7e.tar.bz2 |
c++: Fix parsing [[]][[]];
When working on the previous patch I put [[]] [[]] asm (""); into a
testcase, but was surprised it wasn't parsed.
The problem is that when cp_parser_std_attribute_spec returns NULL, it
can mean 2 different things, one is that the next token(s) are neither
[[ nor alignas (in that case the caller should break from the loop),
or when we parsed something like [[]] - it was valid attribute specifier,
but didn't specify any attributes in it.
The following patch fixes that by using a magic value of void_list_node
for the case where the first tokens are neither [[ nor alignas and so
where cp_parser_std_attribute_spec_seq should stop iterating to differentiate
it from NULL_TREE which stands for some attribute specifier has been parsed,
but it didn't contain any (or any valid) attributes.
2023-12-08 Jakub Jelinek <jakub@redhat.com>
* parser.cc (cp_parser_std_attribute_spec): Return void_list_node
rather than NULL_TREE if token is neither CPP_OPEN_SQUARE nor
RID_ALIGNAS CPP_KEYWORD.
(cp_parser_std_attribute_spec_seq): For attr_spec == void_list_node
break, for attr_spec == NULL_TREE continue.
* g++.dg/cpp0x/gen-attrs-79.C: New test.
Diffstat (limited to 'gcc/gcc.cc')
0 files changed, 0 insertions, 0 deletions