c01bd174ef
There is one place in the C parser that already handles a subset of the C2x [[]] attribute syntax: c_parser_transaction_attributes. This patch factors C2x attribute parsing out of there, extending it to cover the full C2x attribute syntax (although currently only called from that one place in the parser - so this is another piece of preparation for supporting C2x attributes in the places where C2x says they are valid, not the patch that actually enables such support). The new C2X attribute parsing code uses the same representation for scoped attributes as C++ does, so requiring parse_tm_stmt_attr to handle the scoped attributes representation (C++ currently special-cases TM attributes "to avoid the pedwarn in C++98 mode"; in C I'm using an argument to c_parser_std_attribute_specifier to disable the pedwarn_c11 call in the TM case). Parsing of arguments to known attributes is shared by GNU and C2x attributes. C2x specifies that unknown attributes are ignored (GCC practice in such a case is to warn along with ignoring the attribute) and gives a very general balanced-token-sequence syntax for arguments to unknown attributes (known ones each have their own syntax which is a subset of balanced-token-sequence), so support is added for parsing and ignoring such balanced-token-sequences as arguments of unknown attributes. Some limited tests are added of different attribute usages in the TM attribute case. The cases that become valid in the TM case include extra commas inside [[]], and an explicit "gnu" namespace, as the extra commas have no semantic effect for C2x attributes, while accepting the "gnu" namespace seems appropriate because the attribute in question is accepted inside __attribute__ (()), which is considered equivalent to the "gnu" namespace inside [[]]. Bootstrapped with no regressions on x86_64-pc-linux-gnu. gcc/c: * c-parser.c (c_parser_attribute_arguments): New function. Factored out of c_parser_gnu_attribute. (c_parser_gnu_attribute): Use c_parser_attribute_arguments. (c_parser_balanced_token_sequence, c_parser_std_attribute) (c_parser_std_attribute_specifier): New functions. (c_parser_transaction_attributes): Use c_parser_std_attribute_specifier. gcc/c-family: * c-attribs.c (parse_tm_stmt_attr): Handle scoped attributes. gcc/testsuite: * gcc.dg/tm/attrs-1.c: New test. * gcc.dg/tm/props-5.c: New test. Based on props-4.c. From-SVN: r277935 |
||
---|---|---|
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libhsail-rt | ||
libiberty | ||
libitm | ||
libobjc | ||
liboffloadmic | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING3 | ||
COPYING3.LIB | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
lt~obsolete.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.