Restore DECIMAL_DIG macro to C99/C11 value.
commitf6202e1a7b4ee3fb7240984f8a761eda190643f0
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 17 Feb 2017 23:04:14 +0000 (17 23:04 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 17 Feb 2017 23:04:14 +0000 (17 23:04 +0000)
treec9b3100beead8c8d74719d87c2f0b073c052b266
parentbb5c918a3774fb9058c2a1a9319922ca561773e4
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245555 138bc75d-0d04-0410-961f-82ee72b054a4
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