Support _Decimal* keywords for C2x.
authorJoseph Myers <joseph@codesourcery.com>
Fri, 11 Oct 2019 17:32:48 +0000 (18:32 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Fri, 11 Oct 2019 17:32:48 +0000 (18:32 +0100)
commitfe2bc27cdb6d572da0163d77e787ba644b400753
treeabec31c70851140a7af2d5ec10894a47c357ec8a
parent6334c1f49fe3e3b81dfe90f25fdf89a3ddb557b8
Support _Decimal* keywords for C2x.

ISO C2x adds decimal floating point as an optional standard feature.
This patch accordingly makes GCC accept the _Decimal* keywords in
strict C2x mode, using pedwarn_c11 to get a warning for
-Wc11-c2x-compat.  (Constants, where the pedwarn is in libcpp, will be
dealt with separately.)

The _Decimal* keywords are marked with D_EXT, meaning they are not
considered keywords at all in strict conformance modes.  This is
contrary to the normal practice for most implementation-namespace
keywords, which are accepted in all standards modes but with
appropriate pedwarns for older standards.  This patch removes D_EXT
from those keywords so they are accepted as keywords for all
standards, consequently removing the gcc.dg/dfp/keywords-ignored-c99.c
test that is no longer valid.

(A new D_C2X for keywords will still be needed if any new keywords get
added that aren't in the implementation namespace for older standards;
there are proposals for such keywords, albeit as predefined macros
that might not actually need new keywords in the compiler in all
cases.  If the DFP keywords end up as decimal32 etc., of course
appropriate compiler and testcase changes will be needed, and a
version of keywords-ignored-c99.c would make sense again with such
spellings.)

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

gcc/c:
* c-decl.c (declspecs_add_type): Use pedwarn_c11 for DFP types.

gcc/c-family:
* c-common.c (c_common_reswords): Do not use D_EXT for _Decimal32,
_Decimal64 and _Decimal128.

gcc/testsuite:
* gcc.dg/dfp/c11-keywords-1.c, gcc.dg/dfp/c11-keywords-2.c,
gcc.dg/dfp/c2x-keywords-1.c, gcc.dg/dfp/c2x-keywords-2.c: New
tests.
* gcc.dg/dfp/keywords-ignored-c99.c: Remove test.
* gcc.dg/dfp/constants-c99.c, gcc.dg/dfp/keywords-c89.c,
gcc.dg/dfp/keywords-c99.c: Use -pedantic-errors.

From-SVN: r276896
13 files changed:
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/dfp/c11-keywords-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/dfp/c11-keywords-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/dfp/c2x-keywords-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/dfp/c2x-keywords-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/dfp/constants-c99.c
gcc/testsuite/gcc.dg/dfp/keywords-c89.c
gcc/testsuite/gcc.dg/dfp/keywords-c99.c
gcc/testsuite/gcc.dg/dfp/keywords-ignored-c99.c [deleted file]