float.h: Handle C2x __STDC_WANT_IEC_60559_EXT__
TS 18661-1 and 18661-2 have various definitions conditional on __STDC_WANT_IEC_60559_BFP_EXT__ and __STDC_WANT_IEC_60559_DFP_EXT__ macros. When those TSes were integrated into C2x, most of the feature test macro conditionals were removed (with declarations for decimal FP becoming conditional only on whether decimal FP is supported by the implementation and those for binary FP becoming unconditionally required). A few tests of those feature test macros remained for declarations that appeared only in Annex F and not in the main part of the standard. A change accepted for C2x at the last WG14 meeting (but not yet added to the working draft in git) was to replace both those macros by __STDC_WANT_IEC_60559_EXT__; if __STDC_WANT_IEC_60559_EXT__ is defined, the specific declarations in the headers will then depend on which features are supported by the implementation, as for declarations not controlled by a feature test macro at all. Thus, add a check of __STDC_WANT_IEC_60559_EXT__ for CR_DECIMAL_DIG in float.h, the only case of this change relevant to GCC. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/ 2020-11-17 Joseph Myers <joseph@codesourcery.com> * ginclude/float.h (CR_DECIMAL_DIG): Also define for [__STDC_WANT_IEC_60559_EXT__]. gcc/testsuite/ 2020-11-17 Joseph Myers <joseph@codesourcery.com> * gcc.dg/cr-decimal-dig-3.c: New test.
This commit is contained in:
parent
ac30c8b8d0
commit
1ffd8e34d1
|
@ -285,7 +285,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||||
|
|
||||||
#endif /* C2X */
|
#endif /* C2X */
|
||||||
|
|
||||||
#ifdef __STDC_WANT_IEC_60559_BFP_EXT__
|
#if (defined __STDC_WANT_IEC_60559_BFP_EXT__ \
|
||||||
|
|| defined __STDC_WANT_IEC_60559_EXT__)
|
||||||
/* Number of decimal digits for which conversions between decimal
|
/* Number of decimal digits for which conversions between decimal
|
||||||
character strings and binary formats, in both directions, are
|
character strings and binary formats, in both directions, are
|
||||||
correctly rounded. */
|
correctly rounded. */
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
/* Test C2x CR_DECIMAL_DIG: defined for __STDC_WANT_IEC_60559_EXT__. */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-std=c2x" } */
|
||||||
|
|
||||||
|
#define __STDC_WANT_IEC_60559_EXT__
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
|
#ifndef CR_DECIMAL_DIG
|
||||||
|
#error "CR_DECIMAL_DIG not defined"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CR_DECIMAL_DIG < DECIMAL_DIG + 3
|
||||||
|
#error "CR_DECIMAL_DIG too small"
|
||||||
|
#endif
|
Loading…
Reference in New Issue