Add a new compilation flag: OPENLIBM_ONLY_THREAD_SAFE.

The global signgam variable is only part of the X/Open System
Interfaces. It is not part of the POSIX base definitions nor the C
standard.

I'd rather have it disabled for my specific use-case, so introduce a new
compilation flag that we can use to disable it.
This commit is contained in:
Ed Schouten 2015-01-10 09:57:33 +01:00
parent 9fdc4f9d9e
commit c253db68ca
7 changed files with 24 additions and 10 deletions

View file

@ -25,10 +25,12 @@
#include "math_private.h"
extern int signgam;
DLLEXPORT double
__ieee754_gamma(double x)
{
#ifdef OPENLIBM_ONLY_THREAD_SAFE
int signgam;
#endif
return __ieee754_gamma_r(x,&signgam);
}

View file

@ -26,10 +26,12 @@
#include "math_private.h"
extern int signgam;
DLLEXPORT float
__ieee754_gammaf(float x)
{
#ifdef OPENLIBM_ONLY_THREAD_SAFE
int signgam;
#endif
return __ieee754_gammaf_r(x,&signgam);
}

View file

@ -25,10 +25,12 @@
#include "math_private.h"
extern int signgam;
DLLEXPORT double
__ieee754_lgamma(double x)
{
#ifdef OPENLIBM_ONLY_THREAD_SAFE
int signgam;
#endif
return __ieee754_lgamma_r(x,&signgam);
}

View file

@ -26,10 +26,12 @@
#include "math_private.h"
extern int signgam;
DLLEXPORT float
__ieee754_lgammaf(float x)
{
#ifdef OPENLIBM_ONLY_THREAD_SAFE
int signgam;
#endif
return __ieee754_lgammaf_r(x,&signgam);
}

View file

@ -4,11 +4,12 @@
#include "math_private.h"
extern int signgam;
DLLEXPORT long double
lgammal(long double x)
{
#ifdef OPENLIBM_ONLY_THREAD_SAFE
int signgam;
#endif
return (lgammal_r(x, &signgam));
}

View file

@ -170,7 +170,10 @@ extern const union __nan_un {
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
#define MAXFLOAT ((float)3.40282346638528860e+38)
#ifndef OPENLIBM_ONLY_THREAD_SAFE
extern int signgam;
#endif
#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
#if __BSD_VISIBLE

View file

@ -2,4 +2,6 @@
#include "math_private.h"
#ifndef OPENLIBM_ONLY_THREAD_SAFE
int signgam = 0;
#endif