error ("unsupported non-standard suffix on floating constant");
return error_mark_node;
}
- else if (c_dialect_cxx () && !extended)
+ else if (!c_dialect_cxx ())
+ {
+ if (warn_c11_c2x_compat > 0)
+ {
+ if (pedantic && !flag_isoc2x)
+ pedwarn (input_location, OPT_Wc11_c2x_compat,
+ "non-standard suffix on floating constant "
+ "before C2X");
+ else
+ warning (OPT_Wc11_c2x_compat,
+ "non-standard suffix on floating constant "
+ "before C2X");
+ }
+ else if (warn_c11_c2x_compat != 0 && pedantic && !flag_isoc2x)
+ pedwarn (input_location, OPT_Wpedantic,
+ "non-standard suffix on floating constant "
+ "before C2X");
+ }
+ else if (!extended)
{
if (cxx_dialect < cxx23)
pedwarn (input_location, OPT_Wpedantic,
CASE_RID_FLOATN_NX:
specs->floatn_nx_idx = i - RID_FLOATN_NX_FIRST;
if (!in_system_header_at (input_location))
- pedwarn (loc, OPT_Wpedantic,
- "ISO C does not support the %<_Float%d%s%> type",
- floatn_nx_types[specs->floatn_nx_idx].n,
- (floatn_nx_types[specs->floatn_nx_idx].extended
- ? "x"
- : ""));
+ pedwarn_c11 (loc, OPT_Wpedantic,
+ "ISO C does not support the %<_Float%d%s%> type"
+ " before C2X",
+ floatn_nx_types[specs->floatn_nx_idx].n,
+ (floatn_nx_types[specs->floatn_nx_idx].extended
+ ? "x"
+ : ""));
if (specs->long_p)
error_at (loc,
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+/* { dg-add-options float32 } */
+/* { dg-add-options float64 } */
+/* { dg-add-options float32x } */
+/* { dg-require-effective-target float32 } */
+/* { dg-require-effective-target float32x } */
+/* { dg-require-effective-target float64 } */
+
+_Float32 a /* { dg-error "ISO C does not support the '_Float32' type before C2X" } */
+ = 1.0F32; /* { dg-error "non-standard suffix on floating constant before C2X" } */
+_Float64 b /* { dg-error "ISO C does not support the '_Float64' type before C2X" } */
+ = 1.0F64; /* { dg-error "non-standard suffix on floating constant before C2X" } */
+_Float32x c /* { dg-error "ISO C does not support the '_Float32x' type before C2X" } */
+ = 1.0F32x; /* { dg-error "non-standard suffix on floating constant before C2X" } */
+__extension__ _Float32 d
+ = 2.0F32;
+__extension__ _Float64 e
+ = 2.0F64;
+__extension__ _Float32x f
+ = 2.0F32x;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+/* { dg-add-options float128 } */
+/* { dg-require-effective-target float128 } */
+
+_Float128 a /* { dg-error "ISO C does not support the '_Float128' type before C2X" } */
+ = 1.0F128; /* { dg-error "non-standard suffix on floating constant before C2X" } */
+__extension__ _Float128 b
+ = 2.0F128;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+/* { dg-add-options float16 } */
+/* { dg-require-effective-target float16 } */
+
+_Float16 a /* { dg-error "ISO C does not support the '_Float16' type before C2X" } */
+ = 1.0F16; /* { dg-error "non-standard suffix on floating constant before C2X" } */
+__extension__ _Float16 b
+ = 2.0F16;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+/* { dg-add-options float64x } */
+/* { dg-require-effective-target float64x } */
+
+_Float64x a /* { dg-error "ISO C does not support the '_Float64x' type before C2X" } */
+ = 1.0F64x; /* { dg-error "non-standard suffix on floating constant before C2X" } */
+__extension__ _Float64x b
+ = 2.0F64x;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -Wc11-c2x-compat" } */
+/* { dg-add-options float32 } */
+/* { dg-add-options float64 } */
+/* { dg-add-options float32x } */
+/* { dg-require-effective-target float32 } */
+/* { dg-require-effective-target float32x } */
+/* { dg-require-effective-target float64 } */
+
+_Float32 a /* { dg-warning "ISO C does not support the '_Float32' type before C2X" } */
+ = 1.0F32; /* { dg-warning "non-standard suffix on floating constant before C2X" } */
+_Float64 b /* { dg-warning "ISO C does not support the '_Float64' type before C2X" } */
+ = 1.0F64; /* { dg-warning "non-standard suffix on floating constant before C2X" } */
+_Float32x c /* { dg-warning "ISO C does not support the '_Float32x' type before C2X" } */
+ = 1.0F32x; /* { dg-warning "non-standard suffix on floating constant before C2X" } */
+__extension__ _Float32 d
+ = 2.0F32;
+__extension__ _Float64 e
+ = 2.0F64;
+__extension__ _Float32x f
+ = 2.0F32x;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -Wc11-c2x-compat" } */
+/* { dg-add-options float128 } */
+/* { dg-require-effective-target float128 } */
+
+_Float128 a /* { dg-warning "ISO C does not support the '_Float128' type before C2X" } */
+ = 1.0F128; /* { dg-warning "non-standard suffix on floating constant before C2X" } */
+__extension__ _Float128 b
+ = 2.0F128;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -Wc11-c2x-compat" } */
+/* { dg-add-options float16 } */
+/* { dg-require-effective-target float16 } */
+
+_Float16 a /* { dg-warning "ISO C does not support the '_Float16' type before C2X" } */
+ = 1.0F16; /* { dg-warning "non-standard suffix on floating constant before C2X" } */
+__extension__ _Float16 b
+ = 2.0F16;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -Wc11-c2x-compat" } */
+/* { dg-add-options float64x } */
+/* { dg-require-effective-target float64x } */
+
+_Float64x a /* { dg-warning "ISO C does not support the '_Float64x' type before C2X" } */
+ = 1.0F64x; /* { dg-warning "non-standard suffix on floating constant before C2X" } */
+__extension__ _Float64x b
+ = 2.0F64x;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+/* { dg-add-options float32 } */
+/* { dg-add-options float64 } */
+/* { dg-add-options float32x } */
+/* { dg-require-effective-target float32 } */
+/* { dg-require-effective-target float32x } */
+/* { dg-require-effective-target float64 } */
+
+_Float32 a
+ = 1.0F32;
+_Float64 b
+ = 1.0F64;
+_Float32x c
+ = 1.0F32x;
+__extension__ _Float32 d
+ = 2.0F32;
+__extension__ _Float64 e
+ = 2.0F64;
+__extension__ _Float32x f
+ = 2.0F32x;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+/* { dg-add-options float128 } */
+/* { dg-require-effective-target float128 } */
+
+_Float128 a
+ = 1.0F128;
+__extension__ _Float128 b
+ = 2.0F128;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+/* { dg-add-options float16 } */
+/* { dg-require-effective-target float16 } */
+
+_Float16 a
+ = 1.0F16;
+__extension__ _Float16 b
+ = 2.0F16;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+/* { dg-add-options float64x } */
+/* { dg-require-effective-target float64x } */
+
+_Float64x a
+ = 1.0F64x;
+__extension__ _Float64x b
+ = 2.0F64x;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wc11-c2x-compat" } */
+/* { dg-add-options float32 } */
+/* { dg-add-options float64 } */
+/* { dg-add-options float32x } */
+/* { dg-require-effective-target float32 } */
+/* { dg-require-effective-target float32x } */
+/* { dg-require-effective-target float64 } */
+
+_Float32 a /* { dg-warning "ISO C does not support the '_Float32' type before C2X" } */
+ = 1.0F32; /* { dg-warning "non-standard suffix on floating constant before C2X" } */
+_Float64 b /* { dg-warning "ISO C does not support the '_Float64' type before C2X" } */
+ = 1.0F64; /* { dg-warning "non-standard suffix on floating constant before C2X" } */
+_Float32x c /* { dg-warning "ISO C does not support the '_Float32x' type before C2X" } */
+ = 1.0F32x; /* { dg-warning "non-standard suffix on floating constant before C2X" } */
+__extension__ _Float32 d
+ = 2.0F32;
+__extension__ _Float64 e
+ = 2.0F64;
+__extension__ _Float32x f
+ = 2.0F32x;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wc11-c2x-compat" } */
+/* { dg-add-options float128 } */
+/* { dg-require-effective-target float128 } */
+
+_Float128 a /* { dg-warning "ISO C does not support the '_Float128' type before C2X" } */
+ = 1.0F128; /* { dg-warning "non-standard suffix on floating constant before C2X" } */
+__extension__ _Float128 b
+ = 2.0F128;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wc11-c2x-compat" } */
+/* { dg-add-options float16 } */
+/* { dg-require-effective-target float16 } */
+
+_Float16 a /* { dg-warning "ISO C does not support the '_Float16' type before C2X" } */
+ = 1.0F16; /* { dg-warning "non-standard suffix on floating constant before C2X" } */
+__extension__ _Float16 b
+ = 2.0F16;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wc11-c2x-compat" } */
+/* { dg-add-options float64x } */
+/* { dg-require-effective-target float64x } */
+
+_Float64x a /* { dg-warning "ISO C does not support the '_Float64x' type before C2X" } */
+ = 1.0F64x; /* { dg-warning "non-standard suffix on floating constant before C2X" } */
+__extension__ _Float64x b
+ = 2.0F64x;