summaryrefslogtreecommitdiff
path: root/lib/eal/include/rte_compat.h
blob: 97c1540bd0b170193288c8b1b95dacea89d56bba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(c) 2015 Neil Horman <[email protected]>.
 * All rights reserved.
 */

#ifndef _RTE_COMPAT_H_
#define _RTE_COMPAT_H_

#ifndef ALLOW_EXPERIMENTAL_API

#ifdef RTE_TOOLCHAIN_MSVC
#define __rte_experimental
#else
#define __rte_experimental \
__attribute__((deprecated("Symbol is not yet part of stable ABI"), \
section(".text.experimental")))
#endif

#else

#ifdef RTE_TOOLCHAIN_MSVC
#define __rte_experimental
#else
#define __rte_experimental \
__attribute__((section(".text.experimental")))
#endif

#endif

#ifndef __has_attribute
/* if no has_attribute assume no support for attribute too */
#define __has_attribute(x) 0
#endif

#if !defined ALLOW_INTERNAL_API && __has_attribute(error) /* For GCC */

#ifdef RTE_TOOLCHAIN_MSVC
#define __rte_internal
#else
#define __rte_internal \
__attribute__((error("Symbol is not public ABI"), \
section(".text.internal")))
#endif

#elif !defined ALLOW_INTERNAL_API && __has_attribute(diagnose_if) /* For clang */

#ifdef RTE_TOOLCHAIN_MSVC
#define __rte_internal
#else
#define __rte_internal \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wgcc-compat\"") \
__attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \
section(".text.internal"))) \
_Pragma("GCC diagnostic pop")
#endif

#else

#ifdef RTE_TOOLCHAIN_MSVC
#define __rte_internal
#else
#define __rte_internal \
__attribute__((section(".text.internal")))
#endif

#endif

#endif /* _RTE_COMPAT_H_ */