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

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

[PATCH] Provide long double redirects in <math.h> and <complex.h> even for __NO_LONG_DOUBLE_MATH


Hi!

As discussed in http://gcc.gnu.org/PR39491, as at least ISO C99 requires
long double functions, glibc should provide redirects for
__NO_LONG_DOUBLE_MATH case for them.  Currently they are provided only
if the target arch switched to larger long double, yet code is compiled
with -mlong-double-64 (say powerpc*, sparc*, alpha, s390*), but not on arm
or hppa.  Joseph tested an earlier version of this patch on arm, but I've
noticed the earlier patch was wrong when compiling glibc itself (in that
case I think the long double prototypes shouldn't be present so that they
all can be safely aliased to the double versions), so this patch is
untested.

2009-04-23  Jakub Jelinek  <jakub@redhat.com>

	* math/math.h: Provide *l long double prototypes redirecting
	to double functions even when __NO_LONG_DOUBLE_MATH and not
	__LDBL_COMPAT.
	* math/complex.h: Likewise.

--- libc/math/math.h.jj	2006-02-03 20:15:48.000000000 +0100
+++ libc/math/math.h	2009-04-23 23:45:04.000000000 +0200
@@ -98,7 +98,9 @@ __BEGIN_DECLS
 # undef	__MATH_PRECNAME
 
 # if (__STDC__ - 0 || __GNUC__ - 0) \
-     && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
+     && (!defined __NO_LONG_DOUBLE_MATH \
+	 || defined __LDBL_COMPAT \
+	 || !defined _LIBC)
 #  ifdef __LDBL_COMPAT
 
 #   ifdef __USE_ISOC99 
@@ -115,9 +117,9 @@ extern long double __REDIRECT_NTH (nextt
 				   nextafter) __attribute__ ((__const__));
 #    endif
 #   endif
+#  endif
 
-/* Include the file of declarations again, this time using `long double'
-   instead of `double' and appending l to each function name.  */
+#  if defined __LDBL_COMPAT || defined __NO_LONG_DOUBLE_MATH
 
 #   undef __MATHDECL_1
 #   define __MATHDECL_2(type, function,suffix, args, alias) \
@@ -127,6 +129,8 @@ extern long double __REDIRECT_NTH (nextt
   __MATHDECL_2(type, function,suffix, args, __CONCAT(function,suffix))
 #  endif
 
+/* Include the file of declarations again, this time using `long double'
+   instead of `double' and appending l to each function name.  */
 #  ifndef _Mlong_double_
 #   define _Mlong_double_	long double
 #  endif
@@ -140,8 +144,8 @@ extern long double __REDIRECT_NTH (nextt
 #  define _Mdouble_END_NAMESPACE   __END_NAMESPACE_C99
 #  include <bits/mathcalls.h>
 #  undef _Mdouble_
-# undef _Mdouble_BEGIN_NAMESPACE
-# undef _Mdouble_END_NAMESPACE
+#  undef _Mdouble_BEGIN_NAMESPACE
+#  undef _Mdouble_END_NAMESPACE
 #  undef __MATH_PRECNAME
 
 # endif /* __STDC__ || __GNUC__ */
--- libc/math/complex.h.jj	2006-05-15 16:41:04.000000000 +0200
+++ libc/math/complex.h	2009-04-23 23:46:28.000000000 +0200
@@ -85,8 +85,10 @@ __BEGIN_DECLS
 /* And the long double versions.  It is non-critical to define them
    here unconditionally since `long double' is required in ISO C99.  */
 #if (__STDC__ - 0 || __GNUC__ - 0) \
-    && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
-# ifdef __LDBL_COMPAT
+    && (!defined __NO_LONG_DOUBLE_MATH \
+        || defined __LDBL_COMPAT \
+        || !defined _LIBC)
+# if defined __LDBL_COMPAT || defined __NO_LONG_DOUBLE_MATH
 #  undef __MATHDECL_1
 #  define __MATHDECL_1(type, function, args) \
   extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function)

	Jakub


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