Merge "Use __RENAME for long double functions." am: df862454b6

am: c4287cec82

Change-Id: I00b892d1245b2fadf44f82caa2968de888215261
This commit is contained in:
Elliott Hughes 2017-09-18 21:42:07 +00:00 committed by android-build-merger
commit 79dd9b7c0e
13 changed files with 756 additions and 663 deletions

View file

@ -26,6 +26,8 @@
* SUCH DAMAGE.
*/
#define __BIONIC_LP32_USE_LONG_DOUBLE
#include <float.h>
#include <stdlib.h>

View file

@ -26,6 +26,8 @@
* SUCH DAMAGE.
*/
#define __BIONIC_LP32_USE_LONG_DOUBLE
#include <wchar.h>
#include <stdlib.h>

View file

@ -61,99 +61,99 @@ __BEGIN_DECLS
/* 7.3.5.1 The cacos functions */
double complex cacos(double complex __z) __INTRODUCED_IN(23);
float complex cacosf(float complex __z) __INTRODUCED_IN(23);
long double complex cacosl(long double complex __z) __INTRODUCED_IN(26);
long double complex cacosl(long double complex __z) __RENAME_LDBL(cacos, 23, 26);
/* 7.3.5.2 The casin functions */
double complex casin(double complex __z) __INTRODUCED_IN(23);
float complex casinf(float complex __z) __INTRODUCED_IN(23);
long double complex casinl(long double complex __z) __INTRODUCED_IN(26);
long double complex casinl(long double complex __z) __RENAME_LDBL(casin, 23, 26);
/* 7.3.5.1 The catan functions */
double complex catan(double complex __z) __INTRODUCED_IN(23);
float complex catanf(float complex __z) __INTRODUCED_IN(23);
long double complex catanl(long double complex __z) __INTRODUCED_IN(26);
long double complex catanl(long double complex __z) __RENAME_LDBL(catan, 23, 26);
/* 7.3.5.1 The ccos functions */
double complex ccos(double complex __z) __INTRODUCED_IN(23);
float complex ccosf(float complex __z) __INTRODUCED_IN(23);
long double complex ccosl(long double complex __z) __INTRODUCED_IN(26);
long double complex ccosl(long double complex __z) __RENAME_LDBL(ccos, 23, 26);
/* 7.3.5.1 The csin functions */
double complex csin(double complex __z) __INTRODUCED_IN(23);
float complex csinf(float complex __z) __INTRODUCED_IN(23);
long double complex csinl(long double complex __z) __INTRODUCED_IN(26);
long double complex csinl(long double complex __z) __RENAME_LDBL(csin, 23, 26);
/* 7.3.5.1 The ctan functions */
double complex ctan(double complex __z) __INTRODUCED_IN(23);
float complex ctanf(float complex __z) __INTRODUCED_IN(23);
long double complex ctanl(long double complex __z) __INTRODUCED_IN(26);
long double complex ctanl(long double complex __z) __RENAME_LDBL(ctan, 23, 26);
/* 7.3.6 Hyperbolic functions */
/* 7.3.6.1 The cacosh functions */
double complex cacosh(double complex __z) __INTRODUCED_IN(23);
float complex cacoshf(float complex __z) __INTRODUCED_IN(23);
long double complex cacoshl(long double complex __z) __INTRODUCED_IN(26);
long double complex cacoshl(long double complex __z) __RENAME_LDBL(cacosh, 23, 26);
/* 7.3.6.2 The casinh functions */
double complex casinh(double complex __z) __INTRODUCED_IN(23);
float complex casinhf(float complex __z) __INTRODUCED_IN(23);
long double complex casinhl(long double complex __z) __INTRODUCED_IN(26);
long double complex casinhl(long double complex __z) __RENAME_LDBL(casinh, 23, 26);
/* 7.3.6.3 The catanh functions */
double complex catanh(double complex __z) __INTRODUCED_IN(23);
float complex catanhf(float complex __z) __INTRODUCED_IN(23);
long double complex catanhl(long double complex __z) __INTRODUCED_IN(26);
long double complex catanhl(long double complex __z) __RENAME_LDBL(catanh, 23, 26);
/* 7.3.6.4 The ccosh functions */
double complex ccosh(double complex __z) __INTRODUCED_IN(23);
float complex ccoshf(float complex __z) __INTRODUCED_IN(23);
long double complex ccoshl(long double complex __z) __INTRODUCED_IN(26);
long double complex ccoshl(long double complex __z) __RENAME_LDBL(ccosh, 23, 26);
/* 7.3.6.5 The csinh functions */
double complex csinh(double complex __z) __INTRODUCED_IN(23);
float complex csinhf(float complex __z) __INTRODUCED_IN(23);
long double complex csinhl(long double complex __z) __INTRODUCED_IN(26);
long double complex csinhl(long double complex __z) __RENAME_LDBL(csinh, 23, 26);
/* 7.3.6.6 The ctanh functions */
double complex ctanh(double complex __z) __INTRODUCED_IN(23);
float complex ctanhf(float complex __z) __INTRODUCED_IN(23);
long double complex ctanhl(long double complex __z) __INTRODUCED_IN(26);
long double complex ctanhl(long double complex __z) __RENAME_LDBL(ctanh, 23, 26);
/* 7.3.7 Exponential and logarithmic functions */
/* 7.3.7.1 The cexp functions */
double complex cexp(double complex __z) __INTRODUCED_IN(23);
float complex cexpf(float complex __z) __INTRODUCED_IN(23);
long double complex cexpl(long double complex __z) __INTRODUCED_IN(26);
long double complex cexpl(long double complex __z) __RENAME_LDBL(cexp, 23, 26);
/* 7.3.7.2 The clog functions */
double complex clog(double complex __z) __INTRODUCED_IN(26);
float complex clogf(float complex __z) __INTRODUCED_IN(26);
long double complex clogl(long double complex __z) __INTRODUCED_IN(26);
long double complex clogl(long double complex __z) __RENAME_LDBL(clog, 26, 26);
/* 7.3.8 Power and absolute-value functions */
/* 7.3.8.1 The cabs functions */
double cabs(double complex __z) __INTRODUCED_IN(23);
float cabsf(float complex __z) __INTRODUCED_IN(23);
long double cabsl(long double complex __z) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23);
long double cabsl(long double complex __z) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23) /*__RENAME_LDBL(cabs)*/;
/* 7.3.8.2 The cpow functions */
double complex cpow(double complex __x, double complex __z) __INTRODUCED_IN(26);
float complex cpowf(float complex __x, float complex __z) __INTRODUCED_IN(26);
long double complex cpowl(long double complex __x, long double complex __z) __INTRODUCED_IN(26);
long double complex cpowl(long double complex __x, long double complex __z) __RENAME_LDBL(cpow, 26, 26);
/* 7.3.8.3 The csqrt functions */
double complex csqrt(double complex __z) __INTRODUCED_IN(23);
float complex csqrtf(float complex __z) __INTRODUCED_IN(23);
long double complex csqrtl(long double complex __z) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23);
long double complex csqrtl(long double complex __z) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23) /*__RENAME_LDBL(csqrt)*/;
/* 7.3.9 Manipulation functions */
/* 7.3.9.1 The carg functions */
double carg(double complex __z) __INTRODUCED_IN(23);
float cargf(float complex __z) __INTRODUCED_IN(23);
long double cargl(long double complex __z) __INTRODUCED_IN(23);
long double cargl(long double complex __z) __RENAME_LDBL(carg, 23, 23);
/* 7.3.9.2 The cimag functions */
double cimag(double complex __z) __INTRODUCED_IN(23);
float cimagf(float complex __z) __INTRODUCED_IN(23);
long double cimagl(long double complex __z) __INTRODUCED_IN(23);
long double cimagl(long double complex __z) __RENAME_LDBL(cimag, 23, 23);
/* 7.3.9.3 The conj functions */
double complex conj(double complex __z) __INTRODUCED_IN(23);
float complex conjf(float complex __z) __INTRODUCED_IN(23);
long double complex conjl(long double complex __z) __INTRODUCED_IN(23);
long double complex conjl(long double complex __z) __RENAME_LDBL(conj, 23, 23);
/* 7.3.9.4 The cproj functions */
double complex cproj(double complex __z) __INTRODUCED_IN(23);
float complex cprojf(float complex __z) __INTRODUCED_IN(23);
long double complex cprojl(long double complex __z) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23);
long double complex cprojl(long double complex __z) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23) /*__RENAME_LDBL(cproj)*/;
/* 7.3.9.5 The creal functions */
double creal(double complex __z) __INTRODUCED_IN(23);
float crealf(float complex __z) __INTRODUCED_IN(23);
long double creall(long double complex __z) __INTRODUCED_IN(23);
long double creall(long double complex __z) __RENAME_LDBL(creal, 23, 23);
__END_DECLS

View file

@ -22,19 +22,26 @@
__BEGIN_DECLS
#define HUGE_VAL __builtin_huge_val()
/* C11. */
#define FP_ILOGB0 (-INT_MAX)
#define FP_ILOGBNAN INT_MAX
typedef double __double_t;
typedef __double_t double_t;
typedef float __float_t;
typedef __float_t float_t;
#define HUGE_VALF __builtin_huge_valf()
#define HUGE_VALL __builtin_huge_vall()
#define INFINITY __builtin_inff()
#define NAN __builtin_nanf("")
#define HUGE_VAL __builtin_huge_val()
#define HUGE_VALF __builtin_huge_valf()
#define HUGE_VALL __builtin_huge_vall()
#define MATH_ERRNO 1
#define MATH_ERREXCEPT 2
#define math_errhandling MATH_ERREXCEPT
#define INFINITY __builtin_inff()
#define NAN __builtin_nanf("")
#define FP_INFINITE 0x01
#define FP_NAN 0x02
#define FP_NORMAL 0x04
#define FP_SUBNORMAL 0x08
#define FP_ZERO 0x10
#if defined(__FP_FAST_FMA)
#define FP_FAST_FMA 1
@ -46,20 +53,257 @@ __BEGIN_DECLS
#define FP_FAST_FMAL 1
#endif
/* Symbolic constants to classify floating point numbers. */
#define FP_INFINITE 0x01
#define FP_NAN 0x02
#define FP_NORMAL 0x04
#define FP_SUBNORMAL 0x08
#define FP_ZERO 0x10
#define fpclassify(x) \
__builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x)
#define FP_ILOGB0 (-INT_MAX)
#define FP_ILOGBNAN INT_MAX
#define MATH_ERRNO 1
#define MATH_ERREXCEPT 2
#define math_errhandling MATH_ERREXCEPT
#define fpclassify(x) __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x)
#define isfinite(x) __builtin_isfinite(x)
#define isinf(x) __builtin_isinf(x)
#define isnan(x) __builtin_isnan(x)
#define isnormal(x) __builtin_isnormal(x)
#define signbit(x) \
((sizeof(x) == sizeof(float)) ? __builtin_signbitf(x) \
: (sizeof(x) == sizeof(double)) ? __builtin_signbit(x) \
: __builtin_signbitl(x))
double acos(double __x);
float acosf(float __x);
long double acosl(long double __x) __RENAME_LDBL(acos, 3, 21);
double asin(double __x);
float asinf(float __x);
long double asinl(long double __x) __RENAME_LDBL(asin, 3, 21);
double atan(double __x);
float atanf(float __x);
long double atanl(long double __x) __RENAME_LDBL(atan, 3, 21);
double atan2(double __y, double __x);
float atan2f(float __y, float __x);
long double atan2l(long double __y, long double __x) __RENAME_LDBL(atan2, 3, 21);
double cos(double __x);
float cosf(float __x);
long double cosl(long double __x) __RENAME_LDBL(cos, 3, 21);
double sin(double __x);
float sinf(float __x);
long double sinl(long double __x) __RENAME_LDBL(sin, 3, 21);
double tan(double __x);
float tanf(float __x);
long double tanl(long double __x) __RENAME_LDBL(tan, 3, 21);
double acosh(double __x);
float acoshf(float __x);
long double acoshl(long double __x) __RENAME_LDBL(acosh, 3, 21);
double asinh(double __x);
float asinhf(float __x);
long double asinhl(long double __x) __RENAME_LDBL(asinh, 3, 21);
double atanh(double __x);
float atanhf(float __x);
long double atanhl(long double __x) __RENAME_LDBL(atanh, 3, 21);
double cosh(double __x);
float coshf(float __x);
long double coshl(long double __x) __RENAME_LDBL(cosh, 3, 21);
double sinh(double __x);
float sinhf(float __x);
long double sinhl(long double __x) __RENAME_LDBL(sinh, 3, 21);
double tanh(double __x);
float tanhf(float __x);
long double tanhl(long double __x) __RENAME_LDBL(tanh, 3, 21);
double exp(double __x);
float expf(float __x);
long double expl(long double __x) __RENAME_LDBL(exp, 3, 21);
double exp2(double __x);
float exp2f(float __x);
long double exp2l(long double __x) __RENAME_LDBL(exp2, 3, 21);
double expm1(double __x);
float expm1f(float __x);
long double expm1l(long double __x) __RENAME_LDBL(expm1, 3, 21);
double frexp(double __x, int* __exponent);
float frexpf(float __x, int* __exponent);
long double frexpl(long double __x, int* __exponent) __RENAME_LDBL(frexp, 3, 21);
int ilogb(double __x) __attribute_const__;
int ilogbf(float __x) __attribute_const__;
int ilogbl(long double __x) __attribute_const__ __RENAME_LDBL(ilogb, 3, 3);
double ldexp(double __x, int __exponent);
float ldexpf(float __x, int __exponent);
long double ldexpl(long double __x, int __exponent) __RENAME_LDBL(ldexp, 3, 3);
double log(double __x);
float logf(float __x);
long double logl(long double __x) __RENAME_LDBL(log, 3, 21);
double log10(double __x);
float log10f(float __x);
long double log10l(long double __x) __RENAME_LDBL(log10, 3, 21);
double log1p(double __x);
float log1pf(float __x);
long double log1pl(long double __x) __RENAME_LDBL(log1p, 3, 21);
double log2(double __x) __INTRODUCED_IN(18);
float log2f(float __x) __INTRODUCED_IN(18);
long double log2l(long double __x) __RENAME_LDBL(log2, 18, 18);
double logb(double __x);
float logbf(float __x);
long double logbl(long double __x) __RENAME_LDBL(logb, 3, 18);
double modf(double __x, double* __integral_part);
float modff(float __x, float* __integral_part);
long double modfl(long double __x, long double* __integral_part) __RENAME_LDBL(modf, 3, 21);
double scalbn(double __x, int __exponent);
float scalbnf(float __x, int __exponent);
long double scalbnl(long double __x, int __exponent) __RENAME_LDBL(scalbn, 3, 3);
/* TODO: once the NDK only supports >= 18, use __RENAME_LDBL here too. */
double scalbln(double __x, long __exponent) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
float scalblnf(float __x, long __exponent) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
long double scalblnl(long double __x, long __exponent) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
double cbrt(double __x);
float cbrtf(float __x);
long double cbrtl(long double __x) __RENAME_LDBL(cbrt, 3, 21);
double fabs(double __x) __attribute_const__;
float fabsf(float __x) __attribute_const__;
long double fabsl(long double __x) __attribute_const__ __RENAME_LDBL(fabs, 3, 3);
double hypot(double __x, double __y);
float hypotf(float __x, float __y);
long double hypotl(long double __x, long double __y) __RENAME_LDBL(hypot, 3, 21);
double pow(double __x, double __y);
float powf(float __x, float __y);
long double powl(long double __x, long double __y) __RENAME_LDBL(pow, 3, 21);
double sqrt(double __x);
float sqrtf(float __x);
long double sqrtl(long double __x) __RENAME_LDBL(sqrt, 3, 21);
double erf(double __x);
float erff(float __x);
long double erfl(long double __x) __RENAME_LDBL(erf, 3, 21);
double erfc(double __x);
float erfcf(float __x);
long double erfcl(long double __x) __RENAME_LDBL(erfc, 3, 21);
double lgamma(double __x);
float lgammaf(float __x);
long double lgammal(long double __x) __RENAME_LDBL(lgamma, 3, 21);
double tgamma(double __x);
float tgammaf(float __x) __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
long double tgammal(long double __x) __RENAME_LDBL(tgamma, 3, 21);
double ceil(double __x);
float ceilf(float __x);
long double ceill(long double __x) __RENAME_LDBL(ceil, 3, 3);
double floor(double __x);
float floorf(float __x);
long double floorl(long double __x) __RENAME_LDBL(floor, 3, 3);
double nearbyint(double __x);
float nearbyintf(float __x);
long double nearbyintl(long double __x) __RENAME_LDBL(nearbyint, 3, 21);
double rint(double __x);
float rintf(float __x);
long double rintl(long double __x) __RENAME_LDBL(rint, 3, 21);
long lrint(double __x);
long lrintf(float __x);
long lrintl(long double __x) __RENAME_LDBL(lrint, 3, 21);
long long llrint(double __x);
long long llrintf(float __x);
long long llrintl(long double __x) __RENAME_LDBL(llrint, 3, 21);
double round(double __x);
float roundf(float __x);
long double roundl(long double __x) __RENAME_LDBL(roundl, 3, 3);
long lround(double __x);
long lroundf(float __x);
long lroundl(long double __x) __RENAME_LDBL(lround, 3, 3);
long long llround(double __x);
long long llroundf(float __x);
long long llroundl(long double __x) __RENAME_LDBL(llround, 3, 3);
double trunc(double __x);
float truncf(float __x);
long double truncl(long double __x) __RENAME_LDBL(trunc, 3, 3);
double fmod(double __x, double __y);
float fmodf(float __x, float __y);
long double fmodl(long double __x, long double __y) __RENAME_LDBL(fmod, 3, 21);
double remainder(double __x, double __y);
float remainderf(float __x, float __y);
long double remainderl(long double __x, long double __y) __RENAME_LDBL(remainder, 3, 21);
double remquo(double __x, double __y, int* __quotient_bits);
float remquof(float __x, float __y, int* __quotient_bits);
long double remquol(long double __x, long double __y, int* __quotient_bits) __RENAME_LDBL(remquo, 3, 21);
double copysign(double __value, double __sign) __attribute_const__;
float copysignf(float __value, float __sign) __attribute_const__;
long double copysignl(long double __value, long double __sign) __attribute_const__ __RENAME_LDBL(copysign, 3, 3);
double nan(const char* __kind) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
float nanf(const char* __kind) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
long double nanl(const char* __kind) __attribute_const__ __RENAME_LDBL(nan, 13, 13);
double nextafter(double __x, double __y);
float nextafterf(float __x, float __y);
long double nextafterl(long double __x, long double __y) __RENAME_LDBL(nextafter, 3, 21) __VERSIONER_NO_GUARD;
double nexttoward(double __x, long double __y) __INTRODUCED_IN(18) __VERSIONER_NO_GUARD;
float nexttowardf(float __x, long double __y);
long double nexttowardl(long double __x, long double __y) __RENAME_LDBL(nexttoward, 18, 18) __VERSIONER_NO_GUARD;
double fdim(double __x, double __y);
float fdimf(float __x, float __y);
long double fdiml(long double __x, long double __y) __RENAME_LDBL(fdim, 3, 3);
double fmax(double __x, double __y) __attribute_const__;
float fmaxf(float __x, float __y) __attribute_const__;
long double fmaxl(long double __x, long double __y) __attribute_const__ __RENAME_LDBL(fmax, 3, 3);
double fmin(double __x, double __y) __attribute_const__;
float fminf(float __x, float __y) __attribute_const__;
long double fminl(long double __x, long double __y) __attribute_const__ __RENAME_LDBL(fmin, 3, 3);
double fma(double __x, double __y, double __z);
float fmaf(float __x, float __y, float __z);
long double fmal(long double __x, long double __y, long double __z) __RENAME_LDBL(fma, 3, 21) __VERSIONER_NO_GUARD;
#define isgreater(x, y) __builtin_isgreater((x), (y))
#define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y))
#define isless(x, y) __builtin_isless((x), (y))
@ -67,92 +311,6 @@ __BEGIN_DECLS
#define islessgreater(x, y) __builtin_islessgreater((x), (y))
#define isunordered(x, y) __builtin_isunordered((x), (y))
#define signbit(x) \
((sizeof(x) == sizeof(float)) ? __builtin_signbitf(x) \
: (sizeof(x) == sizeof(double)) ? __builtin_signbit(x) \
: __builtin_signbitl(x))
typedef double __double_t;
typedef __double_t double_t;
typedef float __float_t;
typedef __float_t float_t;
#if defined(__USE_BSD)
#define HUGE MAXFLOAT
#endif
extern int signgam;
/*
* Most of these functions depend on the rounding mode and have the side
* effect of raising floating-point exceptions, so they are not declared
* as __attribute_const__. In C99, FENV_ACCESS affects the purity of these functions.
*/
int __fpclassifyd(double __x) __attribute_const__;
int __fpclassifyf(float __x) __attribute_const__;
int __fpclassifyl(long double __x) __attribute_const__;
int __isfinitef(float __x) __attribute_const__;
int __isfinite(double __x) __attribute_const__;
int __isfinitel(long double __x) __attribute_const__;
int __isinff(float __x) __attribute_const__;
int __isinfl(long double __x) __attribute_const__;
int __isnanf(float __x) __attribute_const__ __INTRODUCED_IN(21);
int __isnanl(long double __x) __attribute_const__;
int __isnormalf(float __x) __attribute_const__;
int __isnormal(double __x) __attribute_const__;
int __isnormall(long double __x) __attribute_const__;
int __signbit(double __x) __attribute_const__;
int __signbitf(float __x) __attribute_const__;
int __signbitl(long double __x) __attribute_const__;
double acos(double __x);
double asin(double __x);
double atan(double __x);
double atan2(double __y, double __x);
double cos(double __x);
double sin(double __x);
double tan(double __x);
double cosh(double __x);
double sinh(double __x);
double tanh(double __x);
double exp(double __x);
double frexp(double __x, int* __exponent); /* fundamentally !__attribute_const__ */
double ldexp(double __x, int __exponent);
double log(double __x);
double log10(double __x);
double modf(double __x, double* __integral_part); /* fundamentally !__attribute_const__ */
double pow(double __x, double __y);
double sqrt(double __x);
double ceil(double __x);
double fabs(double __x) __attribute_const__;
double floor(double __x);
double fmod(double __x, double __y);
double acosh(double __x);
double asinh(double __x);
double atanh(double __x);
double cbrt(double __x);
double erf(double __x);
double erfc(double __x);
double exp2(double __x);
double expm1(double __x);
double fma(double __x, double __y, double __z);
double hypot(double __x, double __y);
int ilogb(double __x) __attribute_const__;
double lgamma(double __x);
long long llrint(double __x);
long long llround(double __x);
double log1p(double __x);
double log2(double __x) __INTRODUCED_IN(18);
double logb(double __x);
long lrint(double __x);
long lround(double __x);
/*
* https://code.google.com/p/android/issues/detail?id=271629
* To be fully compliant with C++, we need to not define these (C doesn't
@ -167,150 +325,9 @@ long lround(double __x);
int (isinf)(double __x) __attribute_const__ __INTRODUCED_IN(21);
int (isnan)(double __x) __attribute_const__;
double nan(const char* __kind) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13)
__INTRODUCED_IN_X86(9);
/* POSIX extensions. */
double nextafter(double __x, double __y);
double remainder(double __x, double __y);
double remquo(double __x, double __y, int* __quotient_bits);
double rint(double __x);
double copysign(double __value, double __sign) __attribute_const__;
double fdim(double __x, double __y);
double fmax(double __x, double __y) __attribute_const__;
double fmin(double __x, double __y) __attribute_const__;
double nearbyint(double __x);
double round(double __x);
double scalbln(double __x, long __exponent) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
double scalbn(double __x, int __exponent);
double tgamma(double __x);
double trunc(double __x);
float acosf(float __x);
float asinf(float __x);
float atanf(float __x);
float atan2f(float __y, float __x);
float cosf(float __x);
float sinf(float __x);
float tanf(float __x);
float coshf(float __x);
float sinhf(float __x);
float tanhf(float __x);
float exp2f(float __x);
float expf(float __x);
float expm1f(float __x);
float frexpf(float __x, int* __exponent); /* fundamentally !__attribute_const__ */
int ilogbf(float __x) __attribute_const__;
float ldexpf(float __x, int __exponent);
float log10f(float __x);
float log1pf(float __x);
float log2f(float __x) __INTRODUCED_IN(18);
float logf(float __x);
float modff(float __x, float* __integral_part); /* fundamentally !__attribute_const__ */
float powf(float __x, float __y);
float sqrtf(float __x);
float ceilf(float __x);
float fabsf(float __x) __attribute_const__;
float floorf(float __x);
float fmodf(float __x, float __y);
float roundf(float __x);
float erff(float __x);
float erfcf(float __x);
float hypotf(float __x, float __y);
float lgammaf(float __x);
float tgammaf(float __x) __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
float acoshf(float __x);
float asinhf(float __x);
float atanhf(float __x);
float cbrtf(float __x);
float logbf(float __x);
float copysignf(float __value, float __sign) __attribute_const__;
long long llrintf(float __x);
long long llroundf(float __x);
long lrintf(float __x);
long lroundf(float __x);
float nanf(const char* __kind) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13)
__INTRODUCED_IN_X86(9);
float nearbyintf(float __x);
float nextafterf(float __x, float __y);
float remainderf(float __x, float __y);
float remquof(float __x, float __y, int* __quotient_bits);
float rintf(float __x);
float scalblnf(float __x, long __exponent) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
float scalbnf(float __x, int __exponent);
float truncf(float __x);
float fdimf(float __x, float __y);
float fmaf(float __x, float __y, float __z);
float fmaxf(float __x, float __y) __attribute_const__;
float fminf(float __x, float __y) __attribute_const__;
long double acoshl(long double __x) __INTRODUCED_IN(21);
long double acosl(long double __x) __INTRODUCED_IN(21);
long double asinhl(long double __x) __INTRODUCED_IN(21);
long double asinl(long double __x) __INTRODUCED_IN(21);
long double atan2l(long double __y, long double __x) __INTRODUCED_IN(21);
long double atanhl(long double __x) __INTRODUCED_IN(21);
long double atanl(long double __x) __INTRODUCED_IN(21);
long double cbrtl(long double __x) __INTRODUCED_IN(21);
long double ceill(long double __x);
long double copysignl(long double __value, long double __sign) __attribute_const__;
long double coshl(long double __x) __INTRODUCED_IN(21);
long double cosl(long double __x) __INTRODUCED_IN(21);
long double erfcl(long double __x) __INTRODUCED_IN(21);
long double erfl(long double __x) __INTRODUCED_IN(21);
long double exp2l(long double __x) __INTRODUCED_IN(21);
long double expl(long double __x) __INTRODUCED_IN(21);
long double expm1l(long double __x) __INTRODUCED_IN(21);
long double fabsl(long double __x) __attribute_const__;
long double fdiml(long double __x, long double __y);
long double floorl(long double __x);
long double fmal(long double __x, long double __y, long double __z) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
long double fmaxl(long double __x, long double __y) __attribute_const__;
long double fminl(long double __x, long double __y) __attribute_const__;
long double fmodl(long double __x, long double __y) __INTRODUCED_IN(21);
long double frexpl(long double __x, int* __exponent)
__INTRODUCED_IN(21) __VERSIONER_NO_GUARD; /* fundamentally !__attribute_const__ */
long double hypotl(long double __x, long double __y) __INTRODUCED_IN(21);
int ilogbl(long double __x) __attribute_const__;
long double ldexpl(long double __x, int __exponent);
long double lgammal(long double __x) __INTRODUCED_IN(21);
long long llrintl(long double __x) __INTRODUCED_IN(21);
long long llroundl(long double __x);
long double log10l(long double __x) __INTRODUCED_IN(21);
long double log1pl(long double __x) __INTRODUCED_IN(21);
long double log2l(long double __x) __INTRODUCED_IN(18);
long double logbl(long double __x) __INTRODUCED_IN(18);
long double logl(long double __x) __INTRODUCED_IN(21);
long lrintl(long double __x) __INTRODUCED_IN(21);
long lroundl(long double __x);
long double modfl(long double __x, long double* __integral_part) __INTRODUCED_IN(21); /* fundamentally !__attribute_const__ */
long double nanl(const char* __kind) __attribute_const__ __INTRODUCED_IN(13);
long double nearbyintl(long double __x) __INTRODUCED_IN(21);
long double nextafterl(long double __x, long double __y) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
double nexttoward(double __x, long double __y) __INTRODUCED_IN(18) __VERSIONER_NO_GUARD;
float nexttowardf(float __x, long double __y);
long double nexttowardl(long double __x, long double __y) __INTRODUCED_IN(18) __VERSIONER_NO_GUARD;
long double powl(long double __x, long double __y) __INTRODUCED_IN(21);
long double remainderl(long double __x, long double __y) __INTRODUCED_IN(21);
long double remquol(long double __x, long double __y, int* __quotient_bits) __INTRODUCED_IN(21);
long double rintl(long double __x) __INTRODUCED_IN(21);
long double roundl(long double __x);
long double scalblnl(long double __x, long __exponent) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
long double scalbnl(long double __x, int __exponent);
long double sinhl(long double __x) __INTRODUCED_IN(21);
long double sinl(long double __x) __INTRODUCED_IN(21);
long double sqrtl(long double __x) __INTRODUCED_IN(21);
long double tanhl(long double __x) __INTRODUCED_IN(21);
long double tanl(long double __x) __INTRODUCED_IN(21);
long double tgammal(long double __x) __INTRODUCED_IN(21);
long double truncl(long double __x);
extern int signgam;
double j0(double __x);
double j1(double __x);
@ -335,6 +352,38 @@ double yn(int __n, double __x);
#define MAXFLOAT ((float)3.40282346638528860e+38)
/* Legacy cruft from before we had builtin implementations of the standard macros. */
int __fpclassifyd(double __x) __attribute_const__;
int __fpclassifyf(float __x) __attribute_const__;
int __fpclassifyl(long double __x) __attribute_const__;
int __isfinitef(float __x) __attribute_const__;
int __isfinite(double __x) __attribute_const__;
int __isfinitel(long double __x) __attribute_const__;
int __isinff(float __x) __attribute_const__;
int __isinfl(long double __x) __attribute_const__;
int __isnanf(float __x) __attribute_const__ __INTRODUCED_IN(21);
int __isnanl(long double __x) __attribute_const__;
int __isnormal(double __x) __attribute_const__;
int __isnormalf(float __x) __attribute_const__;
int __isnormall(long double __x) __attribute_const__;
int __signbit(double __x) __attribute_const__;
int __signbitf(float __x) __attribute_const__;
int __signbitl(long double __x) __attribute_const__;
/* BSD extensions. */
#if defined(__USE_BSD)
#define HUGE MAXFLOAT
#endif
/* Extensions in both BSD and GNU. */
#if defined(__USE_BSD) || defined(__USE_GNU)
double gamma(double __x);
double scalb(double __x, double __exponent);
@ -361,6 +410,8 @@ float lgammaf_r(float __x, int* __sign);
float significandf(float __x);
#endif
/* GNU extensions. */
#if defined(__USE_GNU)
#define M_El 2.718281828459045235360287471352662498L /* e */
#define M_LOG2El 1.442695040888963407359924681001892137L /* log 2e */

View file

@ -75,7 +75,7 @@ unsigned long long strtoull(const char* __s, char** __end_ptr, int __base);
int posix_memalign(void** __memptr, size_t __alignment, size_t __size) __INTRODUCED_IN(16);
double strtod(const char* __s, char** __end_ptr);
long double strtold(const char* __s, char** __end_ptr) __INTRODUCED_IN(21);
long double strtold(const char* __s, char** __end_ptr) __RENAME_LDBL(strtod, 3, 21);
unsigned long strtoul_l(const char* __s, char** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(26);

View file

@ -37,6 +37,11 @@
#ifndef _SYS_CDEFS_H_
#define _SYS_CDEFS_H_
#include <android/api-level.h>
#include <android/versioning.h>
#define __BIONIC__ 1
/*
* Testing against Clang-specific extensions.
*/
@ -219,8 +224,21 @@
#define __RENAME_IF_FILE_OFFSET64(func)
#endif
#define __BIONIC__ 1
#include <android/api-level.h>
/*
* For LP32, `long double` == `double`. Historically many `long double` functions were incorrect
* on x86, missing on most architectures, and even if they are present and correct, linking to
* them just bloats your ELF file by adding extra relocations. The __BIONIC_LP32_USE_LONG_DOUBLE
* macro lets us test the headers both ways (and adds an escape valve).
*
* Note that some functions have their __RENAME_LDBL commented out as a sign that although we could
* use __RENAME_LDBL it would actually cause the function to be introduced later because the
* `long double` variant appeared before the `double` variant.
*/
#if defined(__LP64__) || defined(__BIONIC_LP32_USE_LONG_DOUBLE)
#define __RENAME_LDBL(rewrite,rewrite_api_level,regular_api_level) __INTRODUCED_IN(regular_api_level)
#else
#define __RENAME_LDBL(rewrite,rewrite_api_level,regular_api_level) __RENAME(rewrite) __INTRODUCED_IN(rewrite_api_level)
#endif
/* glibc compatibility. */
#if defined(__LP64__)
@ -334,8 +352,6 @@
/* Used to rename functions so that the compiler emits a call to 'x' rather than the function this was applied to. */
#define __RENAME(x) __asm__(#x)
#include <android/versioning.h>
#if __has_builtin(__builtin_umul_overflow) || __GNUC__ >= 5
#if defined(__LP64__)
#define __size_mul_overflow(a, b, result) __builtin_umull_overflow(a, b, result)

View file

@ -98,7 +98,7 @@ float wcstof(const wchar_t* __s, wchar_t** __end_ptr) __INTRODUCED_IN(21);
wchar_t* wcstok(wchar_t* __s, const wchar_t* __delimiter, wchar_t** __ptr);
long wcstol(const wchar_t* __s, wchar_t** __end_ptr, int __base);
long long wcstoll(const wchar_t* __s, wchar_t** __end_ptr, int __base) __INTRODUCED_IN(21);
long double wcstold(const wchar_t* __s, wchar_t** __end_ptr) __INTRODUCED_IN(21);
long double wcstold(const wchar_t* __s, wchar_t** __end_ptr) __RENAME_LDBL(wcstod, 3, 21);
unsigned long wcstoul(const wchar_t* __s, wchar_t** __end_ptr, int __base);
unsigned long long wcstoull(const wchar_t* __s, wchar_t** __end_ptr, int __base) __INTRODUCED_IN(21);
int wcswidth(const wchar_t* __s, size_t __n);

View file

@ -506,6 +506,7 @@ cc_library {
],
cflags: [
"-D__BIONIC_LP32_USE_LONG_DOUBLE",
"-D__BIONIC_NO_MATH_INLINES",
"-D_BSD_SOURCE",
"-DFLT_EVAL_METHOD=0",

View file

@ -57,6 +57,7 @@ cc_test_library {
"buffer_tests.cpp",
"bug_26110743_test.cpp",
"complex_test.cpp",
"complex_force_long_double_test.cpp",
"ctype_test.cpp",
"dirent_test.cpp",
"elf_test.cpp",
@ -84,6 +85,7 @@ cc_test_library {
"locale_test.cpp",
"malloc_test.cpp",
"math_test.cpp",
"math_force_long_double_test.cpp",
"mntent_test.cpp",
"netdb_test.cpp",
"net_if_test.cpp",

View file

@ -0,0 +1,2 @@
#define __BIONIC_LP32_USE_LONG_DOUBLE
#include "complex_test.cpp"

View file

@ -16,6 +16,12 @@
#include <gtest/gtest.h>
#if defined(__BIONIC_LP32_USE_LONG_DOUBLE)
#define COMPLEX_TEST complex_h_force_long_double
#else
#define COMPLEX_TEST complex_h
#endif
// This file is compiled against both glibc and bionic, and our complex.h
// depends on bionic-specific macros, so hack around that.
#include <sys/cdefs.h>
@ -24,6 +30,7 @@
#define __INTRODUCED_IN_32(x)
#define __INTRODUCED_IN_64(x)
#define __INTRODUCED_IN_FUTURE
#define __RENAME_LDBL(a,b,c)
#endif
// libc++ actively gets in the way of including <complex.h> from C++, so we
@ -36,6 +43,7 @@
#include <math.h> // For M_PI_2/M_PI_2l.
#if 0
// Note that gtest doesn't support complex numbers, so the output from
// assertion failures is misleading/useless (at best you'll only see the real
// part).
@ -54,267 +62,268 @@ std::ostream& operator<<(std::ostream& os, const long double _Complex c) {
os << "(" << creall(c) << "," << cimagl(c) << "i)";
return os;
}
#endif
TEST(complex, cabs) {
TEST(COMPLEX_TEST, cabs) {
ASSERT_EQ(0.0, cabs(0));
}
TEST(complex, cabsf) {
TEST(COMPLEX_TEST, cabsf) {
ASSERT_EQ(0.0, cabsf(0));
}
TEST(complex, cabsl) {
TEST(COMPLEX_TEST, cabsl) {
ASSERT_EQ(0.0, cabsl(0));
}
TEST(complex, cacos) {
TEST(COMPLEX_TEST, cacos) {
ASSERT_EQ(M_PI_2, cacos(0.0));
}
TEST(complex, cacosf) {
TEST(COMPLEX_TEST, cacosf) {
ASSERT_EQ(static_cast<float>(M_PI_2), cacosf(0.0));
}
TEST(complex, cacosl) {
TEST(COMPLEX_TEST, cacosl) {
ASSERT_EQ(M_PI_2l, cacosl(0.0));
}
TEST(complex, cacosh) {
TEST(COMPLEX_TEST, cacosh) {
ASSERT_EQ(0.0, cacosh(1.0));
}
TEST(complex, cacoshl) {
TEST(COMPLEX_TEST, cacoshl) {
ASSERT_EQ(0.0, cacoshl(1.0));
}
TEST(complex, cacoshf) {
TEST(COMPLEX_TEST, cacoshf) {
ASSERT_EQ(0.0, cacoshf(1.0));
}
TEST(complex, carg) {
TEST(COMPLEX_TEST, carg) {
ASSERT_EQ(0.0, carg(0));
}
TEST(complex, cargf) {
TEST(COMPLEX_TEST, cargf) {
ASSERT_EQ(0.0, cargf(0));
}
TEST(complex, cargl) {
TEST(COMPLEX_TEST, cargl) {
ASSERT_EQ(0.0, cargl(0));
}
TEST(complex, casin) {
TEST(COMPLEX_TEST, casin) {
ASSERT_EQ(0.0, casin(0));
}
TEST(complex, casinf) {
TEST(COMPLEX_TEST, casinf) {
ASSERT_EQ(0.0, casinf(0));
}
TEST(complex, casinl) {
TEST(COMPLEX_TEST, casinl) {
ASSERT_EQ(0.0, casinl(0));
}
TEST(complex, casinh) {
TEST(COMPLEX_TEST, casinh) {
ASSERT_EQ(0.0, casinh(0));
}
TEST(complex, casinhf) {
TEST(COMPLEX_TEST, casinhf) {
ASSERT_EQ(0.0, casinhf(0));
}
TEST(complex, casinhl) {
TEST(COMPLEX_TEST, casinhl) {
ASSERT_EQ(0.0, casinhl(0));
}
TEST(complex, catan) {
TEST(COMPLEX_TEST, catan) {
ASSERT_EQ(0.0, catan(0));
}
TEST(complex, catanf) {
TEST(COMPLEX_TEST, catanf) {
ASSERT_EQ(0.0, catanf(0));
}
TEST(complex, catanl) {
TEST(COMPLEX_TEST, catanl) {
ASSERT_EQ(0.0, catanl(0));
}
TEST(complex, catanh) {
TEST(COMPLEX_TEST, catanh) {
ASSERT_EQ(0.0, catanh(0));
}
TEST(complex, catanhf) {
TEST(COMPLEX_TEST, catanhf) {
ASSERT_EQ(0.0, catanhf(0));
}
TEST(complex, catanhl) {
TEST(COMPLEX_TEST, catanhl) {
ASSERT_EQ(0.0, catanhl(0));
}
TEST(complex, ccos) {
TEST(COMPLEX_TEST, ccos) {
ASSERT_EQ(1.0, ccos(0));
}
TEST(complex, ccosf) {
TEST(COMPLEX_TEST, ccosf) {
ASSERT_EQ(1.0, ccosf(0));
}
TEST(complex, ccosl) {
TEST(COMPLEX_TEST, ccosl) {
ASSERT_EQ(1.0, ccosl(0));
}
TEST(complex, ccosh) {
TEST(COMPLEX_TEST, ccosh) {
ASSERT_EQ(1.0, ccosh(0));
}
TEST(complex, ccoshf) {
TEST(COMPLEX_TEST, ccoshf) {
ASSERT_EQ(1.0, ccoshf(0));
}
TEST(complex, ccoshl) {
TEST(COMPLEX_TEST, ccoshl) {
ASSERT_EQ(1.0, ccoshl(0));
}
TEST(complex, cexp) {
TEST(COMPLEX_TEST, cexp) {
ASSERT_EQ(1.0, cexp(0));
}
TEST(complex, cexpf) {
TEST(COMPLEX_TEST, cexpf) {
ASSERT_EQ(1.0, cexpf(0));
}
TEST(complex, cexpl) {
TEST(COMPLEX_TEST, cexpl) {
ASSERT_EQ(1.0, cexpl(0));
}
TEST(complex, cimag) {
TEST(COMPLEX_TEST, cimag) {
ASSERT_EQ(0.0, cimag(0));
}
TEST(complex, cimagf) {
TEST(COMPLEX_TEST, cimagf) {
ASSERT_EQ(0.0f, cimagf(0));
}
TEST(complex, cimagl) {
TEST(COMPLEX_TEST, cimagl) {
ASSERT_EQ(0.0, cimagl(0));
}
TEST(complex, clog) {
TEST(COMPLEX_TEST, clog) {
ASSERT_EQ(0.0, clog(1.0));
}
TEST(complex, clogf) {
TEST(COMPLEX_TEST, clogf) {
ASSERT_EQ(0.0f, clogf(1.0f));
}
TEST(complex, clogl) {
TEST(COMPLEX_TEST, clogl) {
ASSERT_EQ(0.0L, clogl(1.0L));
}
TEST(complex, conj) {
TEST(COMPLEX_TEST, conj) {
ASSERT_EQ(0.0, conj(0));
}
TEST(complex, conjf) {
TEST(COMPLEX_TEST, conjf) {
ASSERT_EQ(0.0f, conjf(0));
}
TEST(complex, conjl) {
TEST(COMPLEX_TEST, conjl) {
ASSERT_EQ(0.0, conjl(0));
}
TEST(complex, cpow) {
TEST(COMPLEX_TEST, cpow) {
ASSERT_EQ(8.0, cpow(2.0, 3.0));
}
TEST(complex, cpowf) {
TEST(COMPLEX_TEST, cpowf) {
ASSERT_EQ(8.0f, cpowf(2.0f, 3.0f));
}
TEST(complex, cpowl) {
TEST(COMPLEX_TEST, cpowl) {
ASSERT_EQ(8.0L, cpowl(2.0L, 3.0L));
}
TEST(complex, cproj) {
TEST(COMPLEX_TEST, cproj) {
ASSERT_EQ(0.0, cproj(0));
}
TEST(complex, cprojf) {
TEST(COMPLEX_TEST, cprojf) {
ASSERT_EQ(0.0f, cprojf(0));
}
TEST(complex, cprojl) {
TEST(COMPLEX_TEST, cprojl) {
ASSERT_EQ(0.0, cprojl(0));
}
TEST(complex, creal) {
TEST(COMPLEX_TEST, creal) {
ASSERT_EQ(2.0, creal(2.0 + 3.0I));
}
TEST(complex, crealf) {
TEST(COMPLEX_TEST, crealf) {
ASSERT_EQ(2.0f, crealf(2.0f + 3.0fI));
}
TEST(complex, creall) {
TEST(COMPLEX_TEST, creall) {
ASSERT_EQ(2.0, creall(2.0L + 3.0LI));
}
TEST(complex, csin) {
TEST(COMPLEX_TEST, csin) {
ASSERT_EQ(0.0, csin(0));
}
TEST(complex, csinf) {
TEST(COMPLEX_TEST, csinf) {
ASSERT_EQ(0.0, csinf(0));
}
TEST(complex, csinl) {
TEST(COMPLEX_TEST, csinl) {
ASSERT_EQ(0.0, csinl(0));
}
TEST(complex, csinh) {
TEST(COMPLEX_TEST, csinh) {
ASSERT_EQ(0.0, csinh(0));
}
TEST(complex, csinhf) {
TEST(COMPLEX_TEST, csinhf) {
ASSERT_EQ(0.0, csinhf(0));
}
TEST(complex, csinhl) {
TEST(COMPLEX_TEST, csinhl) {
ASSERT_EQ(0.0, csinhl(0));
}
TEST(complex, csqrt) {
TEST(COMPLEX_TEST, csqrt) {
ASSERT_EQ(0.0, csqrt(0));
}
TEST(complex, csqrtf) {
TEST(COMPLEX_TEST, csqrtf) {
ASSERT_EQ(0.0f, csqrtf(0));
}
TEST(complex, csqrtl) {
TEST(COMPLEX_TEST, csqrtl) {
ASSERT_EQ(0.0, csqrtl(0));
}
TEST(complex, ctan) {
TEST(COMPLEX_TEST, ctan) {
ASSERT_EQ(0.0, ctan(0));
}
TEST(complex, ctanf) {
TEST(COMPLEX_TEST, ctanf) {
ASSERT_EQ(0.0, ctanf(0));
}
TEST(complex, ctanl) {
TEST(COMPLEX_TEST, ctanl) {
ASSERT_EQ(0.0, ctanl(0));
}
TEST(complex, ctanh) {
TEST(COMPLEX_TEST, ctanh) {
ASSERT_EQ(0.0, ctanh(0));
}
TEST(complex, ctanhf) {
TEST(COMPLEX_TEST, ctanhf) {
ASSERT_EQ(0.0, ctanhf(0));
}
TEST(complex, ctanhl) {
TEST(COMPLEX_TEST, ctanhl) {
ASSERT_EQ(0.0, ctanhl(0));
}

View file

@ -0,0 +1,2 @@
#define __BIONIC_LP32_USE_LONG_DOUBLE
#include "math_test.cpp"

File diff suppressed because it is too large Load diff