GCC modified for the FreeChainXenon project
![]() The standard [[]] attributes currently defined in C2x are all not valid on types not being defined at the time. Use on such types results in a warning from attribs.c about attributes appertaining to types (the warning that I think is bogus in general for both C and C++, applying as it does to all [[]] attributes including gnu:: ones that are perfectly meaningful on types not being defined and work fine when __attribute__ syntax is used instead). If that warning is removed (as I intend to do in a subsequent patch), warnings may or may not result from the attribute handlers, depending on whether those particular attribute handlers consider the attributes meaningful in such a context. In C, however, the rules about where each [[]] attribute is valid are constraints, so a pedwarn, not a warning, is required. Because some handlers are shared between standard and gnu:: attributes, there can be cases that are valid for the GNU attribute variant but not for the standard one. So in general it is not correct to rely on the attribute handlers to give all required pedwarns (although in some cases, a pedwarn in the attribute handler is in appropriate way of diagnosing an invalid use); they not have the information about whether the attribute was a gnu:: one and can legitimately accept a wider range of uses for the gnu:: attributes. This patch ensures appropriate diagnostics for invalid uses of C2x standard attributes on types, and so helps pave the way for the subsequent removal of the bogus check in attribs.c, by adding a check run in the front end before calling decl_attributes; this check removes the attributes from the list after calling pedwarn to avoid subsequent duplicate warnings. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c: * c-decl.c (c_warn_type_attributes): New function. (groktypename, grokdeclarator, finish_declspecs): Call c_warn_type_attributes before applying attributes to types. * c-tree.h (c_warn_type_attributes): Declare. gcc/testsuite: * gcc.dg/c2x-attr-deprecated-2.c, gcc.dg/c2x-attr-fallthrough-2.c, gcc.dg/c2x-attr-maybe_unused-2.c: Expect errors for invalid uses of standard attributes on types. Add more tests of invalid uses on types. From-SVN: r278471 |
||
---|---|---|
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 | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.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.