From: Stephen Hemminger Date: Thu, 15 Oct 2020 22:57:18 +0000 (-0700) Subject: eal: add macro to mark macros as deprecated X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=03031925811e0341618957521a1542fa9eb2e497;p=dpdk.git eal: add macro to mark macros as deprecated Add a macro that causes GCC and CLANG to emit a warning when a deprecated macro is used. Signed-off-by: Stephen Hemminger Acked-by: Anatoly Burakov Acked-by: Bruce Richardson --- diff --git a/lib/librte_eal/include/rte_common.h b/lib/librte_eal/include/rte_common.h index e63ef0f1de..1b630baf16 100644 --- a/lib/librte_eal/include/rte_common.h +++ b/lib/librte_eal/include/rte_common.h @@ -87,6 +87,17 @@ typedef uint16_t unaligned_uint16_t; #define __rte_deprecated __attribute__((__deprecated__)) #define __rte_deprecated_msg(msg) __attribute__((__deprecated__(msg))) +/** + * Macro to mark macros and defines scheduled for removal + */ +#if defined(RTE_CC_GCC) || defined(RTE_CC_CLANG) +#define RTE_PRAGMA(x) _Pragma(#x) +#define RTE_PRAGMA_WARNING(w) RTE_PRAGMA(GCC warning #w) +#define RTE_DEPRECATED(x) RTE_PRAGMA_WARNING(#x is deprecated) +#else +#define RTE_DEPRECATED(x) +#endif + /** * Mark a function or variable to a weak reference. */