[PATCH] fix check in float.h for defining decimal float support

Janis Johnson janis187@us.ibm.com
Tue Mar 27 22:24:00 GMT 2007


The draft Technical Report for C support of decimal floating point says
that decimal float definitions in float.h should be protected by whether
or not __STDC_WANT_DEC_FP__ is defined, but currently it checks whether
it has the value 1.  This fixes it.  Tested on powerpc64-linux; ok for
mainline?

2007-03-27  Janis Johnson  <janis187@us.ibm.com>

	* ginclude/float.h: Check that __STDC_WANT_DEC_FP__ is defined,
	not its value.
testsuite/
	* gcc.dg/dfp/decfloat-constants.c: Check that __STDC_WANT_DEC_FP is
	defined, not its value.
	* gcc.dg/dfp/convert-dfp.c: Ditto.
	* gcc.dg/dfp/convert-int-saturate.c: Ditto.

Index: gcc/ginclude/float.h
===================================================================
--- gcc/ginclude/float.h	(revision 123252)
+++ gcc/ginclude/float.h	(working copy)
@@ -160,7 +160,7 @@
 
 #endif /* C99 */
 
-#if __STDC_WANT_DEC_FP__ == 1
+#ifdef __STDC_WANT_DEC_FP__
 /* Draft Technical Report 24732, extension for decimal floating-point
    arithmetic: Characteristic of decimal floating types <float.h>.  */
 
Index: gcc/testsuite/gcc.dg/dfp/decfloat-constants.c
===================================================================
--- gcc/testsuite/gcc.dg/dfp/decfloat-constants.c	(revision 123252)
+++ gcc/testsuite/gcc.dg/dfp/decfloat-constants.c	(working copy)
@@ -8,7 +8,7 @@
 
 /* Make sure we are exporting the right values to float.h. */
 #ifndef	__STDC_WANT_DEC_FP__
-#define __STDC_WANT_DEC_FP__ 1
+#define __STDC_WANT_DEC_FP__
 #endif
 
 #include <float.h>
Index: gcc/testsuite/gcc.dg/dfp/convert-dfp.c
===================================================================
--- gcc/testsuite/gcc.dg/dfp/convert-dfp.c	(revision 123252)
+++ gcc/testsuite/gcc.dg/dfp/convert-dfp.c	(working copy)
@@ -7,7 +7,7 @@
    Test various conversions involving decimal floating types. */
 
 #ifndef	__STDC_WANT_DEC_FP__
-#define __STDC_WANT_DEC_FP__ 1
+#define __STDC_WANT_DEC_FP__
 #endif
 
 #include <float.h>
Index: gcc/testsuite/gcc.dg/dfp/convert-int-saturate.c
===================================================================
--- gcc/testsuite/gcc.dg/dfp/convert-int-saturate.c	(revision 123252)
+++ gcc/testsuite/gcc.dg/dfp/convert-int-saturate.c	(working copy)
@@ -5,7 +5,7 @@
    Test integer saturation.  */
 
 #ifndef	__STDC_WANT_DEC_FP__
-#define __STDC_WANT_DEC_FP__ 1
+#define __STDC_WANT_DEC_FP__
 #endif
 
 #include <float.h>



More information about the Gcc-patches mailing list