This is the mail archive of the
gcc-cvs@gcc.gnu.org
mailing list for the GCC project.
r278428 - in /trunk/gcc: c-family/ChangeLog c-f...
- From: jsm28 at gcc dot gnu dot org
- To: gcc-cvs at gcc dot gnu dot org
- Date: Tue, 19 Nov 2019 00:21:49 -0000
- Subject: r278428 - in /trunk/gcc: c-family/ChangeLog c-f...
Author: jsm28
Date: Tue Nov 19 00:21:49 2019
New Revision: 278428
URL: https://gcc.gnu.org/viewcvs?rev=278428&root=gcc&view=rev
Log:
Change some bad uses of C2x attributes into pedwarns.
Certain bad uses of C2x standard attributes (that is, attributes
inside [[]] with only a name but no namespace specified) are
constraint violations, and so should be diagnosed with a pedwarn (or
error) where GCC currently uses a warning. This patch implements this
in some cases (not yet for attributes used on types, nor for some bad
uses of fallthrough attributes). Specifically, this applies to
unknown standard attributes (taking care not to pedwarn for nodiscard,
which is known but not implemented for C), and to all currently
implemented standard attributes in attribute declarations (including
when mixed with fallthrough) and on statements.
Bootstrapped with no regressions on x86_64-pc-linux-gnu.
gcc/c:
* c-decl.c (c_warn_unused_attributes): Use pedwarn not warning for
standard attributes.
* c-parser.c (c_parser_std_attribute): Take argument for_tm. Use
pedwarn for unknown standard attributes and return error_mark_node
for them.
gcc/c-family:
* c-common.c (attribute_fallthrough_p): In C, use pedwarn not
warning for standard attributes mixed with fallthrough attributes.
gcc/testsuite:
* gcc.dg/c2x-attr-fallthrough-5.c, gcc.dg/c2x-attr-syntax-5.c: New
tests.
* gcc.dg/c2x-attr-deprecated-2.c, gcc.dg/c2x-attr-deprecated-4.c,
gcc.dg/c2x-attr-fallthrough-2.c, gcc.dg/c2x-attr-maybe_unused-2.c,
gcc.dg/c2x-attr-maybe_unused-4.c: Expect errors in place of some
warnings.
Added:
trunk/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-5.c
trunk/gcc/testsuite/gcc.dg/c2x-attr-syntax-5.c
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-common.c
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-decl.c
trunk/gcc/c/c-parser.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/c2x-attr-deprecated-2.c
trunk/gcc/testsuite/gcc.dg/c2x-attr-deprecated-4.c
trunk/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-2.c
trunk/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-2.c
trunk/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c