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