diff options
author | Joseph Myers <joseph@codesourcery.com> | 2022-09-15 20:10:42 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2022-09-15 20:10:42 +0000 |
commit | 6248f4ff67502c88d92f55fa5ea5996937220e5c (patch) | |
tree | a8eb0e45a5b071b13ec6e6c41ec8f2fa74e95358 /gcc/testsuite/gcc.dg/c2x-float-2.c | |
parent | ecbdfa8b314e2c17da17511b86371f552bffd441 (diff) | |
download | gcc-6248f4ff67502c88d92f55fa5ea5996937220e5c.zip gcc-6248f4ff67502c88d92f55fa5ea5996937220e5c.tar.gz gcc-6248f4ff67502c88d92f55fa5ea5996937220e5c.tar.bz2 |
float.h: Do not define INFINITY for C2x when infinities not supported
C2x has changed the rules for defining INFINITY in <float.h> so it is
no longer defined when float does not support infinities, instead of
being defined to an expression that overflows at translation time.
Thus, make the definition conditional on __FLT_HAS_INFINITY__ (this is
already inside a C2x-conditional part of <float.h>, because previous C
standard versions only had this macro in <math.h>).
Bootstrapped with no regressions for x86_64-pc-linux-gnu. Also did a
spot test of the case of no infinities supported by building cc1 for
vax-netbsdelf and testing compiling the new c2x-float-11.c test with
it.
gcc/
* ginclude/float.h (INFINITY): Define only if
[__FLT_HAS_INFINITY__].
gcc/testsuite/
* gcc.dg/c2x-float-2.c: Require inff effective-target.
* gcc.dg/c2x-float-11.c: New test.
Diffstat (limited to 'gcc/testsuite/gcc.dg/c2x-float-2.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/c2x-float-2.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/c2x-float-2.c b/gcc/testsuite/gcc.dg/c2x-float-2.c index 4f669fd..61a77f6 100644 --- a/gcc/testsuite/gcc.dg/c2x-float-2.c +++ b/gcc/testsuite/gcc.dg/c2x-float-2.c @@ -1,8 +1,8 @@ -/* Test INFINITY macro. Generic test even if infinities not - supported. */ +/* Test INFINITY macro. Generic test. */ /* { dg-do run } */ /* { dg-options "-std=c2x -w" } */ /* { dg-add-options ieee } */ +/* { dg-require-effective-target inff } */ #include <float.h> |