Rename __pure, __pure2, and __purefunc.

These names were pretty misleading (aka "backwards"), so switch to the
same obvious names glibc uses.

Test: build.
Change-Id: Ia98c9dbbccd0820386116562347654e84669034a
This commit is contained in:
Elliott Hughes 2016-09-28 12:29:52 -07:00
parent 1d20532f5c
commit 95fa061678
12 changed files with 94 additions and 95 deletions

View File

@ -24,8 +24,8 @@ __BEGIN_DECLS
#if __ANDROID_API__ < 21
static __inline __purefunc int strcoll_l(const char* _Nonnull s1, const char* _Nonnull s2,
locale_t l __unused) {
static __inline __attribute_pure__ int strcoll_l(const char* _Nonnull s1, const char* _Nonnull s2,
locale_t l __unused) {
return strcoll(s1, s2);
}

View File

@ -35,10 +35,10 @@
__BEGIN_DECLS
int strcasecmp(const char*, const char*) __purefunc;
int strcasecmp_l(const char*, const char*, locale_t) __purefunc __INTRODUCED_IN(23);
int strncasecmp(const char*, const char*, size_t) __purefunc;
int strncasecmp_l(const char*, const char*, size_t, locale_t) __purefunc __INTRODUCED_IN(23);
int strcasecmp(const char*, const char*) __attribute_pure__;
int strcasecmp_l(const char*, const char*, locale_t) __attribute_pure__ __INTRODUCED_IN(23);
int strncasecmp(const char*, const char*, size_t) __attribute_pure__;
int strncasecmp_l(const char*, const char*, size_t, locale_t) __attribute_pure__ __INTRODUCED_IN(23);
__END_DECLS

View File

@ -41,7 +41,7 @@ __BEGIN_DECLS
#endif
/* internal function returning the address of the thread-specific errno */
volatile int* __errno(void) __pure2;
volatile int* __errno(void) __attribute_const__;
/* a macro expanding to the errno l-value */
#define errno (*__errno())

View File

@ -254,8 +254,8 @@ typedef struct {
} imaxdiv_t;
__BEGIN_DECLS
intmax_t imaxabs(intmax_t) __pure2 __INTRODUCED_IN(19);
imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2 __INTRODUCED_IN(19);
intmax_t imaxabs(intmax_t) __attribute_const__ __INTRODUCED_IN(19);
imaxdiv_t imaxdiv(intmax_t, intmax_t) __attribute_const__ __INTRODUCED_IN(19);
intmax_t strtoimax(const char *, char **, int);
uintmax_t strtoumax(const char *, char **, int);
intmax_t wcstoimax(const wchar_t* __restrict, wchar_t** __restrict, int) __INTRODUCED_IN(21);

View File

@ -86,25 +86,25 @@ 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 __pure2. In C99, FENV_ACCESS affects the purity of these functions.
* as __attribute_const__. In C99, FENV_ACCESS affects the purity of these functions.
*/
int __fpclassifyd(double) __pure2;
int __fpclassifyf(float) __pure2;
int __fpclassifyl(long double) __pure2;
int __isfinitef(float) __pure2;
int __isfinite(double) __pure2;
int __isfinitel(long double) __pure2;
int __isinff(float) __pure2;
int __isinfl(long double) __pure2;
int __isnanf(float) __pure2 __INTRODUCED_IN(21);
int __isnanl(long double) __pure2;
int __isnormalf(float) __pure2;
int __isnormal(double) __pure2;
int __isnormall(long double) __pure2;
int __signbit(double) __pure2;
int __signbitf(float) __pure2;
int __signbitl(long double) __pure2;
int __fpclassifyd(double) __attribute_const__;
int __fpclassifyf(float) __attribute_const__;
int __fpclassifyl(long double) __attribute_const__;
int __isfinitef(float) __attribute_const__;
int __isfinite(double) __attribute_const__;
int __isfinitel(long double) __attribute_const__;
int __isinff(float) __attribute_const__;
int __isinfl(long double) __attribute_const__;
int __isnanf(float) __attribute_const__ __INTRODUCED_IN(21);
int __isnanl(long double) __attribute_const__;
int __isnormalf(float) __attribute_const__;
int __isnormal(double) __attribute_const__;
int __isnormall(long double) __attribute_const__;
int __signbit(double) __attribute_const__;
int __signbitf(float) __attribute_const__;
int __signbitl(long double) __attribute_const__;
double acos(double);
double asin(double);
@ -119,17 +119,17 @@ double sinh(double);
double tanh(double);
double exp(double);
double frexp(double, int *); /* fundamentally !__pure2 */
double frexp(double, int *); /* fundamentally !__attribute_const__ */
double ldexp(double, int);
double log(double);
double log10(double);
double modf(double, double *); /* fundamentally !__pure2 */
double modf(double, double *); /* fundamentally !__attribute_const__ */
double pow(double, double);
double sqrt(double);
double ceil(double);
double fabs(double) __pure2;
double fabs(double) __attribute_const__;
double floor(double);
double fmod(double, double);
@ -143,9 +143,9 @@ double exp2(double);
double expm1(double);
double fma(double, double, double);
double hypot(double, double);
int ilogb(double) __pure2;
int(isinf)(double) __pure2 __INTRODUCED_IN(21);
int (isnan)(double) __pure2;
int ilogb(double) __attribute_const__;
int(isinf)(double) __attribute_const__ __INTRODUCED_IN(21);
int (isnan)(double) __attribute_const__;
double lgamma(double);
long long llrint(double);
long long llround(double);
@ -155,7 +155,7 @@ double logb(double);
long lrint(double);
long lround(double);
double nan(const char*) __pure2 __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13)
double nan(const char*) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13)
__INTRODUCED_IN_X86(9);
double nextafter(double, double);
@ -163,10 +163,10 @@ double remainder(double, double);
double remquo(double, double, int*);
double rint(double);
double copysign(double, double) __pure2;
double copysign(double, double) __attribute_const__;
double fdim(double, double);
double fmax(double, double) __pure2;
double fmin(double, double) __pure2;
double fmax(double, double) __attribute_const__;
double fmin(double, double) __attribute_const__;
double nearbyint(double);
double round(double);
double scalbln(double, long) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
@ -189,20 +189,20 @@ float tanhf(float);
float exp2f(float);
float expf(float);
float expm1f(float);
float frexpf(float, int *); /* fundamentally !__pure2 */
int ilogbf(float) __pure2;
float frexpf(float, int *); /* fundamentally !__attribute_const__ */
int ilogbf(float) __attribute_const__;
float ldexpf(float, int);
float log10f(float);
float log1pf(float);
float log2f(float) __INTRODUCED_IN(18);
float logf(float);
float modff(float, float *); /* fundamentally !__pure2 */
float modff(float, float *); /* fundamentally !__attribute_const__ */
float powf(float, float);
float sqrtf(float);
float ceilf(float);
float fabsf(float) __pure2;
float fabsf(float) __attribute_const__;
float floorf(float);
float fmodf(float, float);
float roundf(float);
@ -218,12 +218,12 @@ float asinhf(float);
float atanhf(float);
float cbrtf(float);
float logbf(float);
float copysignf(float, float) __pure2;
float copysignf(float, float) __attribute_const__;
long long llrintf(float);
long long llroundf(float);
long lrintf(float);
long lroundf(float);
float nanf(const char*) __pure2 __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13)
float nanf(const char*) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13)
__INTRODUCED_IN_X86(9);
float nearbyintf(float);
float nextafterf(float, float);
@ -236,8 +236,8 @@ float truncf(float);
float fdimf(float, float);
float fmaf(float, float, float);
float fmaxf(float, float) __pure2;
float fminf(float, float) __pure2;
float fmaxf(float, float) __attribute_const__;
float fminf(float, float) __attribute_const__;
long double acoshl(long double) __INTRODUCED_IN(21);
long double acosl(long double) __INTRODUCED_IN(21);
@ -248,7 +248,7 @@ long double atanhl(long double) __INTRODUCED_IN(21);
long double atanl(long double) __INTRODUCED_IN(21);
long double cbrtl(long double) __INTRODUCED_IN(21);
long double ceill(long double);
long double copysignl(long double, long double) __pure2;
long double copysignl(long double, long double) __attribute_const__;
long double coshl(long double) __INTRODUCED_IN(21);
long double cosl(long double) __INTRODUCED_IN(21);
long double erfcl(long double) __INTRODUCED_IN(21);
@ -256,17 +256,17 @@ long double erfl(long double) __INTRODUCED_IN(21);
long double exp2l(long double) __INTRODUCED_IN(21);
long double expl(long double) __INTRODUCED_IN(21);
long double expm1l(long double) __INTRODUCED_IN(21);
long double fabsl(long double) __pure2;
long double fabsl(long double) __attribute_const__;
long double fdiml(long double, long double);
long double floorl(long double);
long double fmal(long double, long double, long double) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
long double fmaxl(long double, long double) __pure2;
long double fminl(long double, long double) __pure2;
long double fmaxl(long double, long double) __attribute_const__;
long double fminl(long double, long double) __attribute_const__;
long double fmodl(long double, long double) __INTRODUCED_IN(21);
long double frexpl(long double value, int*)
__INTRODUCED_IN(21) __VERSIONER_NO_GUARD; /* fundamentally !__pure2 */
__INTRODUCED_IN(21) __VERSIONER_NO_GUARD; /* fundamentally !__attribute_const__ */
long double hypotl(long double, long double) __INTRODUCED_IN(21);
int ilogbl(long double) __pure2;
int ilogbl(long double) __attribute_const__;
long double ldexpl(long double, int);
long double lgammal(long double) __INTRODUCED_IN(21);
long long llrintl(long double) __INTRODUCED_IN(21);
@ -278,8 +278,8 @@ long double logbl(long double) __INTRODUCED_IN(18);
long double logl(long double) __INTRODUCED_IN(21);
long lrintl(long double) __INTRODUCED_IN(21);
long lroundl(long double);
long double modfl(long double, long double*) __INTRODUCED_IN(21); /* fundamentally !__pure2 */
long double nanl(const char*) __pure2 __INTRODUCED_IN(13);
long double modfl(long double, long double*) __INTRODUCED_IN(21); /* fundamentally !__attribute_const__ */
long double nanl(const char*) __attribute_const__ __INTRODUCED_IN(13);
long double nearbyintl(long double) __INTRODUCED_IN(21);
long double nextafterl(long double, long double) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
double nexttoward(double, long double) __INTRODUCED_IN(18) __VERSIONER_NO_GUARD;
@ -327,15 +327,15 @@ double yn(int, double);
double gamma(double);
double scalb(double, double);
double drem(double, double);
int finite(double) __pure2;
int isnanf(float) __pure2;
int finite(double) __attribute_const__;
int isnanf(float) __attribute_const__;
double gamma_r(double, int*);
double lgamma_r(double, int*);
double significand(double);
long double lgammal_r(long double, int*) __INTRODUCED_IN(23);
long double significandl(long double) __INTRODUCED_IN(21);
float dremf(float, float);
int finitef(float) __pure2;
int finitef(float) __attribute_const__;
float gammaf(float);
float j0f(float);
float j1f(float);

View File

@ -196,7 +196,7 @@ int pthread_spin_lock(pthread_spinlock_t* _Nonnull) __INTRODUCED_IN(24);
int pthread_spin_trylock(pthread_spinlock_t* _Nonnull) __INTRODUCED_IN(24);
int pthread_spin_unlock(pthread_spinlock_t* _Nonnull) __INTRODUCED_IN(24);
pthread_t pthread_self(void) __pure2;
pthread_t pthread_self(void) __attribute_const__;
#if defined(__USE_GNU)
int pthread_getname_np(pthread_t, char* _Nonnull, size_t) __INTRODUCED_IN_FUTURE;

View File

@ -79,9 +79,9 @@ long double strtold(const char*, char**) __INTRODUCED_IN(21);
unsigned long strtoul_l(const char*, char**, int, locale_t) __INTRODUCED_IN_FUTURE;
int atoi(const char*) __purefunc;
long atol(const char*) __purefunc;
long long atoll(const char*) __purefunc;
int atoi(const char*) __attribute_pure__;
long atol(const char*) __attribute_pure__;
long long atoll(const char*) __attribute_pure__;
char* realpath(const char* path, char* resolved);
int system(const char* string);
@ -125,21 +125,21 @@ typedef struct {
int rem;
} div_t;
div_t div(int, int) __pure2;
div_t div(int, int) __attribute_const__;
typedef struct {
long int quot;
long int rem;
} ldiv_t;
ldiv_t ldiv(long, long) __pure2;
ldiv_t ldiv(long, long) __attribute_const__;
typedef struct {
long long int quot;
long long int rem;
} lldiv_t;
lldiv_t lldiv(long long, long long) __pure2;
lldiv_t lldiv(long long, long long) __attribute_const__;
/* BSD compatibility. */
const char* getprogname(void) __INTRODUCED_IN(21);
@ -186,10 +186,10 @@ char* realpath(const char* path, char* resolved) {
#if __ANDROID_API__ >= 21
float strtof(const char*, char**) __INTRODUCED_IN(21);
double atof(const char*) __INTRODUCED_IN(21);
int abs(int) __pure2 __INTRODUCED_IN(21);
long labs(long) __pure2 __INTRODUCED_IN(21);
long long llabs(long long) __pure2 __INTRODUCED_IN(21);
double atof(const char*) __attribute_pure__ __INTRODUCED_IN(21);
int abs(int) __attribute_const__ __INTRODUCED_IN(21);
long labs(long) __attribute_const__ __INTRODUCED_IN(21);
long long llabs(long long) __attribute_const__ __INTRODUCED_IN(21);
int rand(void) __INTRODUCED_IN(21);
void srand(unsigned int) __INTRODUCED_IN(21);
long random(void) __INTRODUCED_IN(21);

View File

@ -47,42 +47,42 @@ __BEGIN_DECLS
#endif
void* memccpy(void* _Nonnull __restrict, const void* _Nonnull __restrict, int, size_t);
void* memchr(const void* _Nonnull, int, size_t) __purefunc;
void* memrchr(const void* _Nonnull, int, size_t) __purefunc;
int memcmp(const void* _Nonnull, const void* _Nonnull, size_t) __purefunc;
void* memchr(const void* _Nonnull, int, size_t) __attribute_pure__;
void* memrchr(const void* _Nonnull, int, size_t) __attribute_pure__;
int memcmp(const void* _Nonnull, const void* _Nonnull, size_t) __attribute_pure__;
void* memcpy(void* _Nonnull __restrict, const void* _Nonnull __restrict, size_t);
#if defined(__USE_GNU)
void* mempcpy(void* _Nonnull __restrict, const void* _Nonnull __restrict, size_t) __INTRODUCED_IN(23);
#endif
void* memmove(void* _Nonnull, const void* _Nonnull, size_t);
void* memset(void* _Nonnull, int, size_t);
void* memmem(const void* _Nonnull, size_t, const void* _Nonnull, size_t) __purefunc;
void* memmem(const void* _Nonnull, size_t, const void* _Nonnull, size_t) __attribute_pure__;
char* strchr(const char* _Nonnull, int) __purefunc;
char* strchr(const char* _Nonnull, int) __attribute_pure__;
char* __strchr_chk(const char* _Nonnull, int, size_t) __INTRODUCED_IN(18);
#if defined(__USE_GNU)
#if defined(__cplusplus)
extern "C++" char* strchrnul(char* _Nonnull, int) __RENAME(strchrnul) __purefunc;
extern "C++" const char* strchrnul(const char* _Nonnull, int) __RENAME(strchrnul) __purefunc;
extern "C++" char* strchrnul(char* _Nonnull, int) __RENAME(strchrnul) __attribute_pure__;
extern "C++" const char* strchrnul(const char* _Nonnull, int) __RENAME(strchrnul) __attribute_pure__;
#else
char* strchrnul(const char* _Nonnull, int) __purefunc __INTRODUCED_IN(24);
char* strchrnul(const char* _Nonnull, int) __attribute_pure__ __INTRODUCED_IN(24);
#endif
#endif
char* strrchr(const char* _Nonnull, int) __purefunc;
char* strrchr(const char* _Nonnull, int) __attribute_pure__;
char* __strrchr_chk(const char* _Nonnull, int, size_t) __INTRODUCED_IN(18);
size_t strlen(const char* _Nonnull) __purefunc;
size_t strlen(const char* _Nonnull) __attribute_pure__;
size_t __strlen_chk(const char* _Nonnull, size_t) __INTRODUCED_IN(17);
int strcmp(const char* _Nonnull, const char* _Nonnull) __purefunc;
int strcmp(const char* _Nonnull, const char* _Nonnull) __attribute_pure__;
char* stpcpy(char* _Nonnull __restrict, const char* _Nonnull__restrict) __INTRODUCED_IN(21);
char* strcpy(char* _Nonnull __restrict, const char* _Nonnull __restrict);
char* strcat(char* _Nonnull __restrict, const char* _Nonnull __restrict);
char* strdup(const char* _Nonnull);
char* strstr(const char* _Nonnull, const char* _Nonnull) __purefunc;
char* strcasestr(const char* _Nonnull, const char* _Nonnull) __purefunc;
char* strstr(const char* _Nonnull, const char* _Nonnull) __attribute_pure__;
char* strcasestr(const char* _Nonnull, const char* _Nonnull) __attribute_pure__;
char* strtok(char* __restrict, const char* _Nonnull __restrict);
char* strtok_r(char* __restrict, const char* _Nonnull __restrict, char** _Nonnull __restrict);
@ -94,28 +94,28 @@ char* strerror_r(int, char*, size_t) __RENAME(__gnu_strerror_r) __INTRODUCED_IN(
int strerror_r(int, char*, size_t);
#endif
size_t strnlen(const char* _Nonnull, size_t) __purefunc;
size_t strnlen(const char* _Nonnull, size_t) __attribute_pure__;
char* strncat(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t);
char* strndup(const char* _Nonnull, size_t);
int strncmp(const char* _Nonnull, const char* _Nonnull, size_t) __purefunc;
int strncmp(const char* _Nonnull, const char* _Nonnull, size_t) __attribute_pure__;
char* stpncpy(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t) __INTRODUCED_IN(21);
char* strncpy(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t);
size_t strlcat(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t);
size_t strlcpy(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t);
size_t strcspn(const char* _Nonnull, const char* _Nonnull) __purefunc;
char* strpbrk(const char* _Nonnull, const char* _Nonnull) __purefunc;
size_t strcspn(const char* _Nonnull, const char* _Nonnull) __attribute_pure__;
char* strpbrk(const char* _Nonnull, const char* _Nonnull) __attribute_pure__;
char* strsep(char** _Nonnull __restrict, const char* _Nonnull __restrict);
size_t strspn(const char* _Nonnull, const char* _Nonnull);
char* strsignal(int);
int strcoll(const char* _Nonnull, const char* _Nonnull) __purefunc;
int strcoll(const char* _Nonnull, const char* _Nonnull) __attribute_pure__;
size_t strxfrm(char* __restrict, const char* _Nonnull __restrict, size_t);
#if __ANDROID_API__ >= 21
int strcoll_l(const char* _Nonnull, const char* _Nonnull, locale_t) __purefunc __INTRODUCED_IN(21);
int strcoll_l(const char* _Nonnull, const char* _Nonnull, locale_t) __attribute_pure__ __INTRODUCED_IN(21);
size_t strxfrm_l(char* __restrict, const char* _Nonnull __restrict, size_t, locale_t) __INTRODUCED_IN(21);
#else
// Implemented as static inlines before 21.

View File

@ -102,13 +102,12 @@
#endif /* !(__STDC__ || __cplusplus) */
#define __always_inline __attribute__((__always_inline__))
#define __attribute_const__ __attribute__((__const__))
#define __attribute_pure__ __attribute__((__pure__))
#define __dead __attribute__((__noreturn__))
#define __noreturn __attribute__((__noreturn__))
#define __mallocfunc __attribute__((malloc))
#define __mallocfunc __attribute__((__malloc__))
#define __packed __attribute__((__packed__))
#define __pure __attribute__((__const__))
#define __pure2 __attribute__((__const__)) /* Android-added: used by FreeBSD libm */
#define __purefunc __attribute__((pure))
#define __unused __attribute__((__unused__))
#define __used __attribute__((__used__))

View File

@ -49,10 +49,10 @@
/* glibc compatibility. */
__BEGIN_DECLS
uint32_t htonl(uint32_t) __pure2 __INTRODUCED_IN(21);
uint16_t htons(uint16_t) __pure2 __INTRODUCED_IN(21);
uint32_t ntohl(uint32_t) __pure2 __INTRODUCED_IN(21);
uint16_t ntohs(uint16_t) __pure2 __INTRODUCED_IN(21);
uint32_t htonl(uint32_t) __attribute_const__ __INTRODUCED_IN(21);
uint16_t htons(uint16_t) __attribute_const__ __INTRODUCED_IN(21);
uint32_t ntohl(uint32_t) __attribute_const__ __INTRODUCED_IN(21);
uint16_t ntohs(uint16_t) __attribute_const__ __INTRODUCED_IN(21);
__END_DECLS
#define htonl(x) __swap32(x)

View File

@ -81,7 +81,7 @@ __noreturn void _exit(int __status);
pid_t fork(void);
pid_t vfork(void);
pid_t getpid(void);
pid_t gettid(void) __pure2;
pid_t gettid(void) __attribute_const__;
pid_t getpgid(pid_t __pid);
int setpgid(pid_t __pid, pid_t __pgid);
pid_t getppid(void);

View File

@ -137,7 +137,7 @@ long long wcstoll_l(const wchar_t*, wchar_t**, int, locale_t) __INTRODUCED_IN(21
unsigned long long wcstoull_l(const wchar_t*, wchar_t**, int, locale_t) __INTRODUCED_IN(21);
long double wcstold_l(const wchar_t*, wchar_t**, locale_t) __INTRODUCED_IN(21);
int wcscoll_l(const wchar_t* _Nonnull, const wchar_t* _Nonnull, locale_t) __purefunc
int wcscoll_l(const wchar_t* _Nonnull, const wchar_t* _Nonnull, locale_t) __attribute_pure__
__INTRODUCED_IN(21);
size_t wcsxfrm_l(wchar_t*, const wchar_t* _Nonnull, size_t, locale_t) __INTRODUCED_IN(21);
#else