Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56fde7cc authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

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

parents ef1a559b dcce9e04
Loading
Loading
Loading
Loading
+10 −21
Original line number Diff line number Diff line
@@ -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.
// 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) \
    _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")
    __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)