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]

[PATCH] Fix math-finite.h (BZ #13484)


As the PR says, we get a lot of errors when doing 
echo '#include <math.h>' | g++ -pedantic -ffast-math -O2 -xc++ - -S -o /dev/null
The problem is that we are not using the throw attribute in math-finite.h
even though the functions are marked as such in mathcalls.h.

Tested using g++ and gcc with -std=c++98/c++0x resp. -std=c89/c99/gnu89/gnu99
all with and without -pedantic.  Also compiles on x86_64-redhat-linux.

Though I wonder if we should guard all this with #ifdef __REDIRECT_NTH.

2011-12-08  Marek Polacek  <mpolacek@redhat.com>

	[BZ #13484]
	* math/bits/math-finite.h: Use __REDIRECT_NTH and __NTH instead
	of __asm__.

--- libc/NEWS.mp	2011-12-08 18:22:28.409649678 +0100
+++ libc/NEWS	2011-12-08 17:57:26.049220474 +0100
@@ -12,7 +12,7 @@ Version 2.15
   6779, 6783, 9696, 10103, 10709, 11589, 12403, 12847, 12868, 12852, 12874,
   12885, 12892, 12907, 12922, 12935, 13007, 13021, 13067, 13068, 13090,
   13092, 13114, 13118, 13123, 13134, 13138, 13147, 13150, 13179, 13192,
-  13268, 13276, 13291, 13335, 13337, 13344, 13358, 13367, 13472
+  13268, 13276, 13291, 13335, 13337, 13344, 13358, 13367, 13472, 13484
 
 * New program pldd to list loaded object of a process
   Implemented by Ulrich Drepper.
--- libc/math/bits/math-finite.h.mp	2011-12-08 17:37:01.991774358 +0100
+++ libc/math/bits/math-finite.h	2011-12-08 18:13:57.352045368 +0100
@@ -22,155 +22,159 @@
 #endif
 
 /* acos.  */
-extern double acos (double) __asm__ ("__acos_finite");
-extern float acosf (float) __asm__ ("__acosf_finite");
+extern double __REDIRECT_NTH (acos, (double), __acos_finite);
+extern float __REDIRECT_NTH (acosf, (float), __acosf_finite);
 #ifdef __MATH_DECLARE_LDOUBLE
-extern long double acosl (long double) __asm__ ("__acosl_finite");
+extern long double __REDIRECT_NTH (acosl, (long double), __acosl_finite);
 #endif
 
 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
 /* acosh.  */
-extern double acosh (double) __asm__ ("__acosh_finite");
-extern float acoshf (float) __asm__ ("__acoshf_finite");
+extern double __REDIRECT_NTH (acosh, (double), __acosh_finite);
+extern float __REDIRECT_NTH (acoshf, (float), __acoshf_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double acoshl (long double) __asm__ ("__acoshl_finite");
+extern long double __REDIRECT_NTH (acoshl, (long double), __acoshl_finite);
 # endif
 #endif
 
 /* asin.  */
-extern double asin (double) __asm__ ("__asin_finite");
-extern float asinf (float) __asm__ ("__asinf_finite");
+extern double __REDIRECT_NTH (asin, (double), __asin_finite);
+extern float __REDIRECT_NTH (asinf, (float), __asinf_finite);
 #ifdef __MATH_DECLARE_LDOUBLE
-extern long double asinl (long double) __asm__ ("__asinl_finite");
+extern long double __REDIRECT_NTH (asinl, (long double), __asinl_finite);
 #endif
 
 /* atan2.  */
-extern double atan2 (double, double) __asm__ ("__atan2_finite");
-extern float atan2f (float, float) __asm__ ("__atan2f_finite");
+extern double __REDIRECT_NTH (atan2, (double, double), __atan2_finite);
+extern float __REDIRECT_NTH (atan2f, (float, float), __atan2f_finite);
 #ifdef __MATH_DECLARE_LDOUBLE
-extern long double atan2l (long double, long double) __asm__ ("__atan2l_finite");
+extern long double __REDIRECT_NTH (atan2l, (long double, long double),
+				   __atan2l_finite);
 #endif
 
 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
 /* atanh.  */
-extern double atanh (double) __asm__ ("__atanh_finite");
-extern float atanhf (float) __asm__ ("__atanhf_finite");
+extern double __REDIRECT_NTH (atanh, (double), __atanh_finite);
+extern float __REDIRECT_NTH (atanhf, (float), __atanhf_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double atanhl (long double) __asm__ ("__atanhl_finite");
+extern long double __REDIRECT_NTH (atanhl, (long double), __atanhl_finite);
 # endif
 #endif
 
 /* cosh.  */
-extern double cosh (double) __asm__ ("__cosh_finite");
-extern float coshf (float) __asm__ ("__coshf_finite");
+extern double __REDIRECT_NTH (cosh, (double), __cosh_finite);
+extern float __REDIRECT_NTH (coshf, (float), __coshf_finite);
 #ifdef __MATH_DECLARE_LDOUBLE
-extern long double coshl (long double) __asm__ ("__coshl_finite");
+extern long double __REDIRECT_NTH (coshl, (long double), __coshl_finite);
 #endif
 
 /* exp.  */
-extern double exp (double) __asm__ ("__exp_finite");
-extern float expf (float) __asm__ ("__expf_finite");
+extern double __REDIRECT_NTH (exp, (double), __exp_finite);
+extern float __REDIRECT_NTH (expf, (float), __expf_finite);
 #ifdef __MATH_DECLARE_LDOUBLE
-extern long double expl (long double) __asm__ ("__expl_finite");
+extern long double __REDIRECT_NTH (expl, (long double), __expl_finite);
 #endif
 
 #ifdef __USE_GNU
 /* exp10.  */
-extern double exp10 (double) __asm__ ("__exp10_finite");
-extern float exp10f (float) __asm__ ("__exp10f_finite");
+extern double __REDIRECT_NTH (exp10, (double), __exp10_finite);
+extern float __REDIRECT_NTH (exp10f, (float), __exp10f_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double exp10l (long double) __asm__ ("__exp10l_finite");
+extern long double __REDIRECT_NTH (exp10l, (long double), __exp10l_finite);
 # endif
 
 /* pow10.  */
-extern double pow10 (double) __asm__ ("__exp10_finite");
-extern float pow10f (float) __asm__ ("__exp10f_finite");
+extern double __REDIRECT_NTH (pow10, (double), __exp10_finite);
+extern float __REDIRECT_NTH (pow10f, (float), __exp10f_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double pow10l (long double) __asm__ ("__exp10l_finite");
+extern long double __REDIRECT_NTH (pow10l, (long double), __exp10l_finite);
 # endif
 #endif
 
 #ifdef __USE_ISOC99
 /* exp2.  */
-extern double exp2 (double) __asm__ ("__exp2_finite");
-extern float exp2f (float) __asm__ ("__exp2f_finite");
+extern double __REDIRECT_NTH (exp2, (double), __exp2_finite);
+extern float __REDIRECT_NTH (exp2f, (float), __exp2f_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double exp2l (long double) __asm__ ("__exp2l_finite");
+extern long double __REDIRECT_NTH (exp2l, (long double), __exp2l_finite);
 # endif
 #endif
 
 /* fmod.  */
-extern double fmod (double, double) __asm__ ("__fmod_finite");
-extern float fmodf (float, float) __asm__ ("__fmodf_finite");
+extern double __REDIRECT_NTH (fmod, (double, double), __fmod_finite);
+extern float __REDIRECT_NTH (fmodf, (float, float), __fmodf_finite);
 #ifdef __MATH_DECLARE_LDOUBLE
-extern long double fmodl (long double, long double) __asm__ ("__fmodl_finite");
+extern long double __REDIRECT_NTH (fmodl, (long double, long double),
+				   __fmodl_finite);
 #endif
 
 #ifdef __USE_ISOC99
 /* hypot.  */
-extern double hypot (double, double) __asm__ ("__hypot_finite");
-extern float hypotf (float, float) __asm__ ("__hypotf_finite");
+extern double __REDIRECT_NTH (hypot, (double, double), __hypot_finite);
+extern float __REDIRECT_NTH (hypotf, (float, float), __hypotf_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double hypotl (long double, long double) __asm__ ("__hypotl_finite");
+extern long double __REDIRECT_NTH (hypotl, (long double, long double),
+				   __hypotl_finite);
 # endif
 #endif
 
 #if defined __USE_MISC || defined __USE_XOPEN
 /* j0.  */
-extern double j0 (double) __asm__ ("__j0_finite");
-extern float j0f (float) __asm__ ("__j0f_finite");
+extern double __REDIRECT_NTH (j0, (double), __j0_finite);
+extern float __REDIRECT_NTH (j0f, (float), __j0f_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double j0l (long double) __asm__ ("__j0l_finite");
+extern long double __REDIRECT_NTH (j0l, (long double), __j0l_finite);
 # endif
 
 /* y0.  */
-extern double y0 (double) __asm__ ("__y0_finite");
-extern float y0f (float) __asm__ ("__y0f_finite");
+extern double __REDIRECT_NTH (y0, (double), __y0_finite);
+extern float __REDIRECT_NTH (y0f, (float), __y0f_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double y0l (long double) __asm__ ("__y0l_finite");
+extern long double __REDIRECT_NTH (y0l, (long double), __y0l_finite);
 # endif
 
 /* j1.  */
-extern double j1 (double) __asm__ ("__j1_finite");
-extern float j1f (float) __asm__ ("__j1f_finite");
+extern double __REDIRECT_NTH (j1, (double), __j1_finite);
+extern float __REDIRECT_NTH (j1f, (float), __j1f_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double j1l (long double) __asm__ ("__j1l_finite");
+extern long double __REDIRECT_NTH (j1l, (long double), __j1l_finite);
 # endif
 
 /* y1.  */
-extern double y1 (double) __asm__ ("__y1_finite");
-extern float y1f (float) __asm__ ("__y1f_finite");
+extern double __REDIRECT_NTH (y1, (double), __y1_finite);
+extern float __REDIRECT_NTH (y1f, (float), __y1f_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double y1l (long double) __asm__ ("__y1l_finite");
+extern long double __REDIRECT_NTH (y1l, (long double), __y1l_finite);
 # endif
 
 /* jn.  */
-extern double jn (int, double) __asm__ ("__jn_finite");
-extern float jnf (int, float) __asm__ ("__jnf_finite");
+extern double __REDIRECT_NTH (jn, (int, double), __jn_finite);
+extern float __REDIRECT_NTH (jnf, (int, float), __jnf_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double jnl (int, long double) __asm__ ("__jnl_finite");
+extern long double __REDIRECT_NTH (jnl, (int, long double), __jnl_finite);
 # endif
 
 /* yn.  */
-extern double yn (int, double) __asm__ ("__yn_finite");
-extern float ynf (int, float) __asm__ ("__ynf_finite");
+extern double __REDIRECT_NTH (yn, (int, double), __yn_finite);
+extern float __REDIRECT_NTH (ynf, (int, float), __ynf_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double ynl (int, long double) __asm__ ("__ynl_finite");
+extern long double __REDIRECT_NTH (ynl, (int, long double), __ynl_finite);
 # endif
 #endif
 
 #ifdef __USE_MISC
 /* lgamma_r.  */
-extern double lgamma_r (double, int *) __asm__ ("__lgamma_r_finite");
-extern float lgammaf_r (float, int *) __asm__ ("__lgammaf_r_finite");
+extern double __REDIRECT_NTH (lgamma_r, (double, int *), __lgamma_r_finite);
+extern float __REDIRECT_NTH (lgammaf_r, (float, int *), __lgammaf_r_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double lgammal_r (long double, int *) __asm__ ("__lgammal_r_finite");
+extern long double __REDIRECT_NTH (lgammal_r, (long double, int *),
+				   __lgammal_r_finite);
 # endif
 #endif
 
 #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
 /* lgamma.  */
-__extern_always_inline double lgamma (double __d)
+__extern_always_inline double __NTH (lgamma (double __d))
 {
 # ifdef __USE_ISOC99
   int __local_signgam = 0;
@@ -179,7 +183,7 @@ __extern_always_inline double lgamma (do
   return lgamma_r (__d, &signgam);
 # endif
 }
-__extern_always_inline float lgammaf (float __d)
+__extern_always_inline float __NTH (lgammaf (float __d))
 {
 # ifdef __USE_ISOC99
   int __local_signgam = 0;
@@ -189,7 +193,7 @@ __extern_always_inline float lgammaf (fl
 # endif
 }
 # ifdef __MATH_DECLARE_LDOUBLE
-__extern_always_inline long double lgammal (long double __d)
+__extern_always_inline long double __NTH (lgammal (long double __d))
 {
 # ifdef __USE_ISOC99
   int __local_signgam = 0;
@@ -203,7 +207,7 @@ __extern_always_inline long double lgamm
 
 #if defined __USE_MISC || defined __USE_XOPEN
 /* gamma.  */
-__extern_always_inline double gamma (double __d)
+__extern_always_inline double __NTH (gamma (double __d))
 {
 # ifdef __USE_ISOC99
   int __local_signgam = 0;
@@ -212,7 +216,7 @@ __extern_always_inline double gamma (dou
   return lgamma_r (__d, &signgam);
 # endif
 }
-__extern_always_inline float gammaf (float __d)
+__extern_always_inline float __NTH (gammaf (float __d))
 {
 # ifdef __USE_ISOC99
   int __local_signgam = 0;
@@ -222,7 +226,7 @@ __extern_always_inline float gammaf (flo
 # endif
 }
 # ifdef __MATH_DECLARE_LDOUBLE
-__extern_always_inline long double gammal (long double __d)
+__extern_always_inline long double __NTH (gammal (long double __d))
 {
 #  ifdef __USE_ISOC99
   int __local_signgam = 0;
@@ -235,76 +239,79 @@ __extern_always_inline long double gamma
 #endif
 
 /* log.  */
-extern double log (double) __asm__ ("__log_finite");
-extern float logf (float) __asm__ ("__logf_finite");
+extern double __REDIRECT_NTH (log, (double), __log_finite);
+extern float __REDIRECT_NTH (logf, (float), __logf_finite);
 #ifdef __MATH_DECLARE_LDOUBLE
-extern long double logl (long double) __asm__ ("__logl_finite");
+extern long double __REDIRECT_NTH (logl, (long double), __logl_finite);
 #endif
 
 /* log10.  */
-extern double log10 (double) __asm__ ("__log10_finite");
-extern float log10f (float) __asm__ ("__log10f_finite");
+extern double __REDIRECT_NTH (log10, (double), __log10_finite);
+extern float __REDIRECT_NTH (log10f, (float), __log10f_finite);
 #ifdef __MATH_DECLARE_LDOUBLE
-extern long double log10l (long double) __asm__ ("__log10l_finite");
+extern long double __REDIRECT_NTH (log10l, (long double), __log10l_finite);
 #endif
 
 #ifdef __USE_ISOC99
 /* log2.  */
-extern double log2 (double) __asm__ ("__log2_finite");
-extern float log2f (float) __asm__ ("__log2f_finite");
+extern double __REDIRECT_NTH (log2, (double), __log2_finite);
+extern float __REDIRECT_NTH (log2f, (float), __log2f_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double log2l (long double) __asm__ ("__log2l_finite");
+extern long double __REDIRECT_NTH (log2l, (long double), __log2l_finite);
 # endif
 #endif
 
 /* pow.  */
-extern double pow (double, double) __asm__ ("__pow_finite");
-extern float powf (float, float) __asm__ ("__powf_finite");
+extern double __REDIRECT_NTH (pow, (double, double), __pow_finite);
+extern float __REDIRECT_NTH (powf, (float, float), __powf_finite);
 #ifdef __MATH_DECLARE_LDOUBLE
-extern long double powl (long double, long double) __asm__ ("__powl_finite");
+extern long double __REDIRECT_NTH (powl, (long double, long double),
+				   __powl_finite);
 #endif
 
 /* remainder.  */
-extern double remainder (double, double) __asm__ ("__remainder_finite");
-extern float remainderf (float, float) __asm__ ("__remainderf_finite");
+extern double __REDIRECT_NTH (remainder, (double, double), __remainder_finite);
+extern float __REDIRECT_NTH (remainderf, (float, float), __remainderf_finite);
 #ifdef __MATH_DECLARE_LDOUBLE
-extern long double remainderl (long double, long double) __asm__ ("__remainderl_finite");
+extern long double __REDIRECT_NTH (remainderl, (long double, long double),
+				   __remainderl_finite);
 #endif
 
 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
 /* scalb.  */
-extern double scalb (double, double) __asm__ ("__scalb_finite");
-extern float scalbf (float, float) __asm__ ("__scalbf_finite");
+extern double __REDIRECT_NTH (scalb, (double, double), __scalb_finite);
+extern float __REDIRECT_NTH (scalbf, (float, float), __scalbf_finite);
 # ifdef __MATH_DECLARE_LDOUBLE
-extern long double scalbl (long double, long double) __asm__ ("__scalbl_finite");
+extern long double __REDIRECT_NTH (scalbl, (long double, long double),
+				   __scalbl_finite);
 # endif
 #endif
 
 /* sinh.  */
-extern double sinh (double) __asm__ ("__sinh_finite");
-extern float sinhf (float) __asm__ ("__sinhf_finite");
+extern double __REDIRECT_NTH (sinh, (double), __sinh_finite);
+extern float __REDIRECT_NTH (sinhf, (float), __sinhf_finite);
 #ifdef __MATH_DECLARE_LDOUBLE
-extern long double sinhl (long double) __asm__ ("__sinhl_finite");
+extern long double __REDIRECT_NTH (sinhl, (long double), __sinhl_finite);
 #endif
 
 /* sqrt.  */
-extern double sqrt (double) __asm__ ("__sqrt_finite");
-extern float sqrtf (float) __asm__ ("__sqrtf_finite");
+extern double __REDIRECT_NTH (sqrt, (double), __sqrt_finite);
+extern float __REDIRECT_NTH (sqrtf, (float), __sqrtf_finite);
 #ifdef __MATH_DECLARE_LDOUBLE
-extern long double sqrtl (long double) __asm__ ("__sqrtl_finite");
+extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrtl_finite);
 #endif
 
 #ifdef __USE_ISOC99
 /* tgamma.  */
 extern double __gamma_r_finite (double, int *);
-__extern_always_inline double tgamma (double __d)
+__extern_always_inline double __NTH (tgamma (double __d))
 {
   int __local_signgam = 0;
   double __res = __gamma_r_finite (__d, &__local_signgam);
   return __local_signgam < 0 ? -__res : __res;
 }
 extern float __gammaf_r_finite (float, int *);
-__extern_always_inline float tgammaf (float __d)
+__extern_always_inline float __NTH (tgammaf (float __d))
 {
   int __local_signgam = 0;
   float __res = __gammaf_r_finite (__d, &__local_signgam);
@@ -312,7 +319,7 @@ __extern_always_inline float tgammaf (fl
 }
 # ifdef __MATH_DECLARE_LDOUBLE
 extern long double __gammal_r_finite (long double, int *);
-__extern_always_inline long double tgammal (long double __d)
+__extern_always_inline long double __NTH (tgammal (long double __d))
 {
   int __local_signgam = 0;
   long double __res = __gammal_r_finite (__d, &__local_signgam);


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