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