public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Provide long double redirects in <math.h> and <complex.h> even for __NO_LONG_DOUBLE_MATH
@ 2009-04-23 21:56 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2009-04-23 21:56 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers, Joseph S. Myers

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-23 21:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23 21:56 [PATCH] Provide long double redirects in <math.h> and <complex.h> even for __NO_LONG_DOUBLE_MATH Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).