aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2019-10-11 18:32:48 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2019-10-11 18:32:48 +0100
commitfe2bc27cdb6d572da0163d77e787ba644b400753 (patch)
treeabec31c70851140a7af2d5ec10894a47c357ec8a /gcc/c
parent6334c1f49fe3e3b81dfe90f25fdf89a3ddb557b8 (diff)
downloadgcc-fe2bc27cdb6d572da0163d77e787ba644b400753.zip
gcc-fe2bc27cdb6d572da0163d77e787ba644b400753.tar.gz
gcc-fe2bc27cdb6d572da0163d77e787ba644b400753.tar.bz2
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
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog4
-rw-r--r--gcc/c/c-decl.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index fa1001c..894f5e7 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,7 @@
+2019-10-11 Joseph Myers <joseph@codesourcery.com>
+
+ * c-decl.c (declspecs_add_type): Use pedwarn_c11 for DFP types.
+
2019-10-10 Jakub Jelinek <jakub@redhat.com>
* c-parser.c (c_parser_omp_all_clauses): Add NESTED_P argument, if
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 132fa3e..f67033b 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -10959,8 +10959,9 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
error_at (loc,
("decimal floating-point not supported "
"for this target"));
- pedwarn (loc, OPT_Wpedantic,
- "ISO C does not support decimal floating-point");
+ pedwarn_c11 (loc, OPT_Wpedantic,
+ "ISO C does not support decimal floating-point "
+ "before C2X");
return specs;
case RID_FRACT:
case RID_ACCUM: