DPDK  24.07.0
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 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #ifndef ALLOW_EXPERIMENTAL_API
14 
15 #ifdef RTE_TOOLCHAIN_MSVC
16 #define __rte_experimental
17 #else
18 #define __rte_experimental \
19 __attribute__((deprecated("Symbol is not yet part of stable ABI"), \
20 section(".text.experimental")))
21 #endif
22 
23 #else
24 
25 #ifdef RTE_TOOLCHAIN_MSVC
26 #define __rte_experimental
27 #else
28 #define __rte_experimental \
29 __attribute__((section(".text.experimental")))
30 #endif
31 
32 #endif
33 
34 #ifndef __has_attribute
35 /* if no has_attribute assume no support for attribute too */
36 #define __has_attribute(x) 0
37 #endif
38 
39 #if !defined ALLOW_INTERNAL_API && __has_attribute(error) /* For GCC */
40 
41 #ifdef RTE_TOOLCHAIN_MSVC
42 #define __rte_internal
43 #else
44 #define __rte_internal \
45 __attribute__((error("Symbol is not public ABI"), \
46 section(".text.internal")))
47 #endif
48 
49 #elif !defined ALLOW_INTERNAL_API && __has_attribute(diagnose_if) /* For clang */
50 
51 #ifdef RTE_TOOLCHAIN_MSVC
52 #define __rte_internal
53 #else
54 #define __rte_internal \
55 _Pragma("GCC diagnostic push") \
56 _Pragma("GCC diagnostic ignored \"-Wgcc-compat\"") \
57 __attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \
58 section(".text.internal"))) \
59 _Pragma("GCC diagnostic pop")
60 #endif
61 
62 #else
63 
64 #ifdef RTE_TOOLCHAIN_MSVC
65 #define __rte_internal
66 #else
67 #define __rte_internal \
68 __attribute__((section(".text.internal")))
69 #endif
70 
71 #endif
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* _RTE_COMPAT_H_ */