aboutsummaryrefslogtreecommitdiff
path: root/gcc/ginclude
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2019-10-10 23:54:33 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2019-10-10 23:54:33 +0100
commit27dfdc0f92850a7a837a99e69ec7b680c056dc18 (patch)
tree321e69249d0f45d05234f0269d8f8735fea48911 /gcc/ginclude
parent8faf3ed95357002fdc53890d80c931784beb74eb (diff)
downloadgcc-27dfdc0f92850a7a837a99e69ec7b680c056dc18.zip
gcc-27dfdc0f92850a7a837a99e69ec7b680c056dc18.tar.gz
gcc-27dfdc0f92850a7a837a99e69ec7b680c056dc18.tar.bz2
Update DFP macros in float.h for C2x and TS 18661-2.
GCC's <float.h> includes various macros for decimal floating-point types, defined if __STDC_WANT_DEC_FP__, as defined in TS 24732. TS 18661-2 and C2X make some changes to those macros. In TS 18661-2, they are to be defined if __STDC_WANT_IEC_60559_DFP_EXT__, and the *_SUBNORMAL_MIN macros are renamed to *_TRUE_MIN. In C2X, the macros are to be defined whenever DFP is supported, without needing any feature test macro to be defined. This patch updates the header accordingly. There is no existing predefined macro for whether the target supports DFP; rather than adding a new macro for that purpose, this patch changes the predefined macros used in <float.h> so that they are only defined when DFP is supported and thus can be used as conditionals; this is the same way predefined macros for _FloatN and _FloatNx types work. Although formally TR 24732 and TS 18661-2 say nothing about implementations lacking DFP support, it seems appropriate to avoid defining the macros in <float.h>, in the absence of DFP support, even if the respective feature test macros are defined. Bootstrapped with no regressions on x86_64-pc-linux-gnu. Also tested the c2x-float-no-dfp-* tests for aarch64-linux-gnu to make sure they do pass in a no-DFP configuration. gcc: * ginclude/float.h [!__DEC32_MANT_DIG__]: Do not define DFP macros. [__STDC_WANT_IEC_60559_DFP_EXT__ || __STDC_VERSION__ > 201710L]: Also define DFP macros for these conditions. [!__STDC_WANT_DEC_FP__] (DEC32_SUBNORMAL_MIN, DEC64_SUBNORMAL_MIN, DEC128_SUBNORMAL_MIN): Do not define. [__STDC_WANT_IEC_60559_DFP_EXT__ || __STDC_VERSION__ > 201710L] (DEC32_TRUE_MIN, DEC64_TRUE_MIN, DEC128_TRUE_MIN): New macros. gcc/c-family: * c-cppbuiltin.c (c_cpp_builtins): Do not define macros for DFP types if DFP not supported. gcc/testsuite: * gcc.dg/c11-float-dfp-1.c, gcc.dg/c2x-float-no-dfp-1.c, gcc.dg/c2x-float-no-dfp-2.c, gcc.dg/dfp/c2x-float-dfp-1.c, gcc.dg/dfp/c2x-float-dfp-2.c, gcc.dg/dfp/c2x-float-dfp-3.c, gcc.dg/dfp/tr24732-float-dfp-1.c, gcc.dg/dfp/ts18661-2-float-dfp-1.c: New tests. From-SVN: r276854
Diffstat (limited to 'gcc/ginclude')
-rw-r--r--gcc/ginclude/float.h47
1 files changed, 35 insertions, 12 deletions
diff --git a/gcc/ginclude/float.h b/gcc/ginclude/float.h
index 4767d7b..dc91c75 100644
--- a/gcc/ginclude/float.h
+++ b/gcc/ginclude/float.h
@@ -426,9 +426,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif /* __STDC_WANT_IEC_60559_TYPES_EXT__. */
-#ifdef __STDC_WANT_DEC_FP__
-/* Draft Technical Report 24732, extension for decimal floating-point
- arithmetic: Characteristic of decimal floating types <float.h>. */
+#ifdef __DEC32_MANT_DIG__
+#if (defined __STDC_WANT_DEC_FP__ \
+ || defined __STDC_WANT_IEC_60559_DFP_EXT__ \
+ || (defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L))
+/* C2X; formerly Technical Report 24732, extension for decimal
+ floating-point arithmetic: Characteristic of decimal floating types
+ <float.h>, and TS 18661-2. */
/* Number of base-FLT_RADIX digits in the significand, p. */
#undef DEC32_MANT_DIG
@@ -480,14 +484,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define DEC64_MIN __DEC64_MIN__
#define DEC128_MIN __DEC128_MIN__
-/* Minimum subnormal positive floating-point number. */
-#undef DEC32_SUBNORMAL_MIN
-#undef DEC64_SUBNORMAL_MIN
-#undef DEC128_SUBNORMAL_MIN
-#define DEC32_SUBNORMAL_MIN __DEC32_SUBNORMAL_MIN__
-#define DEC64_SUBNORMAL_MIN __DEC64_SUBNORMAL_MIN__
-#define DEC128_SUBNORMAL_MIN __DEC128_SUBNORMAL_MIN__
-
/* The floating-point expression evaluation method.
-1 indeterminate
0 evaluate all operations and constants just to the range and
@@ -502,6 +498,33 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#undef DEC_EVAL_METHOD
#define DEC_EVAL_METHOD __DEC_EVAL_METHOD__
-#endif /* __STDC_WANT_DEC_FP__ */
+#endif /* __STDC_WANT_DEC_FP__ || __STDC_WANT_IEC_60559_DFP_EXT__ || C2X. */
+
+#ifdef __STDC_WANT_DEC_FP__
+
+/* Minimum subnormal positive floating-point number. */
+#undef DEC32_SUBNORMAL_MIN
+#undef DEC64_SUBNORMAL_MIN
+#undef DEC128_SUBNORMAL_MIN
+#define DEC32_SUBNORMAL_MIN __DEC32_SUBNORMAL_MIN__
+#define DEC64_SUBNORMAL_MIN __DEC64_SUBNORMAL_MIN__
+#define DEC128_SUBNORMAL_MIN __DEC128_SUBNORMAL_MIN__
+
+#endif /* __STDC_WANT_DEC_FP__. */
+
+#if (defined __STDC_WANT_IEC_60559_DFP_EXT__ \
+ || (defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L))
+
+/* Minimum subnormal positive floating-point number. */
+#undef DEC32_TRUE_MIN
+#undef DEC64_TRUE_MIN
+#undef DEC128_TRUE_MIN
+#define DEC32_TRUE_MIN __DEC32_SUBNORMAL_MIN__
+#define DEC64_TRUE_MIN __DEC64_SUBNORMAL_MIN__
+#define DEC128_TRUE_MIN __DEC128_SUBNORMAL_MIN__
+
+#endif /* __STDC_WANT_IEC_60559_DFP_EXT__ || C2X. */
+
+#endif /* __DEC32_MANT_DIG__ */
#endif /* _FLOAT_H___ */