Fix warnings (and errors) in static inline headers.

Bug: http://b/31676510
Change-Id: Idcbc544e498f7e6bbe99c2bf7dc557a5681e96c4
Test: preupload hook
This commit is contained in:
Josh Gao 2016-09-23 14:06:05 -07:00
parent 0173379610
commit 6cd9fb080c
8 changed files with 38 additions and 10 deletions

View File

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

View File

@ -24,12 +24,12 @@ __BEGIN_DECLS
#if __ANDROID_API__ < 21
static __inline int wcscoll_l(const wchar_t* _Nonnull ws1, const char* _Nonull ws2,
static __inline int wcscoll_l(const wchar_t* _Nonnull ws1, const wchar_t* _Nonnull ws2,
locale_t l __unused) {
return wcscoll(ws1, ws2);
}
size_t wcsxfrm_l(wchar_t* dest, const char* _Nonnull src, size_t n, locale_t l __unused) {
size_t wcsxfrm_l(wchar_t* dest, const wchar_t* _Nonnull src, size_t n, locale_t l __unused) {
return wcsxfrm(dest, src, n);
}

View File

@ -76,6 +76,7 @@ int isxdigit(int);
int tolower(int);
int toupper(int);
#if __ANDROID_API__ >= 21
int isalnum_l(int, locale_t) __INTRODUCED_IN(21);
int isalpha_l(int, locale_t) __INTRODUCED_IN(21);
int isblank_l(int, locale_t) __INTRODUCED_IN(21);
@ -90,6 +91,10 @@ int isupper_l(int, locale_t) __INTRODUCED_IN(21);
int isxdigit_l(int, locale_t) __INTRODUCED_IN(21);
int tolower_l(int, locale_t) __INTRODUCED_IN(21);
int toupper_l(int, locale_t) __INTRODUCED_IN(21);
#else
// Implemented as static inlines before 21.
#endif
int isascii(int);
int toascii(int);
int _tolower(int) __INTRODUCED_IN(21);

View File

@ -77,13 +77,7 @@ int posix_memalign(void** memptr, size_t alignment, size_t size) __INTRODUCED_IN
double strtod(const char*, char**);
long double strtold(const char*, char**) __INTRODUCED_IN(21);
double strtod_l(const char*, char**, locale_t) __INTRODUCED_IN_FUTURE;
float strtof_l(const char*, char**, locale_t) __INTRODUCED_IN_FUTURE;
long strtol_l(const char*, char**, int, locale_t) __INTRODUCED_IN_FUTURE;
long double strtold_l(const char*, char**, locale_t) __INTRODUCED_IN(21);
long long strtoll_l(const char*, char**, int, locale_t) __INTRODUCED_IN(21);
unsigned long strtoul_l(const char*, char**, int, locale_t) __INTRODUCED_IN_FUTURE;
unsigned long long strtoull_l(const char*, char**, int, locale_t) __INTRODUCED_IN(21);
int atoi(const char*) __purefunc;
long atol(const char*) __purefunc;
@ -201,10 +195,22 @@ void srand(unsigned int) __INTRODUCED_IN(21);
long random(void) __INTRODUCED_IN(21);
void srandom(unsigned int) __INTRODUCED_IN(21);
int grantpt(int) __INTRODUCED_IN(21);
long long strtoll_l(const char*, char**, int, locale_t) __INTRODUCED_IN(21);
unsigned long long strtoull_l(const char*, char**, int, locale_t) __INTRODUCED_IN(21);
long double strtold_l(const char*, char**, locale_t) __INTRODUCED_IN(21);
#else
// Implemented as static inlines before 21.
#endif
#if __ANDROID_API__ >= __ANDROID_API_FUTURE__
double strtod_l(const char*, char**, locale_t) __INTRODUCED_IN_FUTURE;
float strtof_l(const char*, char**, locale_t) __INTRODUCED_IN_FUTURE;
long strtol_l(const char*, char**, int, locale_t) __INTRODUCED_IN_FUTURE;
#else
// Implemented as static inlines.
#endif
__END_DECLS
#include <android/legacy_stdlib_inlines.h>

View File

@ -114,8 +114,12 @@ char* strsignal(int);
int strcoll(const char* _Nonnull, const char* _Nonnull) __purefunc;
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);
size_t strxfrm_l(char* __restrict, const char* _Nonnull __restrict, size_t, locale_t) __INTRODUCED_IN(21);
#else
// Implemented as static inlines before 21.
#endif
#if defined(__USE_GNU) && !defined(basename)
/*

View File

@ -76,7 +76,12 @@ struct tm* gmtime_r(const time_t*, struct tm*);
char* strptime(const char*, const char*, struct tm*);
size_t strftime(char*, size_t, const char*, const struct tm*);
#if __ANDROID_API__ >= 21
size_t strftime_l(char*, size_t, const char*, const struct tm*, locale_t) __INTRODUCED_IN(21);
#else
// Implemented as static inline before 21.
#endif
char* ctime(const time_t*);
char* ctime_r(const time_t*, char*);

View File

@ -132,6 +132,7 @@ wchar_t *wmemset(wchar_t *, wchar_t, size_t);
int wprintf(const wchar_t *, ...);
int wscanf(const wchar_t *, ...);
#if __ANDROID_API__ >= 21
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);
@ -139,6 +140,9 @@ 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
__INTRODUCED_IN(21);
size_t wcsxfrm_l(wchar_t*, const wchar_t* _Nonnull, size_t, locale_t) __INTRODUCED_IN(21);
#else
// Implemented as static inlines before 21.
#endif
size_t wcslcat(wchar_t*, const wchar_t*, size_t);
size_t wcslcpy(wchar_t*, const wchar_t*, size_t);

View File

@ -35,6 +35,7 @@
__BEGIN_DECLS
#if __ANDROID_API__ >= 21
int iswalnum_l(wint_t, locale_t) __INTRODUCED_IN(21);
int iswalpha_l(wint_t, locale_t) __INTRODUCED_IN(21);
int iswblank_l(wint_t, locale_t) __INTRODUCED_IN(21);
@ -50,6 +51,9 @@ int iswxdigit_l(wint_t, locale_t) __INTRODUCED_IN(21);
wint_t towlower_l(int, locale_t) __INTRODUCED_IN(21);
wint_t towupper_l(int, locale_t) __INTRODUCED_IN(21);
#else
// Implemented as static inlines before 21.
#endif
wint_t towctrans_l(wint_t, wctrans_t, locale_t) __INTRODUCED_IN_FUTURE;
wctrans_t wctrans_l(const char*, locale_t) __INTRODUCED_IN_FUTURE;