===================================================================
@@ -10959,8 +10959,9 @@ declspecs_add_type (location_t loc, struct c_decls
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:
===================================================================
@@ -351,9 +351,9 @@ const struct c_common_resword c_common_reswords[]
{ "_Float32x", RID_FLOAT32X, D_CONLY },
{ "_Float64x", RID_FLOAT64X, D_CONLY },
{ "_Float128x", RID_FLOAT128X, D_CONLY },
- { "_Decimal32", RID_DFLOAT32, D_CONLY | D_EXT },
- { "_Decimal64", RID_DFLOAT64, D_CONLY | D_EXT },
- { "_Decimal128", RID_DFLOAT128, D_CONLY | D_EXT },
+ { "_Decimal32", RID_DFLOAT32, D_CONLY },
+ { "_Decimal64", RID_DFLOAT64, D_CONLY },
+ { "_Decimal128", RID_DFLOAT128, D_CONLY },
{ "_Fract", RID_FRACT, D_CONLY | D_EXT },
{ "_Accum", RID_ACCUM, D_CONLY | D_EXT },
{ "_Sat", RID_SAT, D_CONLY | D_EXT },
===================================================================
@@ -0,0 +1,7 @@
+/* Test that _Decimal* keywords diagnosed in C11 mode: -pedantic. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic" } */
+
+_Decimal32 d32; /* { dg-warning "ISO C does not support" } */
+_Decimal64 d64; /* { dg-warning "ISO C does not support" } */
+_Decimal128 d128; /* { dg-warning "ISO C does not support" } */
===================================================================
@@ -0,0 +1,7 @@
+/* Test that _Decimal* keywords diagnosed in C11 mode: -pedantic-errors. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+_Decimal32 d32; /* { dg-error "ISO C does not support" } */
+_Decimal64 d64; /* { dg-error "ISO C does not support" } */
+_Decimal128 d128; /* { dg-error "ISO C does not support" } */
===================================================================
@@ -0,0 +1,7 @@
+/* Test that _Decimal* keywords are accepted in C2X mode. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
===================================================================
@@ -0,0 +1,7 @@
+/* Test that _Decimal* keywords are accepted in C2X mode: compat warnings. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wc11-c2x-compat" } */
+
+_Decimal32 d32; /* { dg-warning "ISO C does not support" } */
+_Decimal64 d64; /* { dg-warning "ISO C does not support" } */
+_Decimal128 d128; /* { dg-warning "ISO C does not support" } */
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-std=c99 -Wno-overflow" } */
+/* { dg-options "-std=c99 -Wno-overflow -pedantic-errors" } */
/* N1150 6: Constants.
C99 6.4.4.2: Floating constants. */
===================================================================
@@ -1,7 +1,7 @@
/* { dg-do compile } */
-/* { dg-options "-std=c89" } */
+/* { dg-options "-std=c89 -pedantic-errors" } */
-/* Decimal float keywords are not recognized in C89 mode. */
+/* Decimal float keywords are diagnosed in pedantic C89 mode. */
_Decimal32 x; /* { dg-error "" } */
_Decimal64 y; /* { dg-error "" } */
===================================================================
@@ -1,7 +1,7 @@
/* { dg-do compile } */
-/* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -pedantic-errors" } */
-/* Decimal float keywords are not recognized in C99 mode. */
+/* Decimal float keywords are diagnosed in pedantic C99 mode. */
_Decimal32 x; /* { dg-error "" } */
_Decimal64 y; /* { dg-error "" } */
===================================================================
@@ -1,15 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-std=c99" } */
-
-/* Decimal float keywords are not reserved for c99. */
-
-int _Decimal32 (void)
-{
- return 0;
-}
-
-int foo (int i)
-{
- int _Decimal64 = i * 2;
- return _Decimal64;
-}