C2x adds macros for NaNs and infinities to <float.h>, some of them
previously in <math.h> (and some still in <math.h> as well in C2x as
an obsolescent feature). Add these macros to GCC's <float.h>
implementation.
This omits the macros for DFP signaling NaNs, leaving those to be
added in a separate patch. However, it includes the _FloatN /
_FloatNx macros (conditional on __STDC_WANT_IEC_60559_TYPES_EXT__) in
the current draft version of the integration of TS 18661-3 into C2x as
an Annex.
As GCC allows duplicate macro definitions with different expansions in
system headers, it should be OK if <math.h> defines INFINITY or NAN
with a slightly different expansion (e.g. different choice of whether
there is whitespace between tokens); tests are added including
<float.h> and <math.h> in either order. Because <float.h> uses #undef
on all macros before defining them, even with -Wsystem-headers there
could only ever be issues when <math.h> is included after <float.h>.
Bootstrapped with no regressions on x86_64-pc-linux-gnu.
gcc/
2020-11-17 Joseph Myers <joseph@codesourcery.com>