This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bits/mathdef.h cleanup, revisited


In <http://sourceware.org/bugzilla/show_bug.cgi?id=3516> I proposed in
2006 a patch cleaning up various targets' bits/mathdef.h headers, for
the reasons explained in that bug.  The bug was closed WONTFIX without
answering any of the reasons given.

The reasons relating to fixincludes (the original motivation) and the
unnecessary nature of __STDC__ checks in glibc in general have now
been addressed by my recent __STDC__ cleanups.  But the final point
remains: it's much more likely for other compilers for these
processors to evaluate float operations as float rather than using
excess precision, so it makes the headers simpler and more likely to
be accurate for other compilers if the __GNUC__ case is made
unconditional.

So I am again proposing the remaining part of my 2006 patch (below),
and would like to know what people in general, and the architecture
maintainers for the affected architectures (Power, SH, SPARC) in
particular, think about it.

2012-01-31  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/powerpc/bits/mathdef.h (float_t): Always define as
	float.
	* sysdeps/sh/sh4/bits/mathdef.h: Likewise.
	* sysdeps/sparc/bits/mathdef.h: Likewise.

diff --git a/sysdeps/powerpc/bits/mathdef.h b/sysdeps/powerpc/bits/mathdef.h
index 3a9b1b0..c5eee15 100644
--- a/sysdeps/powerpc/bits/mathdef.h
+++ b/sysdeps/powerpc/bits/mathdef.h
@@ -31,22 +31,10 @@
 #if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
 # define _MATH_H_MATHDEF	1
 
-# ifdef __GNUC__
-
-/* gcc leaves `float' expressions as-is.  */
-typedef float float_t;		/* `float' expressions are evaluated as
-				   `float'.  */
-typedef double double_t;	/* `double' expressions are evaluated as
-				   `double'.  */
-
-# else
-
-/* Wild guess at types for float_t and double_t. */
-typedef double float_t;
+/* PowerPC has both `float' and `double' arithmetic.  */
+typedef float float_t;
 typedef double double_t;
 
-# endif
-
 /* The values returned by `ilogb' for 0 and NaN respectively.  */
 # define FP_ILOGB0	(-2147483647)
 # define FP_ILOGBNAN	(2147483647)
diff --git a/sysdeps/sh/sh4/bits/mathdef.h b/sysdeps/sh/sh4/bits/mathdef.h
index 5b92234..74f7602 100644
--- a/sysdeps/sh/sh4/bits/mathdef.h
+++ b/sysdeps/sh/sh4/bits/mathdef.h
@@ -31,22 +31,10 @@
 #if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
 # define _MATH_H_MATHDEF	1
 
-# ifdef __GNUC__
-
-/* gcc leaves `float' expressions as-is.  */
-typedef float float_t;		/* `float' expressions are evaluated as
-				   `float'.  */
-typedef double double_t;	/* `double' expressions are evaluated as
-				   `double'.  */
-
-# else
-
-/* Wild guess at types for float_t and double_t. */
-typedef double float_t;
+/* SH has both `float' and `double' arithmetic.  */
+typedef float float_t;
 typedef double double_t;
 
-# endif
-
 /* The values returned by `ilogb' for 0 and NaN respectively.  */
 # define FP_ILOGB0	0x80000001
 # define FP_ILOGBNAN	0x7fffffff
diff --git a/sysdeps/sparc/bits/mathdef.h b/sysdeps/sparc/bits/mathdef.h
index 042c9c8..cd1f85a 100644
--- a/sysdeps/sparc/bits/mathdef.h
+++ b/sysdeps/sparc/bits/mathdef.h
@@ -29,20 +29,10 @@
 #if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
 # define _MATH_H_MATHDEF	1
 
-# ifdef __GNUC__
-
-/* gcc leaves `float' expressions as-is.  */
+/* SPARC has both `float' and `double' arithmetic.  */
 typedef float float_t;
 typedef double double_t;
 
-# else
-
-/* Wild guess at types for float_t and double_t. */
-typedef double float_t;
-typedef double double_t;
-
-# endif
-
 /* The values returned by `ilogb' for 0 and NaN respectively.  */
 # define FP_ILOGB0       (-2147483647)
 # define FP_ILOGBNAN     (2147483647)

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]