Restore DECIMAL_DIG macro to C99/C11 value.
authorJoseph Myers <joseph@codesourcery.com>
Fri, 17 Feb 2017 23:04:14 +0000 (23:04 +0000)
committerJoseph Myers <jsm28@gcc.gnu.org>
Fri, 17 Feb 2017 23:04:14 +0000 (23:04 +0000)
commit97fcf7446c130ae1a4499c408a75e7b4583e430b
treec9b3100beead8c8d74719d87c2f0b073c052b266
parentcb94c7007c6375f7e6752e0426a5ea0e3f046c47
Restore DECIMAL_DIG macro to C99/C11 value.

By extending the set of floating types, TS 18661-3 thereby affected
the definition of DECIMAL_DIG, which is defined in terms of the
"widest supported floating type".  This is not conditional on whether
__STDC_WANT_IEC_60559_TYPES_EXT__ is defined when <float.h> is
included.

I raised this possible incompatibility with C11 (an implementation
should be able to conform simultaneously with C11, and with C11 + TS
18661) in DR#501.  This is not yet resolved, but the latest proposal
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2108.pdf> would
obsolete DECIMAL_DIG with the intention of limiting it to the C11
types (so making it equivalent to LDBL_DECIMAL_DIG).  (This proposal
is intended to go along with a corresponding change to TS 18661-3 to
avoid the new types and non-arithmetic interchange encodings affecting
the value of DECIMAL_DIG.)

To avoid releasing GCC 7 with a wider-than-C11 value of DECIMAL_DIG
and possibly reverting back to a C11 value in a future release, this
patch reverts back to the C11 value now.  If the proposed resolution
to DR#501 changes again so that DECIMAL_DIG *should* have a
wider-than-C11 value, we can move back to a wider-than-C11 value in
GCC 8.

Bootstrapped with no regressions on x86_64-pc-linux-gnu.

gcc/c-family:
* c-cppbuiltin.c (builtin_define_float_constants): Define
__DECIMAL_DIG__ to the value for long double.

gcc/testsuite:
* gcc.dg/c11-float-2.c: New test.
* gcc.dg/torture/float128-floath.c,
gcc.dg/torture/float128x-floath.c,
gcc.dg/torture/float16-floath.c, gcc.dg/torture/float32-floath.c,
gcc.dg/torture/float32x-floath.c, gcc.dg/torture/float64-floath.c,
gcc.dg/torture/float64x-floath.c: Do not test comparison of
*_DECIMAL_DIG macros with DECIMAL_DIG.

From-SVN: r245555
gcc/c-family/ChangeLog
gcc/c-family/c-cppbuiltin.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/c11-float-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/float128-floath.c
gcc/testsuite/gcc.dg/torture/float128x-floath.c
gcc/testsuite/gcc.dg/torture/float16-floath.c
gcc/testsuite/gcc.dg/torture/float32-floath.c
gcc/testsuite/gcc.dg/torture/float32x-floath.c
gcc/testsuite/gcc.dg/torture/float64-floath.c
gcc/testsuite/gcc.dg/torture/float64x-floath.c