[1/8] eal: add macro to mark macros as deprecated
diff mbox series

Message ID 20200922143202.8755-2-stephen@networkplumber.org
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series
  • replace blacklist/whitelist with block/allow
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Sept. 22, 2020, 2:31 p.m. UTC
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>
---
 lib/librte_eal/include/rte_common.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Burakov, Anatoly Sept. 23, 2020, 9:18 a.m. UTC | #1
On 22-Sep-20 3:31 PM, Stephen Hemminger wrote:
> 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>
> ---
>   lib/librte_eal/include/rte_common.h | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/lib/librte_eal/include/rte_common.h b/lib/librte_eal/include/rte_common.h
> index 8f487a563dfc..c6714b67b411 100644
> --- a/lib/librte_eal/include/rte_common.h
> +++ b/lib/librte_eal/include/rte_common.h
> @@ -86,6 +86,17 @@ typedef uint16_t unaligned_uint16_t;
>   /******* Macro to mark functions and fields scheduled for removal *****/
>   #define __rte_deprecated	__attribute__((__deprecated__))
>   
> +/**
> + *  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.
>    */
> 

Don't we already have this in the master/slave lcore patchset?
Stephen Hemminger Sept. 23, 2020, 5:01 p.m. UTC | #2
On Wed, 23 Sep 2020 10:18:21 +0100
"Burakov, Anatoly" <anatoly.burakov@intel.com> wrote:

> On 22-Sep-20 3:31 PM, Stephen Hemminger wrote:
> > 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>
> > ---
> >   lib/librte_eal/include/rte_common.h | 11 +++++++++++
> >   1 file changed, 11 insertions(+)
> > 
> > diff --git a/lib/librte_eal/include/rte_common.h b/lib/librte_eal/include/rte_common.h
> > index 8f487a563dfc..c6714b67b411 100644
> > --- a/lib/librte_eal/include/rte_common.h
> > +++ b/lib/librte_eal/include/rte_common.h
> > @@ -86,6 +86,17 @@ typedef uint16_t unaligned_uint16_t;
> >   /******* Macro to mark functions and fields scheduled for removal *****/
> >   #define __rte_deprecated	__attribute__((__deprecated__))
> >   
> > +/**
> > + *  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.
> >    */
> >   
> 
> Don't we already have this in the master/slave lcore patchset?
> 

Yes, this intentional (see the cover letter) so that the patch set
can be tested by the CI infrastructure. There is no good way with current
patch flow to mark a set of patches dependent on earlier group.

Patch
diff mbox series

diff --git a/lib/librte_eal/include/rte_common.h b/lib/librte_eal/include/rte_common.h
index 8f487a563dfc..c6714b67b411 100644
--- a/lib/librte_eal/include/rte_common.h
+++ b/lib/librte_eal/include/rte_common.h
@@ -86,6 +86,17 @@  typedef uint16_t unaligned_uint16_t;
 /******* Macro to mark functions and fields scheduled for removal *****/
 #define __rte_deprecated	__attribute__((__deprecated__))
 
+/**
+ *  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.
  */