Go to file
Joseph Myers 6c80b1b56d Make more bad uses of fallthrough attribute into pedwarns.
Various bad uses of the [[fallthrough]] attribute are constraint
violations in C2x, so need pedwarns rather than warnings.

This patch duly turns the relevant warnings into pedwarns.  The
relevant code is not specific to C, and does not know which form the
attribute was given in ([[fallthrough]] or [[gnu::fallthrough]] or
__attribute__((fallthrough))), but as I understand it these usages are
also erroneous for C++ and it seems reasonable to give a pedwarn here
even when a form other than [[fallthrough]] is being used.

The precise meaning of the standard wording about "The next statement
that would be executed" seems a but unclear in some corner cases; the
tests added keep to cases where it is clear whether or not the next
statement executed is of the required form.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc:
	* gimplify.c (expand_FALLTHROUGH_r, expand_FALLTHROUGH): Use
	pedwarn instead of warning_at for fallthrough not preceding a case
	or default label.

gcc/c-family:
	* c-attribs.c (handle_fallthrough_attribute): Use pedwarn instead
	of warning.

gcc/testsuite:
	* gcc.dg/c2x-attr-fallthrough-6.c: New test.  Split out from
	c2x-attr-fallthrough-3.c.
	* gcc.dg/c2x-attr-fallthrough-1.c: Add more tests.
	* gcc.dg/c2x-attr-fallthrough-2.c: Update expected diagnostics.
	* gcc.dg/c2x-attr-fallthrough-3.c: Split inside-switch part of
	test out to c2x-attr-fallthrough-6.c.

From-SVN: r278599
2019-11-21 20:29:40 +00:00
config
contrib
fixincludes
gcc Make more bad uses of fallthrough attribute into pedwarns. 2019-11-21 20:29:40 +00:00
gnattools
gotools
include
INSTALL
intl
libada
libatomic
libbacktrace
libcc1
libcpp
libdecnumber
libffi
libgcc
libgfortran
libgo re PR go/92605 (r278509 causes/reveals issue in building go library) 2019-11-21 01:06:47 +00:00
libgomp Fix failures on Solaris with -fno-common default 2019-11-21 16:14:21 +00:00
libhsail-rt
libiberty
libitm
libobjc
liboffloadmic
libphobos
libquadmath
libsanitizer Update comment in libsanitizer/*/libtool-version files. 2019-11-20 14:52:05 +00:00
libssp
libstdc++-v3 Switch gcc ftp URL's to https 2019-11-20 22:24:48 +02:00
libvtv
lto-plugin
maintainer-scripts Switch gcc ftp URL's to https 2019-11-20 22:24:48 +02:00
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Switch gcc ftp URL's to https 2019-11-20 22:24:48 +02:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure Switch gcc ftp URL's to https 2019-11-20 22:24:48 +02:00
configure.ac Switch gcc ftp URL's to https 2019-11-20 22:24:48 +02:00
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 my name from AArch64 port maintainers 2019-11-20 09:29:13 +00: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.