diff options
author | Justin Yun <justinyun@google.com> | 2024-04-12 13:04:14 +0900 |
---|---|---|
committer | Justin Yun <justinyun@google.com> | 2024-04-12 13:12:57 +0900 |
commit | dcce9e044a3f62302558d7414797db5110ef0786 (patch) | |
tree | 36f2b49e6695164f066caeaf25f5a5de27e553df | |
parent | ef1a559b1f09255b45f06d1641a5072c5b42855e (diff) | |
download | core-dcce9e044a3f62302558d7414797db5110ef0786.tar.gz |
Do not disable LLNDK symbols in header files
Compiler still requires the LLNDK symbols even if they are removed
when compiling. Still the unavailable symbols break the build in
linking if called with wrong api level.
Bug: 333973388
Bug: 320347314
Test: TH
Change-Id: I79cb921cf6f2789e97f11b88cddf7ca1325998a5
-rw-r--r-- | libvendorsupport/include_llndk/android/llndk-versioning.h | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/libvendorsupport/include_llndk/android/llndk-versioning.h b/libvendorsupport/include_llndk/android/llndk-versioning.h index 58cd18db6..cf82fb712 100644 --- a/libvendorsupport/include_llndk/android/llndk-versioning.h +++ b/libvendorsupport/include_llndk/android/llndk-versioning.h @@ -14,22 +14,18 @@ #pragma once -/* As a vendor default header included in all vendor modules, this header MUST NOT include other - * header files or any declarations. Only macros are allowed. - */ -#if defined(__ANDROID_VENDOR__) - // LLNDK (https://source.android.com/docs/core/architecture/vndk/build-system#ll-ndk) is similar to // NDK, but uses its own versioning of YYYYMM format for vendor builds. The LLNDK symbols are -// enabled when the vendor api level is equal to or newer than the ro.board.api_level. -#define __INTRODUCED_IN_LLNDK(vendor_api_level) \ - _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ - __attribute__((enable_if( \ - __ANDROID_VENDOR_API__ >= vendor_api_level, \ - "available in vendor API level " #vendor_api_level " that " \ - "is newer than the current vendor API level. Guard the API " \ - "call with '#if (__ANDROID_VENDOR_API__ >= " #vendor_api_level ")'."))) \ - _Pragma("clang diagnostic pop") +// enabled when the vendor api level is equal to or newer than the ro.board.api_level. These symbols +// must be annotated in map.txt files with the `# llndk=YYYYMM` annotation. They also must be marked +// with `__INTRODUCED_IN_LLNDK(YYYYMM)` in the header files. It leaves a no-op annotation for ABI +// analysis. +#if !defined(__INTRODUCED_IN_LLNDK) +#define __INTRODUCED_IN_LLNDK(vendor_api_level) \ + __attribute__((annotate("introduced_in_llndk=" #vendor_api_level))) +#endif + +#if defined(__ANDROID_VENDOR__) // Use this macro as an `if` statement to call an API that are available to both NDK and LLNDK. // This returns true for the vendor modules if the vendor_api_level is less than or equal to the @@ -39,13 +35,6 @@ #else // __ANDROID_VENDOR__ -// __INTRODUCED_IN_LLNDK is for LLNDK only but not for NDK. Ignore this for non-vendor modules. -// It leaves a no-op annotation for ABI analysis. -#if !defined(__INTRODUCED_IN_LLNDK) -#define __INTRODUCED_IN_LLNDK(vendor_api_level) \ - __attribute__((annotate("introduced_in_llndk=" #vendor_api_level))) -#endif - // For non-vendor modules, API_LEVEL_AT_LEAST is replaced with __builtin_available(sdk_api_level) to // guard the API for __INTRODUCED_IN. #if !defined(API_LEVEL_AT_LEAST) |