r278273 - in /trunk/gcc: c-family/ChangeLog c-f...
jsm28@gcc.gnu.org
jsm28@gcc.gnu.org
Fri Nov 15 01:33:00 GMT 2019
Author: jsm28
Date: Fri Nov 15 01:33:37 2019
New Revision: 278273
URL: https://gcc.gnu.org/viewcvs?rev=278273&root=gcc&view=rev
Log:
Improve checks on C2x fallthrough attribute.
When adding C2x attribute support, some [[fallthrough]] support
appeared as a side-effect because of code for that attribute going
through separate paths from the normal attribute handling.
However, going through those paths without the normal attribute
handlers meant that certain checks, such as for the invalid usage
[[fallthrough()]], did not operate. This patch improves checks by
adding this attribute to the standard attribute table, so that the
parser knows it expects no arguments, along with adding an explicit
check for "[[fallthrough]];" attribute-declarations at top level. As
with other attributes, there are still cases where warnings should be
pedwarns because C2x constraints are violated, but this patch improves
the attribute handling.
Bootstrapped with no regressions on x86_64-pc-linux-gnu.
gcc/c:
* c-decl.c (std_attribute_table): Add fallthrough.
* c-parser.c (c_parser_declaration_or_fndef): Diagnose fallthrough
attribute at top level.
gcc/c-family:
* c-attribs.c (handle_fallthrough_attribute): Remove static.
* c-common.h (handle_fallthrough_attribute): Declare.
gcc/testsuite:
* gcc.dg/c2x-attr-fallthrough-2.c,
gcc.dg/c2x-attr-fallthrough-3.c: New tests.
Added:
trunk/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-2.c
trunk/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-3.c
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-attribs.c
trunk/gcc/c-family/c-common.h
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-decl.c
trunk/gcc/c/c-parser.c
trunk/gcc/testsuite/ChangeLog
More information about the Gcc-cvs
mailing list