Merge "Define __INTRODUCED_IN_LLNDK" into main am: fb97c97932

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2975232

Change-Id: Ia41f02cdcb1053272e985bf55ab977c009f28a22
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2024-02-27 08:55:25 +00:00 committed by Automerger Merge Worker
commit c73f61be26
2 changed files with 66 additions and 0 deletions

View file

@ -34,3 +34,21 @@ cc_library {
"liblog",
],
}
cc_library_headers {
name: "libvendorsupport_llndk_headers",
host_supported: true,
vendor_available: true,
recovery_available: true,
ramdisk_available: true,
vendor_ramdisk_available: true,
native_bridge_supported: true,
export_include_dirs: ["include_llndk"],
llndk: {
llndk_headers: true,
},
system_shared_libs: [],
stl: "none",
}

View file

@ -0,0 +1,48 @@
// Copyright (C) 2024 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <sys/cdefs.h>
__BEGIN_DECLS
#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")
// For the vendor libraries, __INTRODUCED_IN must be ignored because they are only for NDKs but not
// for LLNDKs.
#undef __INTRODUCED_IN
#define __INTRODUCED_IN(x)
#else // __ANDROID_VENDOR__
// For non-vendor libraries, __INTRODUCED_IN_LLNDK must be ignored because it must not change
// symbols of NDK or the system side of the treble boundary.
#define __INTRODUCED_IN_LLNDK(vendor_api_level)
#endif // __ANDROID_VENDOR__
__END_DECLS