eal: add macro to mark macros as deprecated
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 15 Oct 2020 22:57:18 +0000 (15:57 -0700)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 20 Oct 2020 09:42:29 +0000 (11:42 +0200)
Add a macro that causes GCC and CLANG to emit a warning when
a deprecated macro is used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_eal/include/rte_common.h

index e63ef0f..1b630ba 100644 (file)
@@ -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.
  */