public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>,
	"Joseph S. Myers" <joseph@codesourcery.com>
Subject: [PATCH] Provide long double redirects in <math.h> and <complex.h> even for __NO_LONG_DOUBLE_MATH
Date: Thu, 23 Apr 2009 21:56:00 -0000	[thread overview]
Message-ID: <20090423220650.GX16681@sunsite.ms.mff.cuni.cz> (raw)

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

                 reply	other threads:[~2009-04-23 21:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090423220650.GX16681@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).