Go to file
Joseph Myers c01bd174ef Expand C2x attribute parsing support and factor out from TM attributes.
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
2019-11-07 23:54:49 +00:00
config
contrib contrib: Add KPASS support to dg-extract-results.{sh,py} 2019-10-21 13:41:29 +01:00
fixincludes
gcc Expand C2x attribute parsing support and factor out from TM attributes. 2019-11-07 23:54:49 +00:00
gnattools
gotools
include
INSTALL
intl
libada
libatomic
libbacktrace
libcc1
libcpp PR c++/91370 - Implement P1041R4 and P1139R2 - Stronger Unicode reqs 2019-11-07 21:24:38 +01:00
libdecnumber
libffi
libgcc Support 64-bit double and 64-bit long double configurations. 2019-11-07 09:19:31 +00:00
libgfortran re PR libfortran/90374 (Fortran 2018: Support d0.d, e0.d, es0.d, en0.d, g0.d and ew.d e0 edit descriptors for output) 2019-11-07 03:06:20 +00:00
libgo runtime: correct facilities names in s390 CPU support 2019-10-14 14:10:16 +00:00
libgomp Warn about inconsistent OpenACC nested reduction clauses 2019-11-06 10:43:52 +00:00
libhsail-rt
libiberty PR c++/91979 - mangling nullptr expression 2019-11-04 18:24:25 -05:00
libitm
libobjc
liboffloadmic
libphobos
libquadmath
libsanitizer Update LOCAL_PATCHES. 2019-11-07 09:34:42 +00:00
libssp
libstdc++-v3 libstdc++: make negative count safe with std::for_each_n 2019-11-07 23:10:45 +00:00
libvtv
lto-plugin
maintainer-scripts crontab: Disable snapshots from gcc-7-branch. 2019-11-05 07:58:51 +00:00
zlib
.dir-locals.el
.gitattributes * .gitattributes: Also check ChangeLog whitespace. 2019-10-21 23:12:04 -04:00
.gitignore
ABOUT-NLS
ar-lib
ChangeLog * .gitattributes: Also check ChangeLog whitespace. 2019-10-21 23:12:04 -04:00
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 Remove Cell Broadband Engine SPU targets 2019-10-08 12:20:50 +02:00
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.