]> git.ipfire.org Git - thirdparty/gcc.git/commit
Support _Decimal* keywords for C2x.
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Oct 2019 17:32:48 +0000 (17:32 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Oct 2019 17:32:48 +0000 (17:32 +0000)
commit0c1a69279efa57edf982c3db516c4e753819390f
treeabec31c70851140a7af2d5ec10894a47c357ec8a
parentc1cc3d70a5ce10b0cc6c123152f2f03a2ab34738
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@276896 138bc75d-0d04-0410-961f-82ee72b054a4
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]