Merge "Stop using the __ANDROID_API_x__ constants."
diff --git a/libc/arch-common/bionic/crtbegin.c b/libc/arch-common/bionic/crtbegin.c
index bdda1cf..b7043dc 100644
--- a/libc/arch-common/bionic/crtbegin.c
+++ b/libc/arch-common/bionic/crtbegin.c
@@ -72,7 +72,7 @@
// To ensure that the .tdata input section isn't deleted (e.g. by
// --gc-sections), the .text input section (which contains _start) has a
// relocation to the .tdata input section.
-#if __ANDROID_API__ >= __ANDROID_API_Q__
+#if __ANDROID_API__ >= 29
#if defined(__arm__)
asm(" .section .tdata,\"awT\",%progbits\n"
" .p2align 5\n"
diff --git a/libc/arch-common/bionic/pthread_atfork.h b/libc/arch-common/bionic/pthread_atfork.h
index 742d078..02e383d 100644
--- a/libc/arch-common/bionic/pthread_atfork.h
+++ b/libc/arch-common/bionic/pthread_atfork.h
@@ -18,7 +18,7 @@
// __register_atfork wasn't available until android-23. When using libc.a, we're
// using the latest library regardless of target API level.
-#if defined(_FORCE_CRT_ATFORK) || __ANDROID_API__ >= __ANDROID_API_M__
+#if defined(_FORCE_CRT_ATFORK) || __ANDROID_API__ >= 23
extern void* __dso_handle;
@@ -33,4 +33,4 @@
return __register_atfork(prepare, parent, child, &__dso_handle);
}
-#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
+#endif
diff --git a/libc/bionic/pthread_internal.cpp b/libc/bionic/pthread_internal.cpp
index 6fddefe..e091158 100644
--- a/libc/bionic/pthread_internal.cpp
+++ b/libc/bionic/pthread_internal.cpp
@@ -100,8 +100,8 @@
}
}
- // Historically we'd return null, but
- if (android_get_application_target_sdk_version() >= __ANDROID_API_O__) {
+ // Historically we'd return null, but from API level 26 we catch this error.
+ if (android_get_application_target_sdk_version() >= 26) {
if (thread == nullptr) {
// This seems to be a common mistake, and it's relatively harmless because
// there will never be a valid thread at address 0, whereas other invalid
diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp
index de62a5c..a15e981 100644
--- a/libc/bionic/pthread_mutex.cpp
+++ b/libc/bionic/pthread_mutex.cpp
@@ -799,7 +799,7 @@
// ARM64. So make it noinline.
static int __attribute__((noinline)) HandleUsingDestroyedMutex(pthread_mutex_t* mutex,
const char* function_name) {
- if (android_get_application_target_sdk_version() >= __ANDROID_API_P__) {
+ if (android_get_application_target_sdk_version() >= 28) {
__fortify_fatal("%s called on a destroyed mutex (%p)", function_name, mutex);
}
return EBUSY;
diff --git a/libc/bionic/semaphore.cpp b/libc/bionic/semaphore.cpp
index 455e36b..33552a9 100644
--- a/libc/bionic/semaphore.cpp
+++ b/libc/bionic/semaphore.cpp
@@ -221,7 +221,7 @@
}
int result = __futex_wait_ex(sem_count_ptr, shared, shared | SEMCOUNT_MINUS_ONE, false, nullptr);
- if (android_get_application_target_sdk_version() >= __ANDROID_API_N__) {
+ if (android_get_application_target_sdk_version() >= 24) {
if (result ==-EINTR) {
errno = EINTR;
return -1;
diff --git a/libc/include/android/api-level.h b/libc/include/android/api-level.h
index 577fb00..1b8af78 100644
--- a/libc/include/android/api-level.h
+++ b/libc/include/android/api-level.h
@@ -124,7 +124,7 @@
*/
int android_get_application_target_sdk_version() __INTRODUCED_IN(24);
-#if __ANDROID_API__ < __ANDROID_API_Q__
+#if __ANDROID_API__ < 29
// android_get_device_api_level is a static inline before API level 29.
#define __BIONIC_GET_DEVICE_API_LEVEL_INLINE static __inline
diff --git a/libc/include/android/legacy_errno_inlines.h b/libc/include/android/legacy_errno_inlines.h
index 9f116fa..fcbca13 100644
--- a/libc/include/android/legacy_errno_inlines.h
+++ b/libc/include/android/legacy_errno_inlines.h
@@ -26,12 +26,11 @@
* SUCH DAMAGE.
*/
-#ifndef _ANDROID_LEGACY_ERRNO_INLINES_H
-#define _ANDROID_LEGACY_ERRNO_INLINES_H
+#pragma once
#include <sys/cdefs.h>
-#if __ANDROID_API__ < __ANDROID_API_L__
+#if __ANDROID_API__ < 21
#include <errno.h>
@@ -45,4 +44,3 @@
__END_DECLS
#endif
-#endif /* _ANDROID_LEGACY_ERRNO_INLINES_H */
diff --git a/libc/include/android/legacy_fenv_inlines_arm.h b/libc/include/android/legacy_fenv_inlines_arm.h
index 5ec5582..92caa72 100644
--- a/libc/include/android/legacy_fenv_inlines_arm.h
+++ b/libc/include/android/legacy_fenv_inlines_arm.h
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
-#if __ANDROID_API__ < __ANDROID_API_L__ && defined(__arm__)
+#if __ANDROID_API__ < 21 && defined(__arm__)
#define __BIONIC_FENV_INLINE static __inline
#include <bits/fenv_inlines_arm.h>
diff --git a/libc/include/android/legacy_fenv_inlines_mips.h b/libc/include/android/legacy_fenv_inlines_mips.h
index ccc824c..92589ed 100644
--- a/libc/include/android/legacy_fenv_inlines_mips.h
+++ b/libc/include/android/legacy_fenv_inlines_mips.h
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
-#if __ANDROID_API__ < __ANDROID_API_L__ && (defined(__mips__) && !defined(__LP64__))
+#if __ANDROID_API__ < 21 && (defined(__mips__) && !defined(__LP64__))
#define __BIONIC_FENV_INLINE static __inline
#include <bits/fenv_inlines_mips.h>
diff --git a/libc/include/android/legacy_signal_inlines.h b/libc/include/android/legacy_signal_inlines.h
index d2c7677..90eda7d 100644
--- a/libc/include/android/legacy_signal_inlines.h
+++ b/libc/include/android/legacy_signal_inlines.h
@@ -26,12 +26,11 @@
* SUCH DAMAGE.
*/
-#ifndef _ANDROID_LEGACY_SIGNAL_INLINES_H_
-#define _ANDROID_LEGACY_SIGNAL_INLINES_H_
+#pragma once
#include <sys/cdefs.h>
-#if __ANDROID_API__ < __ANDROID_API_L__
+#if __ANDROID_API__ < 21
#include <errno.h>
#include <signal.h>
@@ -119,6 +118,4 @@
__END_DECLS
-#endif /* __ANDROID_API__ < __ANDROID_API_L__ */
-
-#endif /* _ANDROID_LEGACY_SIGNAL_INLINES_H_ */
+#endif
diff --git a/libc/include/android/legacy_stdlib_inlines.h b/libc/include/android/legacy_stdlib_inlines.h
index 439b486..aeb1575 100644
--- a/libc/include/android/legacy_stdlib_inlines.h
+++ b/libc/include/android/legacy_stdlib_inlines.h
@@ -26,12 +26,11 @@
* SUCH DAMAGE.
*/
-#ifndef _ANDROID_LEGACY_STDLIB_INLINES_H_
-#define _ANDROID_LEGACY_STDLIB_INLINES_H_
+#pragma once
#include <sys/cdefs.h>
-#if __ANDROID_API__ < __ANDROID_API_K__
+#if __ANDROID_API__ < 19
__BEGIN_DECLS
@@ -45,9 +44,11 @@
__END_DECLS
-#endif /* __ANDROID_API__ < __ANDROID_API_K__ */
+#endif
-#if __ANDROID_API__ < __ANDROID_API_L__
+
+
+#if __ANDROID_API__ < 21
#include <errno.h>
#include <float.h>
@@ -83,9 +84,11 @@
__END_DECLS
-#endif /* __ANDROID_API__ < __ANDROID_API_L__ */
+#endif
-#if __ANDROID_API__ < __ANDROID_API_O__
+
+
+#if __ANDROID_API__ < 26
#include <stdlib.h>
#include <xlocale.h>
@@ -106,6 +109,4 @@
__END_DECLS
-#endif /* __ANDROID_API__ < __ANDROID_API_O__ */
-
-#endif /* _ANDROID_LEGACY_STDLIB_INLINES_H_ */
+#endif
diff --git a/libc/include/android/legacy_strings_inlines.h b/libc/include/android/legacy_strings_inlines.h
index 5d63c5a..2cc2da2 100644
--- a/libc/include/android/legacy_strings_inlines.h
+++ b/libc/include/android/legacy_strings_inlines.h
@@ -26,12 +26,11 @@
* SUCH DAMAGE.
*/
-#ifndef _ANDROID_LEGACY_STRINGS_INLINES_H_
-#define _ANDROID_LEGACY_STRINGS_INLINES_H_
+#pragma once
#include <sys/cdefs.h>
-#if defined(__i386__) && __ANDROID_API__ < __ANDROID_API_J_MR2__
+#if defined(__i386__) && __ANDROID_API__ < 18
#include <strings.h>
@@ -43,5 +42,3 @@
__END_DECLS
#endif
-
-#endif
diff --git a/libc/include/android/legacy_sys_mman_inlines.h b/libc/include/android/legacy_sys_mman_inlines.h
index 160e6fe..04b3e97 100644
--- a/libc/include/android/legacy_sys_mman_inlines.h
+++ b/libc/include/android/legacy_sys_mman_inlines.h
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
-#if __ANDROID_API__ < __ANDROID_API_L__
+#if __ANDROID_API__ < 21
#include <errno.h>
#include <sys/mman.h>
@@ -68,4 +68,4 @@
__END_DECLS
-#endif /* __ANDROID_API__ < __ANDROID_API_L__ */
+#endif
diff --git a/libc/include/android/legacy_sys_stat_inlines.h b/libc/include/android/legacy_sys_stat_inlines.h
index 9521694..d42ac01 100644
--- a/libc/include/android/legacy_sys_stat_inlines.h
+++ b/libc/include/android/legacy_sys_stat_inlines.h
@@ -26,12 +26,11 @@
* SUCH DAMAGE.
*/
-#ifndef _ANDROID_LEGACY_SYS_STAT_INLINES_H_
-#define _ANDROID_LEGACY_SYS_STAT_INLINES_H_
+#pragma once
#include <sys/cdefs.h>
-#if __ANDROID_API__ < __ANDROID_API_L__
+#if __ANDROID_API__ < 21
#include <sys/stat.h>
@@ -44,4 +43,3 @@
__END_DECLS
#endif
-#endif /* _ANDROID_LEGACY_SYS_STAT_INLINES_H_ */
diff --git a/libc/include/android/legacy_sys_wait_inlines.h b/libc/include/android/legacy_sys_wait_inlines.h
index 4298d76..eadc752 100644
--- a/libc/include/android/legacy_sys_wait_inlines.h
+++ b/libc/include/android/legacy_sys_wait_inlines.h
@@ -26,12 +26,11 @@
* SUCH DAMAGE.
*/
-#ifndef _ANDROID_LEGACY_SYS_WAIT_INLINES_H_
-#define _ANDROID_LEGACY_SYS_WAIT_INLINES_H_
+#pragma once
#include <sys/cdefs.h>
-#if __ANDROID_API__ < __ANDROID_API_J_MR2__
+#if __ANDROID_API__ < 18
#include <sys/syscall.h>
#include <sys/wait.h>
@@ -45,6 +44,4 @@
__END_DECLS
-#endif /* __ANDROID_API__ < __ANDROID_API_J_MR2__ */
-
-#endif /* _ANDROID_LEGACY_SYS_WAIT_INLINES_H_ */
+#endif
diff --git a/libc/include/android/legacy_termios_inlines.h b/libc/include/android/legacy_termios_inlines.h
index a63dba1..9ea588d 100644
--- a/libc/include/android/legacy_termios_inlines.h
+++ b/libc/include/android/legacy_termios_inlines.h
@@ -26,12 +26,11 @@
* SUCH DAMAGE.
*/
-#ifndef _ANDROID_LEGACY_TERMIOS_INLINES_H_
-#define _ANDROID_LEGACY_TERMIOS_INLINES_H_
+#pragma once
#include <sys/cdefs.h>
-#if __ANDROID_API__ < __ANDROID_API_L__
+#if __ANDROID_API__ < 21
#include <linux/termios.h>
#include <sys/ioctl.h>
@@ -41,5 +40,3 @@
#include <bits/termios_inlines.h>
#endif
-
-#endif /* _ANDROID_LEGACY_TERMIOS_INLINES_H_ */
diff --git a/libc/include/android/legacy_threads_inlines.h b/libc/include/android/legacy_threads_inlines.h
index e73ef37..c614cd0 100644
--- a/libc/include/android/legacy_threads_inlines.h
+++ b/libc/include/android/legacy_threads_inlines.h
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
-#if __ANDROID_API__ < __ANDROID_API_R__
+#if __ANDROID_API__ < 30
#define __BIONIC_THREADS_INLINE static __inline
#include <bits/threads_inlines.h>
diff --git a/libc/include/bits/fortify/fcntl.h b/libc/include/bits/fortify/fcntl.h
index 3c5a037..7063541 100644
--- a/libc/include/bits/fortify/fcntl.h
+++ b/libc/include/bits/fortify/fcntl.h
@@ -59,7 +59,7 @@
int open(const char* const __pass_object_size pathname, int flags)
__overloadable
__clang_error_if(__open_modes_useful(flags), "'open' " __open_too_few_args_error) {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __open_2(pathname, flags);
#else
return __open_real(pathname, flags);
@@ -83,7 +83,7 @@
int openat(int dirfd, const char* const __pass_object_size pathname, int flags)
__overloadable
__clang_error_if(__open_modes_useful(flags), "'openat' " __open_too_few_args_error) {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __openat_2(dirfd, pathname, flags);
#else
return __openat_real(dirfd, pathname, flags);
@@ -98,7 +98,7 @@
return __openat_real(dirfd, pathname, flags, modes);
}
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
/* Note that open == open64, so we reuse those bits in the open64 variants below. */
__BIONIC_ERROR_FUNCTION_VISIBILITY
@@ -139,7 +139,7 @@
"'openat64' " __open_useless_modes_warning) {
return openat(dirfd, pathname, flags, modes);
}
-#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
+#endif /* __ANDROID_API__ >= 21 */
#undef __open_too_many_args_error
#undef __open_too_few_args_error
diff --git a/libc/include/bits/fortify/poll.h b/libc/include/bits/fortify/poll.h
index 30fdce4..143153c 100644
--- a/libc/include/bits/fortify/poll.h
+++ b/libc/include/bits/fortify/poll.h
@@ -44,7 +44,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos(fds), sizeof(*fds) * fd_count),
"in call to 'poll', fd_count is larger than the given buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos_fds = __bos(fds);
if (!__bos_fd_count_trivially_safe(bos_fds, fds, fd_count)) {
@@ -54,13 +54,13 @@
return __call_bypassing_fortify(poll)(fds, fd_count, timeout);
}
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
__BIONIC_FORTIFY_INLINE
int ppoll(struct pollfd* const fds __pass_object_size, nfds_t fd_count, const struct timespec* timeout, const sigset_t* mask)
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos(fds), sizeof(*fds) * fd_count),
"in call to 'ppoll', fd_count is larger than the given buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos_fds = __bos(fds);
if (!__bos_fd_count_trivially_safe(bos_fds, fds, fd_count)) {
@@ -69,9 +69,9 @@
#endif
return __call_bypassing_fortify(ppoll)(fds, fd_count, timeout, mask);
}
-#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
+#endif /* __ANDROID_API__ >= 21 */
-#if __ANDROID_API__ >= __ANDROID_API_P__
+#if __ANDROID_API__ >= 28
__BIONIC_FORTIFY_INLINE
int ppoll64(struct pollfd* const fds __pass_object_size, nfds_t fd_count, const struct timespec* timeout, const sigset64_t* mask)
__overloadable
@@ -86,7 +86,7 @@
#endif
return __call_bypassing_fortify(ppoll64)(fds, fd_count, timeout, mask);
}
-#endif /* __ANDROID_API__ >= __ANDROID_API_P__ */
+#endif /* __ANDROID_API__ >= 28 */
#undef __bos_fd_count_trivially_safe
diff --git a/libc/include/bits/fortify/socket.h b/libc/include/bits/fortify/socket.h
index 30fe0d7..78d4013 100644
--- a/libc/include/bits/fortify/socket.h
+++ b/libc/include/bits/fortify/socket.h
@@ -42,7 +42,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), len),
"'recvfrom' called with size bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(buf);
if (!__bos_trivially_ge(bos, len)) {
@@ -57,7 +57,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), len),
"'sendto' called with size bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_N_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 25 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(buf);
if (!__bos_trivially_ge(bos, len)) {
diff --git a/libc/include/bits/fortify/stat.h b/libc/include/bits/fortify/stat.h
index 43fc69c..e92e6ac 100644
--- a/libc/include/bits/fortify/stat.h
+++ b/libc/include/bits/fortify/stat.h
@@ -41,7 +41,7 @@
__overloadable
__enable_if(1, "")
__clang_error_if(mode & ~0777, "'umask' called with invalid mode") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR2__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 18 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __umask_chk(mode);
#else
return __umask_real(mode);
diff --git a/libc/include/bits/fortify/stdio.h b/libc/include/bits/fortify/stdio.h
index fb503c3..42698dd 100644
--- a/libc/include/bits/fortify/stdio.h
+++ b/libc/include/bits/fortify/stdio.h
@@ -36,7 +36,7 @@
#if defined(__BIONIC_FORTIFY) && !defined(__BIONIC_NO_STDIO_FORTIFY)
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
/* No diag -- clang diagnoses misuses of this on its own. */
__BIONIC_FORTIFY_INLINE __printflike(3, 0)
int vsnprintf(char* const __pass_object_size dest, size_t size, const char* format, va_list ap)
@@ -57,7 +57,7 @@
"format string will always overflow destination buffer")
__errorattr("format string will always overflow destination buffer");
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
__BIONIC_FORTIFY_VARIADIC __printflike(2, 3)
int sprintf(char* const __pass_object_size dest, const char* format, ...) __overloadable {
va_list va;
@@ -90,7 +90,7 @@
"in call to 'fread', size * count overflows")
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), size * count),
"in call to 'fread', size * count is too large for the given buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(buf);
if (!__bos_trivially_ge_mul(bos, size, count)) {
@@ -107,7 +107,7 @@
"in call to 'fwrite', size * count overflows")
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), size * count),
"in call to 'fwrite', size * count is too large for the given buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(buf);
if (!__bos_trivially_ge_mul(bos, size, count)) {
@@ -124,7 +124,7 @@
__clang_error_if(size < 0, "in call to 'fgets', size should not be negative")
__clang_error_if(__bos_unevaluated_lt(__bos(dest), size),
"in call to 'fgets', size is larger than the destination buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos(dest);
if (!__bos_dynamic_check_impl_and(bos, >=, (size_t)size, size >= 0)) {
diff --git a/libc/include/bits/fortify/string.h b/libc/include/bits/fortify/string.h
index 7dc60f2..600ef14 100644
--- a/libc/include/bits/fortify/string.h
+++ b/libc/include/bits/fortify/string.h
@@ -40,7 +40,7 @@
#if defined(__BIONIC_FORTIFY)
extern void* __memrchr_real(const void*, int, size_t) __RENAME(memrchr);
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
/* No diag -- clang diagnoses misuses of this on its own. */
__BIONIC_FORTIFY_INLINE
void* memcpy(void* const dst __pass_object_size0, const void* src, size_t copy_amount)
@@ -64,7 +64,7 @@
#endif
#if defined(__USE_GNU)
-#if __ANDROID_API__ >= __ANDROID_API_R__
+#if __ANDROID_API__ >= 30
__BIONIC_FORTIFY_INLINE
void* mempcpy(void* const dst __pass_object_size0, const void* src, size_t copy_amount)
__overloadable
@@ -78,7 +78,7 @@
#endif
return __builtin_mempcpy(dst, src, copy_amount);
}
-#endif /* __ANDROID_API__ >= __ANDROID_API_R__ */
+#endif /* __ANDROID_API__ >= 30 */
#endif /* __USE_GNU */
__BIONIC_FORTIFY_INLINE
@@ -86,7 +86,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
"'stpcpy' called with string bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_L__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 21 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos_dst = __bos(dst);
if (!__bos_trivially_gt(bos_dst, __builtin_strlen(src))) {
return __builtin___stpcpy_chk(dst, src, bos_dst);
@@ -100,7 +100,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
"'strcpy' called with string bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos_dst = __bos(dst);
if (!__bos_trivially_gt(bos_dst, __builtin_strlen(src))) {
return __builtin___strcpy_chk(dst, src, bos_dst);
@@ -114,14 +114,14 @@
__overloadable
__clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
"'strcat' called with string bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __builtin___strcat_chk(dst, src, __bos(dst));
#else
return __builtin_strcat(dst, src);
#endif
}
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
/* No diag -- clang diagnoses misuses of this on its own. */
__BIONIC_FORTIFY_INLINE
char* strncat(char* const dst __pass_object_size, const char* src, size_t n) __overloadable {
@@ -134,7 +134,7 @@
void* memset(void* const s __pass_object_size0, int c, size_t n) __overloadable
/* If you're a user who wants this warning to go away: use `(&memset)(foo, bar, baz)`. */
__clang_warning_if(c && !n, "'memset' will set 0 bytes; maybe the arguments got flipped?") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(s);
if (!__bos_trivially_ge(bos, n)) {
return __builtin___memset_chk(s, c, n, bos);
@@ -143,7 +143,7 @@
return __builtin_memset(s, c, n);
}
-#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
__BIONIC_FORTIFY_INLINE
void* memchr(const void* const s __pass_object_size, int c, size_t n) __overloadable {
size_t bos = __bos(s);
@@ -167,7 +167,7 @@
}
#endif
-#if __ANDROID_API__ >= __ANDROID_API_L__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 21 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
/* No diag -- clang diagnoses misuses of this on its own. */
__BIONIC_FORTIFY_INLINE
char* stpncpy(char* const dst __pass_object_size, const char* const src __pass_object_size, size_t n)
@@ -204,7 +204,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos(dst), size),
"'strlcpy' called with size bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos(dst);
if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
@@ -219,7 +219,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos(dst), size),
"'strlcat' called with size bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos(dst);
if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
@@ -231,7 +231,7 @@
__BIONIC_FORTIFY_INLINE
size_t strlen(const char* const s __pass_object_size0) __overloadable {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(s);
if (!__bos_trivially_gt(bos, __builtin_strlen(s))) {
@@ -243,7 +243,7 @@
__BIONIC_FORTIFY_INLINE
char* strchr(const char* const s __pass_object_size, int c) __overloadable {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR2__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 18 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos(s);
if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
@@ -255,7 +255,7 @@
__BIONIC_FORTIFY_INLINE
char* strrchr(const char* const s __pass_object_size, int c) __overloadable {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR2__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 18 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos(s);
if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
@@ -265,7 +265,7 @@
return __builtin_strrchr(s, c);
}
-#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
#if defined(__cplusplus)
extern "C++" {
__BIONIC_FORTIFY_INLINE
@@ -284,6 +284,6 @@
return __memrchr_fortify(s, c, n);
}
#endif
-#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
+#endif /* __ANDROID_API__ >= 23 */
#endif /* defined(__BIONIC_FORTIFY) */
diff --git a/libc/include/bits/fortify/strings.h b/libc/include/bits/fortify/strings.h
index 1ebaf39..65fc5f1 100644
--- a/libc/include/bits/fortify/strings.h
+++ b/libc/include/bits/fortify/strings.h
@@ -33,7 +33,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos0(dst), len),
"'bcopy' called with size bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(dst);
if (!__bos_trivially_ge(bos, len)) {
__builtin___memmove_chk(dst, src, len, bos);
@@ -48,7 +48,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos0(b), len),
"'bzero' called with size bigger than buffer") {
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(b);
if (!__bos_trivially_ge(bos, len)) {
__builtin___memset_chk(b, 0, len, bos);
diff --git a/libc/include/bits/fortify/unistd.h b/libc/include/bits/fortify/unistd.h
index f1580ce..49a3946 100644
--- a/libc/include/bits/fortify/unistd.h
+++ b/libc/include/bits/fortify/unistd.h
@@ -73,7 +73,7 @@
char* getcwd(char* const __pass_object_size buf, size_t size)
__overloadable
__error_if_overflows_objectsize(size, __bos(buf), getcwd) {
-#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos(buf);
if (!__bos_trivially_ge(bos, size)) {
@@ -89,7 +89,7 @@
__overloadable
__error_if_overflows_ssizet(count, pread)
__error_if_overflows_objectsize(count, __bos0(buf), pread) {
-#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(buf);
if (!__bos_trivially_ge_no_overflow(bos, count)) {
@@ -105,7 +105,7 @@
__overloadable
__error_if_overflows_ssizet(count, pread64)
__error_if_overflows_objectsize(count, __bos0(buf), pread64) {
-#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(buf);
if (!__bos_trivially_ge_no_overflow(bos, count)) {
@@ -121,7 +121,7 @@
__overloadable
__error_if_overflows_ssizet(count, pwrite)
__error_if_overflows_objectsize(count, __bos0(buf), pwrite) {
-#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(buf);
if (!__bos_trivially_ge_no_overflow(bos, count)) {
@@ -137,7 +137,7 @@
__overloadable
__error_if_overflows_ssizet(count, pwrite64)
__error_if_overflows_objectsize(count, __bos0(buf), pwrite64) {
-#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(buf);
if (!__bos_trivially_ge_no_overflow(bos, count)) {
@@ -152,7 +152,7 @@
__overloadable
__error_if_overflows_ssizet(count, read)
__error_if_overflows_objectsize(count, __bos0(buf), read) {
-#if __ANDROID_API__ >= __ANDROID_API_L__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 21 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(buf);
if (!__bos_trivially_ge_no_overflow(bos, count)) {
@@ -167,7 +167,7 @@
__overloadable
__error_if_overflows_ssizet(count, write)
__error_if_overflows_objectsize(count, __bos0(buf), write) {
-#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(buf);
if (!__bos_trivially_ge_no_overflow(bos, count)) {
@@ -182,7 +182,7 @@
__overloadable
__error_if_overflows_ssizet(size, readlink)
__error_if_overflows_objectsize(size, __bos(buf), readlink) {
-#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos(buf);
if (!__bos_trivially_ge_no_overflow(bos, size)) {
@@ -192,13 +192,13 @@
return __call_bypassing_fortify(readlink)(path, buf, size);
}
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
__BIONIC_FORTIFY_INLINE
ssize_t readlinkat(int dirfd, const char* path, char* const __pass_object_size buf, size_t size)
__overloadable
__error_if_overflows_ssizet(size, readlinkat)
__error_if_overflows_objectsize(size, __bos(buf), readlinkat) {
-#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos(buf);
if (!__bos_trivially_ge_no_overflow(bos, size)) {
@@ -207,7 +207,7 @@
#endif
return __call_bypassing_fortify(readlinkat)(dirfd, path, buf, size);
}
-#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
+#endif /* __ANDROID_API__ >= 21 */
#undef __bos_trivially_ge_no_overflow
#undef __enable_if_no_overflow_ssizet
diff --git a/libc/include/bits/pthread_types.h b/libc/include/bits/pthread_types.h
index a173e3c..f359696 100644
--- a/libc/include/bits/pthread_types.h
+++ b/libc/include/bits/pthread_types.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef _BITS_PTHREAD_TYPES_H_
-#define _BITS_PTHREAD_TYPES_H_
+#pragma once
#include <sys/cdefs.h>
#include <sys/types.h>
@@ -44,7 +43,7 @@
#endif
} pthread_attr_t;
-#if __ANDROID_API__ >= __ANDROID_API_N__
+#if __ANDROID_API__ >= 24
typedef struct {
#if defined(__LP64__)
int64_t __private[4];
@@ -54,7 +53,7 @@
} pthread_barrier_t;
#endif
-#if __ANDROID_API__ >= __ANDROID_API_N__
+#if __ANDROID_API__ >= 24
typedef int pthread_barrierattr_t;
#endif
@@ -92,7 +91,7 @@
typedef long pthread_rwlockattr_t;
-#if __ANDROID_API__ >= __ANDROID_API_N__
+#if __ANDROID_API__ >= 24
typedef struct {
#if defined(__LP64__)
int64_t __private;
@@ -103,5 +102,3 @@
#endif
typedef long pthread_t;
-
-#endif
diff --git a/libc/include/bits/threads_inlines.h b/libc/include/bits/threads_inlines.h
index 8f2beb0..afaed64 100644
--- a/libc/include/bits/threads_inlines.h
+++ b/libc/include/bits/threads_inlines.h
@@ -103,7 +103,7 @@
return __bionic_thrd_error(pthread_mutex_lock(__mtx));
}
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
__BIONIC_THREADS_INLINE int mtx_timedlock(mtx_t* __mtx,
const struct timespec* __timeout) {
return __bionic_thrd_error(pthread_mutex_timedlock(__mtx, __timeout));
diff --git a/libc/include/ctype.h b/libc/include/ctype.h
index e7df299..61fb476 100644
--- a/libc/include/ctype.h
+++ b/libc/include/ctype.h
@@ -124,7 +124,7 @@
*/
int _toupper(int __ch) __INTRODUCED_IN(21);
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
/** Like isalnum but with an ignored `locale_t`. */
int isalnum_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
/** Like isalpha but with an ignored `locale_t`. */
diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h
index c45c91f..23a58d6 100644
--- a/libc/include/fcntl.h
+++ b/libc/include/fcntl.h
@@ -66,7 +66,7 @@
/** Flag for open(). */
#define O_RSYNC O_SYNC
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
/** Flag for splice(). */
#define SPLICE_F_MOVE 1
/** Flag for splice(). */
@@ -77,7 +77,7 @@
#define SPLICE_F_GIFT 8
#endif
-#if __ANDROID_API__ >= __ANDROID_API_O__
+#if __ANDROID_API__ >= 26
/** Flag for sync_file_range(). */
#define SYNC_FILE_RANGE_WAIT_BEFORE 1
/** Flag for sync_file_range(). */
diff --git a/libc/include/fenv.h b/libc/include/fenv.h
index 90ac805..fd78a48 100644
--- a/libc/include/fenv.h
+++ b/libc/include/fenv.h
@@ -44,7 +44,7 @@
__BEGIN_DECLS
// fenv was always available on x86.
-#if __ANDROID_API__ >= __ANDROID_API_L__ || defined(__i386__)
+#if __ANDROID_API__ >= 21 || defined(__i386__)
int feclearexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
int fegetexceptflag(fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
int feraiseexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
diff --git a/libc/include/netinet/in.h b/libc/include/netinet/in.h
index 1c9961c..7f00a7a 100644
--- a/libc/include/netinet/in.h
+++ b/libc/include/netinet/in.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef _NETINET_IN_H_
-#define _NETINET_IN_H_
+#pragma once
#include <endian.h>
#include <netinet/in6.h>
@@ -46,14 +45,12 @@
int bindresvport(int __fd, struct sockaddr_in* __sin);
-#if __ANDROID_API__ >= __ANDROID_API_N__
+#if __ANDROID_API__ >= 24
extern const struct in6_addr in6addr_any __INTRODUCED_IN(24);
extern const struct in6_addr in6addr_loopback __INTRODUCED_IN(24);
#else
static const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
static const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
-#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
+#endif
__END_DECLS
-
-#endif
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index b549871..331e92c 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -54,7 +54,7 @@
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP { { ((PTHREAD_MUTEX_ERRORCHECK & 3) << 14) } }
#define PTHREAD_COND_INITIALIZER { { 0 } }
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
#define PTHREAD_COND_INITIALIZER_MONOTONIC_NP { { 1 << 1 } }
#endif
@@ -67,7 +67,7 @@
#define PTHREAD_ONCE_INIT 0
-#if __ANDROID_API__ >= __ANDROID_API_N__
+#if __ANDROID_API__ >= 24
#define PTHREAD_BARRIER_SERIAL_THREAD -1
#endif
@@ -254,20 +254,20 @@
int pthread_rwlock_unlock(pthread_rwlock_t* __rwlock);
int pthread_rwlock_wrlock(pthread_rwlock_t* __rwlock);
-#if __ANDROID_API__ >= __ANDROID_API_N__
+#if __ANDROID_API__ >= 24
int pthread_barrierattr_init(pthread_barrierattr_t* __attr) __INTRODUCED_IN(24);
int pthread_barrierattr_destroy(pthread_barrierattr_t* __attr) __INTRODUCED_IN(24);
int pthread_barrierattr_getpshared(const pthread_barrierattr_t* __attr, int* __shared) __INTRODUCED_IN(24);
int pthread_barrierattr_setpshared(pthread_barrierattr_t* __attr, int __shared) __INTRODUCED_IN(24);
#endif
-#if __ANDROID_API__ >= __ANDROID_API_N__
+#if __ANDROID_API__ >= 24
int pthread_barrier_init(pthread_barrier_t* __barrier, const pthread_barrierattr_t* __attr, unsigned __count) __INTRODUCED_IN(24);
int pthread_barrier_destroy(pthread_barrier_t* __barrier) __INTRODUCED_IN(24);
int pthread_barrier_wait(pthread_barrier_t* __barrier) __INTRODUCED_IN(24);
#endif
-#if __ANDROID_API__ >= __ANDROID_API_N__
+#if __ANDROID_API__ >= 24
int pthread_spin_destroy(pthread_spinlock_t* __spinlock) __INTRODUCED_IN(24);
int pthread_spin_init(pthread_spinlock_t* __spinlock, int __shared) __INTRODUCED_IN(24);
int pthread_spin_lock(pthread_spinlock_t* __spinlock) __INTRODUCED_IN(24);
diff --git a/libc/include/signal.h b/libc/include/signal.h
index cd11656..532e4a5 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -64,7 +64,7 @@
int siginterrupt(int __signal, int __flag);
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
sighandler_t signal(int __signal, sighandler_t __handler) __INTRODUCED_IN(21);
int sigaddset(sigset_t* __set, int __signal) __INTRODUCED_IN(21);
int sigaddset64(sigset64_t* __set, int __signal) __INTRODUCED_IN(28);
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 6632c01..1bf578c 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -46,7 +46,7 @@
#include <bits/seek_constants.h>
-#if __ANDROID_API__ < __ANDROID_API_N__
+#if __ANDROID_API__ < 24
#include <bits/struct_file.h>
#endif
@@ -58,7 +58,7 @@
struct __sFILE;
typedef struct __sFILE FILE;
-#if __ANDROID_API__ >= __ANDROID_API_M__
+#if __ANDROID_API__ >= 23
extern FILE* stdin __INTRODUCED_IN(23);
extern FILE* stdout __INTRODUCED_IN(23);
extern FILE* stderr __INTRODUCED_IN(23);
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index b66e3c6..dc7b694 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -43,7 +43,7 @@
__noreturn void abort(void);
__noreturn void exit(int __status);
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
__noreturn void _Exit(int __status) __INTRODUCED_IN(21);
#else
__noreturn void _Exit(int) __RENAME(_exit);
@@ -167,7 +167,7 @@
size_t wcstombs(char* __dst, const wchar_t* __src, size_t __n);
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
size_t __ctype_get_mb_cur_max(void) __INTRODUCED_IN(21);
#define MB_CUR_MAX __ctype_get_mb_cur_max()
#else
@@ -183,7 +183,7 @@
#include <bits/fortify/stdlib.h>
#endif
-#if __ANDROID_API__ >= __ANDROID_API_K__
+#if __ANDROID_API__ >= 19
int abs(int __x) __attribute_const__ __INTRODUCED_IN(19);
long labs(long __x) __attribute_const__ __INTRODUCED_IN(19);
long long llabs(long long __x) __attribute_const__ __INTRODUCED_IN(19);
@@ -191,7 +191,7 @@
// Implemented as static inlines before 19.
#endif
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
float strtof(const char* __s, char** __end_ptr) __INTRODUCED_IN(21);
double atof(const char* __s) __attribute_pure__ __INTRODUCED_IN(21);
int rand(void) __INTRODUCED_IN(21);
@@ -207,7 +207,7 @@
// Implemented as static inlines before 21.
#endif
-#if __ANDROID_API__ >= __ANDROID_API_O__
+#if __ANDROID_API__ >= 26
double strtod_l(const char* __s, char** __end_ptr, locale_t __l) __INTRODUCED_IN(26);
float strtof_l(const char* __s, char** __end_ptr, locale_t __l) __INTRODUCED_IN(26);
long strtol_l(const char* __s, char** __end_ptr, int, locale_t __l) __INTRODUCED_IN(26);
diff --git a/libc/include/string.h b/libc/include/string.h
index 25f6673..0cc5611 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
@@ -119,7 +119,7 @@
int strcoll(const char* __lhs, const char* __rhs) __attribute_pure__;
size_t strxfrm(char* __dst, const char* __src, size_t __n);
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
int strcoll_l(const char* __lhs, const char* __rhs, locale_t __l) __attribute_pure__ __INTRODUCED_IN(21);
size_t strxfrm_l(char* __dst, const char* __src, size_t __n, locale_t __l) __INTRODUCED_IN(21);
#else
diff --git a/libc/include/strings.h b/libc/include/strings.h
index d6ee1c8..08c2326 100644
--- a/libc/include/strings.h
+++ b/libc/include/strings.h
@@ -63,7 +63,7 @@
__builtin_memset(b, 0, len);
}
-#if !defined(__i386__) || __ANDROID_API__ >= __ANDROID_API_J_MR2__
+#if !defined(__i386__) || __ANDROID_API__ >= 18
/**
* [ffs(3)](http://man7.org/linux/man-pages/man3/ffs.3.html) finds the first set bit in `__i`.
*
diff --git a/libc/include/sys/epoll.h b/libc/include/sys/epoll.h
index a213a90..3745737 100644
--- a/libc/include/sys/epoll.h
+++ b/libc/include/sys/epoll.h
@@ -51,7 +51,7 @@
* https://github.com/android-ndk/ndk/issues/302
* https://github.com/android-ndk/ndk/issues/394
*/
-#if __ANDROID_API__ < __ANDROID_API_L__ && defined(EPOLL_CLOEXEC)
+#if __ANDROID_API__ < 21 && defined(EPOLL_CLOEXEC)
#undef EPOLL_CLOEXEC
#endif
diff --git a/libc/include/sys/inotify.h b/libc/include/sys/inotify.h
index 32e16d9..37fbf99 100644
--- a/libc/include/sys/inotify.h
+++ b/libc/include/sys/inotify.h
@@ -48,7 +48,7 @@
*
* https://github.com/android-ndk/ndk/issues/394
*/
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
#define IN_CLOEXEC O_CLOEXEC
#define IN_NONBLOCK O_NONBLOCK
#endif
diff --git a/libc/include/sys/mman.h b/libc/include/sys/mman.h
index 3b83229..fe4ea7f 100644
--- a/libc/include/sys/mman.h
+++ b/libc/include/sys/mman.h
@@ -54,7 +54,7 @@
void* mmap(void* __addr, size_t __size, int __prot, int __flags, int __fd, off_t __offset);
#endif
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
/**
* mmap64() is a variant of mmap() that takes a 64-bit offset even on LP32.
*
@@ -173,7 +173,7 @@
#endif
-#if __ANDROID_API__ >= __ANDROID_API_M__
+#if __ANDROID_API__ >= 23
/*
* Some third-party code uses the existence of POSIX_MADV_NORMAL to detect the
diff --git a/libc/include/sys/select.h b/libc/include/sys/select.h
index 1ee8d2a..79fc28d 100644
--- a/libc/include/sys/select.h
+++ b/libc/include/sys/select.h
@@ -79,7 +79,7 @@
#define __FD_SET(fd, set) (__FDS_BITS(fd_set*,set)[__FDELT(fd)] |= __FDMASK(fd))
#define __FD_ISSET(fd, set) ((__FDS_BITS(const fd_set*,set)[__FDELT(fd)] & __FDMASK(fd)) != 0)
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
/** Removes `fd` from the given set. Use <poll.h> instead. */
#define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set))
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index e54dd65..e2acab7 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -112,7 +112,7 @@
? (struct cmsghdr*) (msg)->msg_control : (struct cmsghdr*) NULL)
#define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && (cmsg)->cmsg_len <= (unsigned long) ((mhdr)->msg_controllen - ((char*)(cmsg) - (char*)(mhdr)->msg_control)))
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
struct cmsghdr* __cmsg_nxthdr(struct msghdr* __msg, struct cmsghdr* __cmsg) __INTRODUCED_IN(21);
#else
/* TODO(danalbert): Move this into libandroid_support. */
@@ -127,7 +127,7 @@
}
return ptr;
}
-#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
+#endif
#define SCM_RIGHTS 0x01
#define SCM_CREDENTIALS 0x02
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index 79113b6..d8e92d9 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -171,7 +171,7 @@
#include <bits/fortify/stat.h>
#endif
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
int mkfifo(const char* __path, mode_t __mode) __INTRODUCED_IN(21);
#else
// Implemented as a static inline before 21.
diff --git a/libc/include/sys/wait.h b/libc/include/sys/wait.h
index 106946b..8c0655f 100644
--- a/libc/include/sys/wait.h
+++ b/libc/include/sys/wait.h
@@ -40,7 +40,7 @@
pid_t wait(int* __status);
pid_t waitpid(pid_t __pid, int* __status, int __options);
-#if __ANDROID_API__ >= __ANDROID_API_J_MR2__
+#if __ANDROID_API__ >= 18
pid_t wait4(pid_t __pid, int* __status, int __options, struct rusage* __rusage) __INTRODUCED_IN(18);
#else
// Implemented as a static inline before 18.
diff --git a/libc/include/termios.h b/libc/include/termios.h
index 0fd5c95..8eca96e 100644
--- a/libc/include/termios.h
+++ b/libc/include/termios.h
@@ -40,7 +40,7 @@
__BEGIN_DECLS
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
// This file is implemented as static inlines before API level 21.
/**
diff --git a/libc/include/threads.h b/libc/include/threads.h
index 752761d..1b00b8f 100644
--- a/libc/include/threads.h
+++ b/libc/include/threads.h
@@ -78,7 +78,7 @@
__BEGIN_DECLS
-#if __ANDROID_API__ >= __ANDROID_API_R__
+#if __ANDROID_API__ >= 30
// This file is implemented as static inlines before API level 30.
/** Uses `__flag` to ensure that `__function` is called exactly once. */
diff --git a/libc/include/time.h b/libc/include/time.h
index a7a6fe5..0db14ff 100644
--- a/libc/include/time.h
+++ b/libc/include/time.h
@@ -78,7 +78,7 @@
char* strptime_l(const char* __s, const char* __fmt, struct tm* __tm, locale_t __l) __strftimelike(2) __INTRODUCED_IN(28);
size_t strftime(char* __buf, size_t __n, const char* __fmt, const struct tm* __tm) __strftimelike(3);
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
size_t strftime_l(char* __buf, size_t __n, const char* __fmt, const struct tm* __tm, locale_t __l) __strftimelike(3) __INTRODUCED_IN(21);
#else
// Implemented as static inline before 21.
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index 7c01549..e4afd8e 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -282,7 +282,7 @@
int acct(const char* __path);
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
int getpagesize(void) __INTRODUCED_IN(21);
#else
static __inline__ int getpagesize(void) {
diff --git a/libc/include/wchar.h b/libc/include/wchar.h
index f33af5f..f0966de 100644
--- a/libc/include/wchar.h
+++ b/libc/include/wchar.h
@@ -121,7 +121,7 @@
int wprintf(const wchar_t* __fmt, ...);
int wscanf(const wchar_t* __fmt, ...);
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
long long wcstoll_l(const wchar_t* __s, wchar_t** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(21);
unsigned long long wcstoull_l(const wchar_t* __s, wchar_t** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(21);
long double wcstold_l(const wchar_t* __s, wchar_t** __end_ptr, locale_t __l) __INTRODUCED_IN(21);
diff --git a/libc/include/wctype.h b/libc/include/wctype.h
index 18f5c4b..58510ae 100644
--- a/libc/include/wctype.h
+++ b/libc/include/wctype.h
@@ -35,7 +35,7 @@
__BEGIN_DECLS
-#if __ANDROID_API__ >= __ANDROID_API_L__
+#if __ANDROID_API__ >= 21
int iswalnum_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
int iswalpha_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
int iswblank_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
diff --git a/linker/linker.cpp b/linker/linker.cpp
index fb22a1d..54e0703 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -209,7 +209,7 @@
};
// If you're targeting N, you don't get the greylist.
- if (g_greylist_disabled || get_application_target_sdk_version() >= __ANDROID_API_N__) {
+ if (g_greylist_disabled || get_application_target_sdk_version() >= 24) {
return false;
}
@@ -252,7 +252,7 @@
// New mapping for new apex should be added below
// Nothing to do if target sdk version is Q or above
- if (get_application_target_sdk_version() >= __ANDROID_API_Q__) {
+ if (get_application_target_sdk_version() >= 29) {
return false;
}
@@ -943,8 +943,7 @@
// Do not skip RTLD_LOCAL libraries in dlsym(RTLD_DEFAULT, ...)
// if the library is opened by application with target api level < M.
// See http://b/21565766
- if ((si->get_rtld_flags() & RTLD_GLOBAL) == 0 &&
- si->get_target_sdk_version() >= __ANDROID_API_M__) {
+ if ((si->get_rtld_flags() & RTLD_GLOBAL) == 0 && si->get_target_sdk_version() >= 23) {
continue;
}
@@ -1232,10 +1231,10 @@
#if !defined(__LP64__)
// Work around incorrect DT_NEEDED entries for old apps: http://b/21364029
int app_target_api_level = get_application_target_sdk_version();
- if (app_target_api_level < __ANDROID_API_M__) {
+ if (app_target_api_level < 23) {
const char* bname = basename(dt_needed);
if (bname != dt_needed) {
- DL_WARN_documented_change(__ANDROID_API_M__,
+ DL_WARN_documented_change(23,
"invalid-dt_needed-entries-enforced-for-api-level-23",
"library \"%s\" has invalid DT_NEEDED entry \"%s\"",
sopath, dt_needed, app_target_api_level);
@@ -1384,7 +1383,7 @@
const soinfo* needed_or_dlopened_by = task->get_needed_by();
const char* sopath = needed_or_dlopened_by == nullptr ? "(unknown)" :
needed_or_dlopened_by->get_realpath();
- DL_WARN_documented_change(__ANDROID_API_N__,
+ DL_WARN_documented_change(24,
"private-api-enforced-for-api-level-24",
"library \"%s\" (\"%s\") needed or dlopened by \"%s\" "
"is not accessible by namespace \"%s\"",
@@ -3832,9 +3831,9 @@
if (soname_ == nullptr &&
this != solist_get_somain() &&
(flags_ & FLAG_LINKER) == 0 &&
- get_application_target_sdk_version() < __ANDROID_API_M__) {
+ get_application_target_sdk_version() < 23) {
soname_ = basename(realpath_.c_str());
- DL_WARN_documented_change(__ANDROID_API_M__,
+ DL_WARN_documented_change(23,
"missing-soname-enforced-for-api-level-23",
"\"%s\" has no DT_SONAME (will use %s instead)",
get_realpath(), soname_);
@@ -3875,7 +3874,7 @@
if (has_text_relocations) {
// Fail if app is targeting M or above.
int app_target_api_level = get_application_target_sdk_version();
- if (app_target_api_level >= __ANDROID_API_M__) {
+ if (app_target_api_level >= 23) {
DL_ERR_AND_LOG("\"%s\" has text relocations (https://android.googlesource.com/platform/"
"bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-"
"Enforced-for-API-level-23)", get_realpath());
@@ -3883,7 +3882,7 @@
}
// Make segments writable to allow text relocations to work properly. We will later call
// phdr_table_protect_segments() after all of them are applied.
- DL_WARN_documented_change(__ANDROID_API_M__,
+ DL_WARN_documented_change(23,
"Text-Relocations-Enforced-for-API-level-23",
"\"%s\" has text relocations",
get_realpath());
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp
index 3534287..da2d03c 100644
--- a/linker/linker_phdr.cpp
+++ b/linker/linker_phdr.cpp
@@ -264,12 +264,12 @@
if (header_.e_shentsize != sizeof(ElfW(Shdr))) {
// Fail if app is targeting Android O or above
- if (get_application_target_sdk_version() >= __ANDROID_API_O__) {
+ if (get_application_target_sdk_version() >= 26) {
DL_ERR_AND_LOG("\"%s\" has unsupported e_shentsize: 0x%x (expected 0x%zx)",
name_.c_str(), header_.e_shentsize, sizeof(ElfW(Shdr)));
return false;
}
- DL_WARN_documented_change(__ANDROID_API_O__,
+ DL_WARN_documented_change(26,
"invalid-elf-header_section-headers-enforced-for-api-level-26",
"\"%s\" has unsupported e_shentsize 0x%x (expected 0x%zx)",
name_.c_str(), header_.e_shentsize, sizeof(ElfW(Shdr)));
@@ -278,12 +278,12 @@
if (header_.e_shstrndx == 0) {
// Fail if app is targeting Android O or above
- if (get_application_target_sdk_version() >= __ANDROID_API_O__) {
+ if (get_application_target_sdk_version() >= 26) {
DL_ERR_AND_LOG("\"%s\" has invalid e_shstrndx", name_.c_str());
return false;
}
- DL_WARN_documented_change(__ANDROID_API_O__,
+ DL_WARN_documented_change(26,
"invalid-elf-header_section-headers-enforced-for-api-level-26",
"\"%s\" has invalid e_shstrndx", name_.c_str());
add_dlwarning(name_.c_str(), "has invalid ELF header");
@@ -392,7 +392,7 @@
}
if (pt_dynamic_offset != dynamic_shdr->sh_offset) {
- if (get_application_target_sdk_version() >= __ANDROID_API_O__) {
+ if (get_application_target_sdk_version() >= 26) {
DL_ERR_AND_LOG("\"%s\" .dynamic section has invalid offset: 0x%zx, "
"expected to match PT_DYNAMIC offset: 0x%zx",
name_.c_str(),
@@ -400,7 +400,7 @@
pt_dynamic_offset);
return false;
}
- DL_WARN_documented_change(__ANDROID_API_O__,
+ DL_WARN_documented_change(26,
"invalid-elf-header_section-headers-enforced-for-api-level-26",
"\"%s\" .dynamic section has invalid offset: 0x%zx "
"(expected to match PT_DYNAMIC offset 0x%zx)",
@@ -411,7 +411,7 @@
}
if (pt_dynamic_filesz != dynamic_shdr->sh_size) {
- if (get_application_target_sdk_version() >= __ANDROID_API_O__) {
+ if (get_application_target_sdk_version() >= 26) {
DL_ERR_AND_LOG("\"%s\" .dynamic section has invalid size: 0x%zx, "
"expected to match PT_DYNAMIC filesz: 0x%zx",
name_.c_str(),
@@ -419,7 +419,7 @@
pt_dynamic_filesz);
return false;
}
- DL_WARN_documented_change(__ANDROID_API_O__,
+ DL_WARN_documented_change(26,
"invalid-elf-header_section-headers-enforced-for-api-level-26",
"\"%s\" .dynamic section has invalid size: 0x%zx "
"(expected to match PT_DYNAMIC filesz 0x%zx)",
@@ -635,11 +635,11 @@
int prot = PFLAGS_TO_PROT(phdr->p_flags);
if ((prot & (PROT_EXEC | PROT_WRITE)) == (PROT_EXEC | PROT_WRITE)) {
// W + E PT_LOAD segments are not allowed in O.
- if (get_application_target_sdk_version() >= __ANDROID_API_O__) {
+ if (get_application_target_sdk_version() >= 26) {
DL_ERR_AND_LOG("\"%s\": W+E load segments are not allowed", name_.c_str());
return false;
}
- DL_WARN_documented_change(__ANDROID_API_O__,
+ DL_WARN_documented_change(26,
"writable-and-executable-segments-enforced-for-api-level-26",
"\"%s\" has load segments that are both writable and executable",
name_.c_str());
diff --git a/linker/linker_soinfo.cpp b/linker/linker_soinfo.cpp
index c71945a..04aa27b 100644
--- a/linker/linker_soinfo.cpp
+++ b/linker/linker_soinfo.cpp
@@ -754,7 +754,7 @@
}
void* soinfo::to_handle() {
- if (get_application_target_sdk_version() < __ANDROID_API_N__ || !has_min_version(3)) {
+ if (get_application_target_sdk_version() < 24 || !has_min_version(3)) {
return this;
}
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index 0b4cacb..a2b5b3c 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -230,9 +230,9 @@
dlclose(handle);
}
-TEST(dlfcn, dlopen_from_nullptr_android_api_level) {
+TEST(dlfcn, dlopen_from_nullptr_android_api_level_28) {
// Regression test for http://b/123972211. Testing dlopen(nullptr) when target sdk is P
- android_set_application_target_sdk_version(__ANDROID_API_P__);
+ android_set_application_target_sdk_version(28);
ASSERT_TRUE(dlopen(nullptr, RTLD_NOW) != nullptr);
}
@@ -1229,7 +1229,7 @@
extinfo.library_namespace = ns;
// An app targeting M can open libnativehelper.so because it's on the greylist.
- android_set_application_target_sdk_version(__ANDROID_API_M__);
+ android_set_application_target_sdk_version(23);
void* handle = android_dlopen_ext("libnativehelper.so", RTLD_NOW, &extinfo);
ASSERT_TRUE(handle != nullptr) << dlerror();
@@ -1241,7 +1241,7 @@
dlclose(handle);
// An app targeting N no longer has the greylist.
- android_set_application_target_sdk_version(__ANDROID_API_N__);
+ android_set_application_target_sdk_version(24);
handle = android_dlopen_ext("libnativehelper.so", RTLD_NOW, &extinfo);
ASSERT_TRUE(handle == nullptr);
ASSERT_STREQ("dlopen failed: library \"libnativehelper.so\" not found", dlerror());
@@ -1266,7 +1266,7 @@
extinfo.flags = ANDROID_DLEXT_USE_NAMESPACE;
extinfo.library_namespace = ns;
- android_set_application_target_sdk_version(__ANDROID_API_M__);
+ android_set_application_target_sdk_version(23);
void* handle = android_dlopen_ext("libnativehelper.so", RTLD_NOW, &extinfo);
ASSERT_TRUE(handle == nullptr);
ASSERT_STREQ("dlopen failed: library \"libnativehelper.so\" not found", dlerror());
@@ -2063,7 +2063,7 @@
}
TEST(dlext, dlopen_handle_value_app_compat) {
- android_set_application_target_sdk_version(__ANDROID_API_M__);
+ android_set_application_target_sdk_version(23);
void* handle = dlopen("libtest_dlsym_from_this.so", RTLD_NOW | RTLD_LOCAL);
ASSERT_TRUE(reinterpret_cast<uintptr_t>(handle) % sizeof(uintptr_t) == 0)
<< "dlopen should return valid pointer";
diff --git a/tests/grp_pwd_test.cpp b/tests/grp_pwd_test.cpp
index 6b49e29..9c6b0c5 100644
--- a/tests/grp_pwd_test.cpp
+++ b/tests/grp_pwd_test.cpp
@@ -407,7 +407,7 @@
// TODO(73062966): We still don't have a good way to create vendor AIDs in the system or other
// non-vendor partitions, therefore we keep this check disabled.
- if (android::base::GetIntProperty("ro.product.first_api_level", 0) <= __ANDROID_API_Q__) {
+ if (android::base::GetIntProperty("ro.product.first_api_level", 0) <= 29) {
return;
}
diff --git a/tests/semaphore_test.cpp b/tests/semaphore_test.cpp
index 5a23b96..6ec8b2a 100644
--- a/tests/semaphore_test.cpp
+++ b/tests/semaphore_test.cpp
@@ -214,7 +214,7 @@
TEST(semaphore, sem_wait_no_EINTR_in_sdk_less_equal_than_23) {
#if defined(__BIONIC__)
- android_set_application_target_sdk_version(__ANDROID_API_M__);
+ android_set_application_target_sdk_version(23);
sem_t s;
ASSERT_EQ(0, sem_init(&s, 0, 0));
ScopedSignalHandler handler(SIGUSR1, sem_wait_test_signal_handler);