DPDK  24.11.0-rc3
rte_compat.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2015 Neil Horman <nhorman@tuxdriver.com>.
3  * All rights reserved.
4  */
5 
6 #ifndef _RTE_COMPAT_H_
7 #define _RTE_COMPAT_H_
8 
9 #ifndef ALLOW_EXPERIMENTAL_API
10 
11 #ifdef RTE_TOOLCHAIN_MSVC
12 #define __rte_experimental
13 #else
14 #define __rte_experimental \
15 __attribute__((deprecated("Symbol is not yet part of stable ABI"), \
16 section(".text.experimental")))
17 #endif
18 
19 #else
20 
21 #ifdef RTE_TOOLCHAIN_MSVC
22 #define __rte_experimental
23 #else
24 #define __rte_experimental \
25 __attribute__((section(".text.experimental")))
26 #endif
27 
28 #endif
29 
30 #ifndef __has_attribute
31 /* if no has_attribute assume no support for attribute too */
32 #define __has_attribute(x) 0
33 #endif
34 
35 #if !defined ALLOW_INTERNAL_API && __has_attribute(error) /* For GCC */
36 
37 #ifdef RTE_TOOLCHAIN_MSVC
38 #define __rte_internal
39 #else
40 #define __rte_internal \
41 __attribute__((error("Symbol is not public ABI"), \
42 section(".text.internal")))
43 #endif
44 
45 #elif !defined ALLOW_INTERNAL_API && __has_attribute(diagnose_if) /* For clang */
46 
47 #ifdef RTE_TOOLCHAIN_MSVC
48 #define __rte_internal
49 #else
50 #define __rte_internal \
51 _Pragma("GCC diagnostic push") \
52 _Pragma("GCC diagnostic ignored \"-Wgcc-compat\"") \
53 __attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \
54 section(".text.internal"))) \
55 _Pragma("GCC diagnostic pop")
56 #endif
57 
58 #else
59 
60 #ifdef RTE_TOOLCHAIN_MSVC
61 #define __rte_internal
62 #else
63 #define __rte_internal \
64 __attribute__((section(".text.internal")))
65 #endif
66 
67 #endif
68 
69 #endif /* _RTE_COMPAT_H_ */