Merge "Do not disable LLNDK symbols in header files" into main

This commit is contained in:
Treehugger Robot 2024-04-12 06:21:08 +00:00 committed by Gerrit Code Review
commit 56fde7cc2e

View file

@ -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)