diff options
author | Elliott Hughes <enh@google.com> | 2019-10-07 20:51:00 +0000 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2019-10-08 12:36:22 -0700 |
commit | 9823c926b2d3938b4645d347f570ff516fb8dc98 (patch) | |
tree | 72d3eee47f4e4a02d561fa253c9f0ba25f205f51 /libc/include/android/api-level.h | |
parent | 29ec2881a0a87ccda75c77fd967934d863d53cc1 (diff) |
Restore __ANDROID_NDK__.
At heart a revert of "Don't #define __ANDROID_NDK__ for the platform build!",
which was commit eb6143037423a241ba8035304936149b300f7a5d.
The original change was insufficiently motivated, and meant that the
NDK -- not just the platform -- no longer defines __ANDROID_NDK__. Which
then broke at least building toybox with NDK r19.
Change-Id: Ic616688e4d17d25714a9ef381269d7431deac9b0
Diffstat (limited to 'libc/include/android/api-level.h')
-rw-r--r-- | libc/include/android/api-level.h | 59 |
1 files changed, 39 insertions, 20 deletions
diff --git a/libc/include/android/api-level.h b/libc/include/android/api-level.h index af7cde1e3..4a3d05207 100644 --- a/libc/include/android/api-level.h +++ b/libc/include/android/api-level.h @@ -37,70 +37,89 @@ __BEGIN_DECLS -#ifndef __ANDROID_API_FUTURE__ /** * Magic version number for an Android OS build which has * not yet turned into an official release, - * for comparisons against __ANDROID_API__. + * for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_FUTURE__ 10000 -#endif +/* This #ifndef should never be true except when doxygen is generating docs. */ #ifndef __ANDROID_API__ /** * `__ANDROID_API__` is the API level being targeted. For the OS, * this is `__ANDROID_API_FUTURE__`. For the NDK, this is set by the - * compiler/build system based on the API level you claimed to target. + * compiler system based on the API level you claimed to target. */ #define __ANDROID_API__ __ANDROID_API_FUTURE__ #endif -/** Names the Gingerbread API level (9), for comparisons against __ANDROID_API__. */ +#if __ANDROID_API__ != __ANDROID_API_FUTURE__ +/** + * `__ANDROID_NDK__` is defined for code that's built by the NDK + * rather than as part of the OS. "Built by the NDK" is an ambiguous idea, + * so you might prefer to check `__ANDROID__`, `__BIONIC__`, `__linux__`, + * or `__NDK_MAJOR__` instead, depending on exactly what you're trying to say. + * + * `__ANDROID_NDK__` is intended to capture "this code is being built for + * Android, but targeting a specific API level". This is true for all code built + * by the NDK proper, but also for OS code that sets `sdk_version` in its build + * file. This distinction might matter to you if, for example, your code could + * be built as part of an app *or* as part of the OS. + */ +#define __ANDROID_NDK__ 1 +#endif + +/** Names the Gingerbread API level (9), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_G__ 9 -/** Names the Ice-Cream Sandwich API level (14), for comparisons against __ANDROID_API__. */ +/** Names the Ice-Cream Sandwich API level (14), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_I__ 14 -/** Names the Jellybean API level (16), for comparisons against __ANDROID_API__. */ +/** Names the Jellybean API level (16), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_J__ 16 -/** Names the Jellybean MR1 API level (17), for comparisons against __ANDROID_API__. */ +/** Names the Jellybean MR1 API level (17), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_J_MR1__ 17 -/** Names the Jellybean MR2 API level (18), for comparisons against __ANDROID_API__. */ +/** Names the Jellybean MR2 API level (18), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_J_MR2__ 18 -/** Names the KitKat API level (19), for comparisons against __ANDROID_API__. */ +/** Names the KitKat API level (19), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_K__ 19 -/** Names the Lollipop API level (21), for comparisons against __ANDROID_API__. */ +/** Names the Lollipop API level (21), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_L__ 21 -/** Names the Lollipop MR1 API level (22), for comparisons against __ANDROID_API__. */ +/** Names the Lollipop MR1 API level (22), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_L_MR1__ 22 -/** Names the Marshmallow API level (23), for comparisons against __ANDROID_API__. */ +/** Names the Marshmallow API level (23), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_M__ 23 -/** Names the Nougat API level (24), for comparisons against __ANDROID_API__. */ +/** Names the Nougat API level (24), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_N__ 24 -/** Names the Nougat MR1 API level (25), for comparisons against __ANDROID_API__. */ +/** Names the Nougat MR1 API level (25), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_N_MR1__ 25 -/** Names the Oreo API level (26), for comparisons against __ANDROID_API__. */ +/** Names the Oreo API level (26), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_O__ 26 -/** Names the Oreo MR1 API level (27), for comparisons against __ANDROID_API__. */ +/** Names the Oreo MR1 API level (27), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_O_MR1__ 27 -/** Names the Pie API level (28), for comparisons against __ANDROID_API__. */ +/** Names the Pie API level (28), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_P__ 28 -/** Names the "Q" API level (29), for comparisons against __ANDROID_API__. */ +/** + * Names the "Q" API level (29), for comparison against `__ANDROID_API__`. + * This release was called Android 10 publicly, not to be (but sure to be) + * confused with API level 10. + */ #define __ANDROID_API_Q__ 29 -/** Names the "R" API level (30), for comparisons against __ANDROID_API__. */ +/** Names the "R" API level (30), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_R__ 30 /** |