[liba] Proper support for function-like macros for math functions

This commit is contained in:
Romain Goyet
2017-10-19 14:17:44 +02:00
committed by EmilieNumworks
parent f34146be5e
commit 5a2446eff7
4 changed files with 102 additions and 29 deletions

View File

@@ -0,0 +1,66 @@
#include_next <math.h>
/* In accordance with the C99 standard, we've defined libm function as macros to
* leverage compiler optimizations. When comes the time to actually implement
* those functions, we don't want the macro to be active. OpenBSD doesn't use
* macros so it doesn't bother #undef-ing libm functions. Let's do it here. */
#undef acosf
#undef acoshf
#undef asinf
#undef asinhf
#undef atanf
#undef atan2f
#undef atanhf
#undef ceilf
#undef copysignf
#undef cosf
#undef coshf
#undef expf
#undef expm1f
#undef fabsf
#undef floorf
#undef fmodf
#undef lgammaf
#undef lgammaf_r
#undef log1pf
#undef log10f
#undef logf
#undef nanf
#undef nearbyintf
#undef powf
#undef roundf
#undef scalbnf
#undef sinf
#undef sinhf
#undef sqrtf
#undef tanf
#undef tanhf
#undef acos
#undef acosh
#undef asin
#undef asinh
#undef atan
#undef atanh
#undef ceil
#undef copysign
#undef cos
#undef cosh
#undef exp
#undef expm1
#undef fabs
#undef floor
#undef lgamma
#undef lgamma_r
#undef log1p
#undef log10
#undef log
#undef pow
#undef round
#undef scalbn
#undef sin
#undef sinh
#undef sqrt
#undef tan
#undef tanh

View File

@@ -1,5 +1,7 @@
#include <math.h>
#undef nearbyintf
/* nearbyintf is not supposed to be the same as roundf according to openBSD
* documentation. Indeed:
* - they round halfway cases to the nearest integer instead of away from zero