aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.cc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2023-08-24 11:49:58 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2023-08-24 11:49:58 +0100
commit207a5daa9dcf31e367152163ad2a2ab4a0858967 (patch)
treea8a4511d364737e85b0a8d95696039148a282483 /gcc/tree-cfg.cc
parent2a0de833be3cb451cedf75ccae3d07f9825d7dc6 (diff)
downloadgcc-207a5daa9dcf31e367152163ad2a2ab4a0858967.zip
gcc-207a5daa9dcf31e367152163ad2a2ab4a0858967.tar.gz
gcc-207a5daa9dcf31e367152163ad2a2ab4a0858967.tar.bz2
c: Add support for [[__extension__ ...]]
[[]] attributes are a recent addition to C, but as a GNU extension, GCC allows them to be used in C11 and earlier. Normally this use would trigger a pedwarn (for -pedantic, -Wc11-c2x-compat, etc.). This patch allows the pedwarn to be suppressed by starting the attribute-list with __extension__. Also, :: is not a single lexing token prior to C2X, so it wasn't possible to use scoped attributes in C11, even as a GNU extension. The patch allows two colons to be used in place of :: when __extension__ is used. No attempt is made to check whether the two colons are immediately adjacent. gcc/ * doc/extend.texi: Document the C [[__extension__ ...]] construct. gcc/c/ * c-parser.cc (c_parser_std_attribute): Conditionally allow two colons to be used in place of ::. (c_parser_std_attribute_list): New function, split out from... (c_parser_std_attribute_specifier): ...here. Allow the attribute-list to start with __extension__. When it does, also allow two colons to be used in place of ::. gcc/testsuite/ * gcc.dg/c2x-attr-syntax-6.c: New test. * gcc.dg/c2x-attr-syntax-7.c: Likewise.
Diffstat (limited to 'gcc/tree-cfg.cc')
0 files changed, 0 insertions, 0 deletions