diff options
author | Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com> | 2017-03-10 09:47:18 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com> | 2017-03-30 09:59:25 -0300 |
commit | f264cca59380bca8f372bd09a8da7c9e1bbbf493 (patch) | |
tree | 71c09cb174a4e768872acea55ee28fa0fb157e3d /math | |
parent | 3abeeec5f46ff036bd9df60bb096e20314ccd078 (diff) | |
download | glibc-f264cca59380bca8f372bd09a8da7c9e1bbbf493.tar.gz glibc-f264cca59380bca8f372bd09a8da7c9e1bbbf493.tar.xz glibc-f264cca59380bca8f372bd09a8da7c9e1bbbf493.zip |
Macroize inclusion of math-finite.h
This patch macroizes the declarations in math/bits/math-finite.h similarly to what math/bits/mathcalls.h does. For each floating-point type, the file is included once in math/math.h. This will reduce the amount of repetitive boilerplate required when adding float128 versions of these declarations. Tested for powerpc64le and s390x. * math/math.h: Include bits/math-finite.h once per floating-point type. * math/bits/math-finite.h: Macroize all declarations by floating-point type.
Diffstat (limited to 'math')
-rw-r--r-- | math/bits/math-finite.h | 478 | ||||
-rw-r--r-- | math/math.h | 42 |
2 files changed, 133 insertions, 387 deletions
diff --git a/math/bits/math-finite.h b/math/bits/math-finite.h index 02da3741d6..59cd06b866 100644 --- a/math/bits/math-finite.h +++ b/math/bits/math-finite.h @@ -20,487 +20,193 @@ # error "Never use <bits/math-finite.h> directly; include <math.h> instead." #endif -/* acos. */ -extern double __REDIRECT_NTH (acos, (double), __acos_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (acosf, (float), __acosf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (acosl, (long double), __acos_finite); -# else -extern long double __REDIRECT_NTH (acosl, (long double), __acosl_finite); -# endif -# endif +#define __REDIRFROM_X(function, reentrant, suffix) \ + function ## suffix ## reentrant +#define __REDIRFROM(...) __REDIRFROM_X(__VA_ARGS__) + +/* Redirect long double versions of the functions to the corresponding + double version if __NO_LONG_DOUBLE_MATH is defined. */ +#if __MATH_DECLARING_LDOUBLE && defined __NO_LONG_DOUBLE_MATH +# define __REDIRTO_X(function, reentrant, suffix) \ + __ ## function ## reentrant ## _finite +#else +# define __REDIRTO_X(function, reentrant, suffix) \ + __ ## function ## suffix ## reentrant ## _finite #endif +#define __REDIRTO(...) __REDIRTO_X(__VA_ARGS__) + +#define __MATH_REDIRCALL_X(from, args, to) \ + extern _Mdouble_ __REDIRECT_NTH (from, args, to) +#define __MATH_REDIRCALL(function, reentrant, args) \ + __MATH_REDIRCALL_X \ + (__REDIRFROM (function, reentrant, _MSUF_), args, \ + __REDIRTO (function, reentrant, _MSUF_)) +#define __MATH_REDIRCALL_2(from, reentrant, args, to) \ + __MATH_REDIRCALL_X \ + (__REDIRFROM (from, reentrant, _MSUF_), args, \ + __REDIRTO (to, reentrant, _MSUF_)) + +#define __MATH_REDIRCALL_INTERNAL(function, reentrant, args) \ + __MATH_REDIRCALL_X \ + (__REDIRFROM (__CONCAT (__, function), \ + __CONCAT (reentrant, _finite), _MSUF_), \ + args, __REDIRTO (function, _r, _MSUF_)) + + +/* acos. */ +__MATH_REDIRCALL (acos, , (_Mdouble_)); #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 /* acosh. */ -extern double __REDIRECT_NTH (acosh, (double), __acosh_finite); -#endif -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (acoshf, (float), __acoshf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (acoshl, (long double), __acosh_finite); -# else -extern long double __REDIRECT_NTH (acoshl, (long double), __acoshl_finite); -# endif -# endif +__MATH_REDIRCALL (acosh, , (_Mdouble_)); #endif /* asin. */ -extern double __REDIRECT_NTH (asin, (double), __asin_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (asinf, (float), __asinf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (asinl, (long double), __asin_finite); -# else -extern long double __REDIRECT_NTH (asinl, (long double), __asinl_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (asin, , (_Mdouble_)); /* atan2. */ -extern double __REDIRECT_NTH (atan2, (double, double), __atan2_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (atan2f, (float, float), __atan2f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (atan2l, (long double, long double), - __atan2_finite); -# else -extern long double __REDIRECT_NTH (atan2l, (long double, long double), - __atan2l_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (atan2, , (_Mdouble_, _Mdouble_)); #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 /* atanh. */ -extern double __REDIRECT_NTH (atanh, (double), __atanh_finite); -#endif -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (atanhf, (float), __atanhf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (atanhl, (long double), __atanh_finite); -# else -extern long double __REDIRECT_NTH (atanhl, (long double), __atanhl_finite); -# endif -# endif +__MATH_REDIRCALL (atanh, , (_Mdouble_)); #endif /* cosh. */ -extern double __REDIRECT_NTH (cosh, (double), __cosh_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (coshf, (float), __coshf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (coshl, (long double), __cosh_finite); -# else -extern long double __REDIRECT_NTH (coshl, (long double), __coshl_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (cosh, , (_Mdouble_)); /* exp. */ -extern double __REDIRECT_NTH (exp, (double), __exp_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (expf, (float), __expf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (expl, (long double), __exp_finite); -# else -extern long double __REDIRECT_NTH (expl, (long double), __expl_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (exp, , (_Mdouble_)); #ifdef __USE_GNU /* exp10. */ -extern double __REDIRECT_NTH (exp10, (double), __exp10_finite); -extern float __REDIRECT_NTH (exp10f, (float), __exp10f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (exp10l, (long double), __exp10_finite); -# else -extern long double __REDIRECT_NTH (exp10l, (long double), __exp10l_finite); -# endif -# endif +__MATH_REDIRCALL (exp10, , (_Mdouble_)); /* pow10. */ -extern double __REDIRECT_NTH (pow10, (double), __exp10_finite); -extern float __REDIRECT_NTH (pow10f, (float), __exp10f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (pow10l, (long double), __exp10_finite); -# else -extern long double __REDIRECT_NTH (pow10l, (long double), __exp10l_finite); -# endif -# endif +__MATH_REDIRCALL_2 (pow10, , (_Mdouble_), exp10); #endif #ifdef __USE_ISOC99 /* exp2. */ -extern double __REDIRECT_NTH (exp2, (double), __exp2_finite); -extern float __REDIRECT_NTH (exp2f, (float), __exp2f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (exp2l, (long double), __exp2_finite); -# else -extern long double __REDIRECT_NTH (exp2l, (long double), __exp2l_finite); -# endif -# endif +__MATH_REDIRCALL (exp2, , (_Mdouble_)); #endif /* fmod. */ -extern double __REDIRECT_NTH (fmod, (double, double), __fmod_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (fmodf, (float, float), __fmodf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (fmodl, (long double, long double), - __fmod_finite); -# else -extern long double __REDIRECT_NTH (fmodl, (long double, long double), - __fmodl_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (fmod, , (_Mdouble_, _Mdouble_)); #if defined __USE_XOPEN || defined __USE_ISOC99 /* hypot. */ -extern double __REDIRECT_NTH (hypot, (double, double), __hypot_finite); -#endif -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (hypotf, (float, float), __hypotf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (hypotl, (long double, long double), - __hypot_finite); -# else -extern long double __REDIRECT_NTH (hypotl, (long double, long double), - __hypotl_finite); -# endif -# endif +__MATH_REDIRCALL (hypot, , (_Mdouble_, _Mdouble_)); #endif -#if defined __USE_MISC || defined __USE_XOPEN +#if (__MATH_DECLARING_DOUBLE && (defined __USE_MISC || defined __USE_XOPEN)) \ + || (!__MATH_DECLARING_DOUBLE && defined __USE_MISC) /* j0. */ -extern double __REDIRECT_NTH (j0, (double), __j0_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (j0f, (float), __j0f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (j0l, (long double), __j0_finite); -# else -extern long double __REDIRECT_NTH (j0l, (long double), __j0l_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (j0, , (_Mdouble_)); -#if defined __USE_MISC || defined __USE_XOPEN /* y0. */ -extern double __REDIRECT_NTH (y0, (double), __y0_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (y0f, (float), __y0f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (y0l, (long double), __y0_finite); -# else -extern long double __REDIRECT_NTH (y0l, (long double), __y0l_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (y0, , (_Mdouble_)); -#if defined __USE_MISC || defined __USE_XOPEN /* j1. */ -extern double __REDIRECT_NTH (j1, (double), __j1_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (j1f, (float), __j1f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (j1l, (long double), __j1_finite); -# else -extern long double __REDIRECT_NTH (j1l, (long double), __j1l_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (j1, , (_Mdouble_)); -#if defined __USE_MISC || defined __USE_XOPEN /* y1. */ -extern double __REDIRECT_NTH (y1, (double), __y1_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (y1f, (float), __y1f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (y1l, (long double), __y1_finite); -# else -extern long double __REDIRECT_NTH (y1l, (long double), __y1l_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (y1, , (_Mdouble_)); -#if defined __USE_MISC || defined __USE_XOPEN /* jn. */ -extern double __REDIRECT_NTH (jn, (int, double), __jn_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (jnf, (int, float), __jnf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (jnl, (int, long double), __jn_finite); -# else -extern long double __REDIRECT_NTH (jnl, (int, long double), __jnl_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (jn, , (int, _Mdouble_)); -#if defined __USE_MISC || defined __USE_XOPEN /* yn. */ -extern double __REDIRECT_NTH (yn, (int, double), __yn_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (ynf, (int, float), __ynf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (ynl, (int, long double), __yn_finite); -# else -extern long double __REDIRECT_NTH (ynl, (int, long double), __ynl_finite); -# endif -# endif +__MATH_REDIRCALL (yn, , (int, _Mdouble_)); #endif #ifdef __USE_MISC /* lgamma_r. */ -extern double __REDIRECT_NTH (lgamma_r, (double, int *), __lgamma_r_finite); -# ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (lgammaf_r, (float, int *), __lgammaf_r_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (lgammal_r, (long double, int *), - __lgamma_r_finite); -# else -extern long double __REDIRECT_NTH (lgammal_r, (long double, int *), - __lgammal_r_finite); -# endif -# endif -# endif +__MATH_REDIRCALL (lgamma, _r, (_Mdouble_, int *)); #endif -extern double __lgamma_r_finite (double, int *); -extern float __lgammaf_r_finite (float, int *); -#ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (__lgammal_r_finite, (long double, int *), - __lgamma_r_finite); -#else -extern long double __lgammal_r_finite (long double, int *); -#endif +/* Redirect __lgammal_r_finite to __lgamma_r_finite when __NO_LONG_DOUBLE_MATH + is set and to itself otherwise. It also redirects __lgamma_r_finite and + __lgammaf_r_finite to themselves. */ +__MATH_REDIRCALL_INTERNAL (lgamma, _r, (_Mdouble_, int *)); #if ((defined __USE_XOPEN || defined __USE_ISOC99) \ && defined __extern_always_inline) /* lgamma. */ -__extern_always_inline double __NTH (lgamma (double __d)) +__extern_always_inline _Mdouble_ +__NTH (__REDIRFROM (lgamma, , _MSUF_) (_Mdouble_ __d)) { # if defined __USE_MISC || defined __USE_XOPEN - return __lgamma_r_finite (__d, &signgam); + return __REDIRTO (lgamma, _r, _MSUF_) (__d, &signgam); # else int __local_signgam = 0; - return __lgamma_r_finite (__d, &__local_signgam); + return __REDIRTO (lgamma, _r, _MSUF_) (__d, &__local_signgam); # endif } #endif -#if defined __USE_ISOC99 && defined __extern_always_inline -__extern_always_inline float __NTH (lgammaf (float __d)) -{ -# if defined __USE_MISC || defined __USE_XOPEN - return __lgammaf_r_finite (__d, &signgam); -# else - int __local_signgam = 0; - return __lgammaf_r_finite (__d, &__local_signgam); -# endif -} -# ifdef __MATH_DECLARE_LDOUBLE -__extern_always_inline long double __NTH (lgammal (long double __d)) -{ -# if defined __USE_MISC || defined __USE_XOPEN - return __lgammal_r_finite (__d, &signgam); -# else - int __local_signgam = 0; - return __lgammal_r_finite (__d, &__local_signgam); -# endif -} -# endif -#endif #if ((defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)) \ && defined __extern_always_inline) /* gamma. */ -__extern_always_inline double __NTH (gamma (double __d)) -{ - return __lgamma_r_finite (__d, &signgam); -} -# ifdef __USE_ISOC99 -__extern_always_inline float __NTH (gammaf (float __d)) -{ - return __lgammaf_r_finite (__d, &signgam); -} -# ifdef __MATH_DECLARE_LDOUBLE -__extern_always_inline long double __NTH (gammal (long double __d)) +__extern_always_inline _Mdouble_ +__NTH (__REDIRFROM (gamma, , _MSUF_) (_Mdouble_ __d)) { - return __lgammal_r_finite (__d, &signgam); + return __REDIRTO (lgamma, _r, _MSUF_) (__d, &signgam); } -# endif -# endif #endif /* log. */ -extern double __REDIRECT_NTH (log, (double), __log_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (logf, (float), __logf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (logl, (long double), __log_finite); -# else -extern long double __REDIRECT_NTH (logl, (long double), __logl_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (log, , (_Mdouble_)); /* log10. */ -extern double __REDIRECT_NTH (log10, (double), __log10_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (log10f, (float), __log10f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (log10l, (long double), __log10_finite); -# else -extern long double __REDIRECT_NTH (log10l, (long double), __log10l_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (log10, , (_Mdouble_)); #ifdef __USE_ISOC99 /* log2. */ -extern double __REDIRECT_NTH (log2, (double), __log2_finite); -extern float __REDIRECT_NTH (log2f, (float), __log2f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (log2l, (long double), __log2_finite); -# else -extern long double __REDIRECT_NTH (log2l, (long double), __log2l_finite); -# endif -# endif +__MATH_REDIRCALL (log2, , (_Mdouble_)); #endif /* pow. */ -extern double __REDIRECT_NTH (pow, (double, double), __pow_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (powf, (float, float), __powf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (powl, (long double, long double), - __pow_finite); -# else -extern long double __REDIRECT_NTH (powl, (long double, long double), - __powl_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (pow, , (_Mdouble_, _Mdouble_)); #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 /* remainder. */ -extern double __REDIRECT_NTH (remainder, (double, double), __remainder_finite); -#endif -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (remainderf, (float, float), __remainderf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (remainderl, (long double, long double), - __remainder_finite); -# else -extern long double __REDIRECT_NTH (remainderl, (long double, long double), - __remainderl_finite); -# endif -# endif +__MATH_REDIRCALL (remainder, , (_Mdouble_, _Mdouble_)); #endif -#if (defined __USE_MISC \ - || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8)) +#if (__MATH_DECLARING_DOUBLE \ + && (defined __USE_MISC \ + || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8))) \ + || (!__MATH_DECLARE_LDOUBLE && defined __USE_MISC) /* scalb. */ -extern double __REDIRECT_NTH (scalb, (double, double), __scalb_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (scalbf, (float, float), __scalbf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (scalbl, (long double, long double), - __scalb_finite); -# else -extern long double __REDIRECT_NTH (scalbl, (long double, long double), - __scalbl_finite); -# endif -# endif +__MATH_REDIRCALL (scalb, , (_Mdouble_, _Mdouble_)); #endif /* sinh. */ -extern double __REDIRECT_NTH (sinh, (double), __sinh_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (sinhf, (float), __sinhf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (sinhl, (long double), __sinh_finite); -# else -extern long double __REDIRECT_NTH (sinhl, (long double), __sinhl_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (sinh, , (_Mdouble_)); /* sqrt. */ -extern double __REDIRECT_NTH (sqrt, (double), __sqrt_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (sqrtf, (float), __sqrtf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrt_finite); -# else -extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrtl_finite); -# endif -# endif -#endif +__MATH_REDIRCALL (sqrt, , (_Mdouble_)); #if defined __USE_ISOC99 && defined __extern_always_inline /* tgamma. */ -extern double __gamma_r_finite (double, int *); -__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 __NTH (tgammaf (float __d)) -{ - int __local_signgam = 0; - float __res = __gammaf_r_finite (__d, &__local_signgam); - return __local_signgam < 0 ? -__res : __res; -} -# ifdef __MATH_DECLARE_LDOUBLE -extern long double __gammal_r_finite (long double, int *); -__extern_always_inline long double __NTH (tgammal (long double __d)) +extern _Mdouble_ +__REDIRFROM (__gamma, _r_finite, _MSUF_) (_Mdouble_, int *); + +__extern_always_inline _Mdouble_ +__NTH (__REDIRFROM (tgamma, , _MSUF_) (_Mdouble_ __d)) { int __local_signgam = 0; -# ifdef __NO_LONG_DOUBLE_MATH - long double __res = __gamma_r_finite (__d, &__local_signgam); -# else - long double __res = __gammal_r_finite (__d, &__local_signgam); -# endif + _Mdouble_ __res = __REDIRTO (gamma, _r, _MSUF_) (__d, &__local_signgam); return __local_signgam < 0 ? -__res : __res; } -# endif #endif + +#undef __REDIRFROM +#undef __REDIRFROM_X +#undef __REDIRTO +#undef __REDIRTO_X +#undef __MATH_REDIRCALL +#undef __MATH_REDIRCALL_2 +#undef __MATH_REDIRCALL_INTERNAL +#undef __MATH_REDIRCALL_X diff --git a/math/math.h b/math/math.h index c7895b735f..0c19d450ee 100644 --- a/math/math.h +++ b/math/math.h @@ -560,8 +560,48 @@ extern int matherr (struct exception *__exc); /* Define special entry points to use when the compiler got told to only expect finite results. */ #if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0 + +/* Include bits/math-finite.h for double. */ +# define _Mdouble_ double +# define __MATH_DECLARING_DOUBLE 1 +# define __MATH_DECLARING_LDOUBLE 0 +# define _MSUF_ # include <bits/math-finite.h> -#endif +# undef _Mdouble_ +# undef __MATH_DECLARING_DOUBLE +# undef __MATH_DECLARING_LDOUBLE +# undef _MSUF_ + +/* When __USE_ISOC99 is defined, include math-finite for float and + long double, as well. */ +# ifdef __USE_ISOC99 + +/* Include bits/math-finite.h for float. */ +# define _Mdouble_ float +# define __MATH_DECLARING_DOUBLE 0 +# define __MATH_DECLARING_LDOUBLE 0 +# define _MSUF_ f +# include <bits/math-finite.h> +# undef _Mdouble_ +# undef __MATH_DECLARING_DOUBLE +# undef __MATH_DECLARING_LDOUBLE +# undef _MSUF_ + +/* Include bits/math-finite.h for long double. */ +# if __MATH_DECLARE_LDOUBLE +# define _Mdouble_ long double +# define __MATH_DECLARING_DOUBLE 0 +# define __MATH_DECLARING_LDOUBLE 1 +# define _MSUF_ l +# include <bits/math-finite.h> +# undef _Mdouble_ +# undef __MATH_DECLARING_DOUBLE +# undef __MATH_DECLARING_LDOUBLE +# undef _MSUF_ +# endif + +# endif /* __USE_ISOC99. */ +#endif /* __FINITE_MATH_ONLY__ > 0. */ #ifdef __USE_ISOC99 /* If we've still got undefined comparison macros, provide defaults. */ |