1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 // The `annotate` attribute always pulls the annotated (inline) function into the object files, thus
20 // we should only annotate headers when we are running versioner.
21 #if defined(__BIONIC_VERSIONER)
22 
23 #define __INTRODUCED_IN(api_level) __attribute__((annotate("introduced_in=" #api_level)))
24 #define __DEPRECATED_IN(api_level) __attribute__((annotate("deprecated_in=" #api_level)))
25 #define __REMOVED_IN(api_level) __attribute__((annotate("obsoleted_in=" #api_level)))
26 #define __INTRODUCED_IN_32(api_level) __attribute__((annotate("introduced_in_32=" #api_level)))
27 #define __INTRODUCED_IN_64(api_level) __attribute__((annotate("introduced_in_64=" #api_level)))
28 #define __INTRODUCED_IN_ARM(api_level) __attribute__((annotate("introduced_in_arm=" #api_level)))
29 #define __INTRODUCED_IN_X86(api_level) __attribute__((annotate("introduced_in_x86=" #api_level)))
30 
31 #define __VERSIONER_NO_GUARD __attribute__((annotate("versioner_no_guard")))
32 #define __VERSIONER_FORTIFY_INLINE __attribute__((annotate("versioner_fortify_inline")))
33 
34 #else
35 
36 #define __INTRODUCED_IN(api_level)
37 #define __DEPRECATED_IN(api_level)
38 #define __REMOVED_IN(api_level)
39 #define __INTRODUCED_IN_32(api_level)
40 #define __INTRODUCED_IN_64(api_level)
41 #define __INTRODUCED_IN_ARM(api_level)
42 #define __INTRODUCED_IN_X86(api_level)
43 
44 #define __VERSIONER_NO_GUARD
45 #define __VERSIONER_FORTIFY_INLINE
46 
47 #endif  // defined(__BIONIC_VERSIONER)
48