forked from gcc-mirror/gcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
c: Don't pedwarn on _FloatN{,x} or {f,F}N{,x} suffixes for C2X
Now that _Float{16,32,64,128,32x,64x,128x} and {f,F}{16,32,64,128,32x,64x,128x} literal suffixes are in C23 standard, I think it is undesirable to pedwarn about these for -std=c2x, so this patch uses pedwarn_c11 instead. In c-family/, we don't have that function and am not sure it would be very clean to define dummy pedwarn_c11 in the C++ FE, so the patch just does what pedwarn_c11 does using pedwarn/warning. 2023-09-06 Jakub Jelinek <[email protected]> gcc/c-family/ * c-lex.cc (interpret_float): For C diagnostics on FN and FNx suffixes append " before C2X" to diagnostics text and follow behavior of pedwarn_c11. gcc/c/ * c-decl.cc (declspecs_add_type): Use pedwarn_c11 rather than pedwarn for _FloatN{,x} diagnostics and append " before C2X" to the diagnostic text. gcc/testsuite/ * gcc.dg/c11-floatn-1.c: New test. * gcc.dg/c11-floatn-2.c: New test. * gcc.dg/c11-floatn-3.c: New test. * gcc.dg/c11-floatn-4.c: New test. * gcc.dg/c11-floatn-5.c: New test. * gcc.dg/c11-floatn-6.c: New test. * gcc.dg/c11-floatn-7.c: New test. * gcc.dg/c11-floatn-8.c: New test. * gcc.dg/c2x-floatn-1.c: New test. * gcc.dg/c2x-floatn-2.c: New test. * gcc.dg/c2x-floatn-3.c: New test. * gcc.dg/c2x-floatn-4.c: New test. * gcc.dg/c2x-floatn-5.c: New test. * gcc.dg/c2x-floatn-6.c: New test. * gcc.dg/c2x-floatn-7.c: New test. * gcc.dg/c2x-floatn-8.c: New test.
- Loading branch information
1 parent
b13b0dd
commit 7bb01e4
Showing
18 changed files
with
218 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* { 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; |