Message ID | 20200701202359.17006-26-stephen@networkplumber.org (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Thomas Monjalon |
Headers | show |
Series | Replace references to master and slave | expand |
Context | Check | Description |
---|---|---|
ci/Intel-compilation | fail | Compilation issues |
ci/checkpatch | warning | coding style issues |
On 01-Jul-20 9:23 PM, Stephen Hemminger wrote: > Use of old RTE_LCORE_FOREACH_SLAVE and rte_get_master_lcore_id() > are marked as deprecated. > > All uses of these in DPDK itself is gone. This will cause warnings > for applications still using them. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- > lib/librte_eal/include/rte_launch.h | 4 ++-- > lib/librte_eal/include/rte_lcore.h | 4 +++- > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/lib/librte_eal/include/rte_launch.h b/lib/librte_eal/include/rte_launch.h > index 9b68685d99d4..8d58ca5302a7 100644 > --- a/lib/librte_eal/include/rte_launch.h > +++ b/lib/librte_eal/include/rte_launch.h > @@ -76,8 +76,8 @@ enum rte_rmt_call_initial_t { > /** > * Deprecated backward compatiable definitions > */ > -#define SKIP_MASTER SKIP_INITIAL > -#define CALL_MASTER CALL_INITIAL > +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is deprecated\"") SKIP_INITIAL > +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is deprecated\"") CALL_INITIAL Presumably this is a generic header, should we introduce GCC-specific things there? > > /** > * Launch a function on all lcores. > diff --git a/lib/librte_eal/include/rte_lcore.h b/lib/librte_eal/include/rte_lcore.h > index 069cb1f427b9..eaa7c0f0b67c 100644 > --- a/lib/librte_eal/include/rte_lcore.h > +++ b/lib/librte_eal/include/rte_lcore.h > @@ -67,6 +67,7 @@ unsigned int rte_get_initial_lcore(void); > * @return > * the id of the initial lcore > */ > +__rte_deprecated > unsigned int rte_get_master_lcore(void); > > /** > @@ -216,7 +217,8 @@ unsigned int rte_get_next_lcore(unsigned int i, int skip_initial, int wrap); > /** > * Backward compatibility > */ > -#define RTE_LCORE_FOREACH_SLAVE(x) \ > +#define RTE_LCORE_FOREACH_SLAVE(x) \ > + _Pragma("GCC warning \"'RTE_LCORE_FOREACH_SLAVE' macro is deprecated\"") \ > RTE_LCORE_FOREACH_WORKER(x) Same as above. > > >
On Wed, 15 Jul 2020 14:28:17 +0100 "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > > -#define SKIP_MASTER SKIP_INITIAL > > -#define CALL_MASTER CALL_INITIAL > > +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is deprecated\"") SKIP_INITIAL > > +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is deprecated\"") CALL_INITIAL > > Presumably this is a generic header, should we introduce GCC-specific > things there? It works with Clang as well. Likely ICC but don't have that.
On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: > On Wed, 15 Jul 2020 14:28:17 +0100 > "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > >>> -#define SKIP_MASTER SKIP_INITIAL >>> -#define CALL_MASTER CALL_INITIAL >>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is deprecated\"") SKIP_INITIAL >>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is deprecated\"") CALL_INITIAL >> >> Presumably this is a generic header, should we introduce GCC-specific >> things there? > > It works with Clang as well. Likely ICC but don't have that. > What about MSVC?
On Thu, 16 Jul 2020 14:41:41 +0100 "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: > > On Wed, 15 Jul 2020 14:28:17 +0100 > > "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > > > >>> -#define SKIP_MASTER SKIP_INITIAL > >>> -#define CALL_MASTER CALL_INITIAL > >>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is deprecated\"") SKIP_INITIAL > >>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is deprecated\"") CALL_INITIAL > >> > >> Presumably this is a generic header, should we introduce GCC-specific > >> things there? > > > > It works with Clang as well. Likely ICC but don't have that. > > > > What about MSVC? > _Pragma is C99 standard so MSVC know it. MSVC should ignore any pragman it doesn't understand. There is a better pragma for deprecating keywords in MSVC, but GCC and Clang don't understand it.
On Thu, 16 Jul 2020 14:41:41 +0100 "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: > > On Wed, 15 Jul 2020 14:28:17 +0100 > > "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > > > >>> -#define SKIP_MASTER SKIP_INITIAL > >>> -#define CALL_MASTER CALL_INITIAL > >>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is deprecated\"") SKIP_INITIAL > >>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is deprecated\"") CALL_INITIAL > >> > >> Presumably this is a generic header, should we introduce GCC-specific > >> things there? > > > > It works with Clang as well. Likely ICC but don't have that. > > > > What about MSVC? > The compiler issues a warning when it finds a pragma that it doesn't recognize, and continues compilation.
On 16-Jul-20 11:04 PM, Stephen Hemminger wrote: > On Thu, 16 Jul 2020 14:41:41 +0100 > "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > >> On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: >>> On Wed, 15 Jul 2020 14:28:17 +0100 >>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: >>> >>>>> -#define SKIP_MASTER SKIP_INITIAL >>>>> -#define CALL_MASTER CALL_INITIAL >>>>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is deprecated\"") SKIP_INITIAL >>>>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is deprecated\"") CALL_INITIAL >>>> >>>> Presumably this is a generic header, should we introduce GCC-specific >>>> things there? >>> >>> It works with Clang as well. Likely ICC but don't have that. >>> >> >> What about MSVC? >> > > _Pragma is C99 standard so MSVC know it. > MSVC should ignore any pragman it doesn't understand. > > There is a better pragma for deprecating keywords in MSVC, but GCC and Clang don't > understand it. > Deprecating macros sounds like something we might want to do in the future, can't we put some macro into rte_common.h to address this? e.g. something like #ifdef MSVC #define rte_deprecated_macro _msvc_pragma_whatever() #else #define rte_deprecated_macro _Pragma("GCC warning ...") #endif and use this macro here?
On Fri, Jul 17, 2020, 18:21 Burakov, Anatoly <anatoly.burakov@intel.com> wrote: > On 16-Jul-20 11:04 PM, Stephen Hemminger wrote: > > On Thu, 16 Jul 2020 14:41:41 +0100 > > "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > > > >> On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: > >>> On Wed, 15 Jul 2020 14:28:17 +0100 > >>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > >>> > >>>>> -#define SKIP_MASTER SKIP_INITIAL > >>>>> -#define CALL_MASTER CALL_INITIAL > >>>>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is > deprecated\"") SKIP_INITIAL > >>>>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is > deprecated\"") CALL_INITIAL > >>>> > >>>> Presumably this is a generic header, should we introduce GCC-specific > >>>> things there? > >>> > >>> It works with Clang as well. Likely ICC but don't have that. > >>> > >> > >> What about MSVC? > FYI, DPDK on Windows is compiled with Clang, only linker is from MSVC. And MinGW uses GCC toolchain. Why care about MSVC here?
On 17-Jul-20 4:35 PM, Dmitry Kozliuk wrote: > On Fri, Jul 17, 2020, 18:21 Burakov, Anatoly <anatoly.burakov@intel.com > <mailto:anatoly.burakov@intel.com>> wrote: > > On 16-Jul-20 11:04 PM, Stephen Hemminger wrote: > > On Thu, 16 Jul 2020 14:41:41 +0100 > > "Burakov, Anatoly" <anatoly.burakov@intel.com > <mailto:anatoly.burakov@intel.com>> wrote: > > > >> On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: > >>> On Wed, 15 Jul 2020 14:28:17 +0100 > >>> "Burakov, Anatoly" <anatoly.burakov@intel.com > <mailto:anatoly.burakov@intel.com>> wrote: > >>> > >>>>> -#define SKIP_MASTER SKIP_INITIAL > >>>>> -#define CALL_MASTER CALL_INITIAL > >>>>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is > deprecated\"") SKIP_INITIAL > >>>>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is > deprecated\"") CALL_INITIAL > >>>> > >>>> Presumably this is a generic header, should we introduce > GCC-specific > >>>> things there? > >>> > >>> It works with Clang as well. Likely ICC but don't have that. > >>> > >> > >> What about MSVC? > > > FYI, DPDK on Windows is compiled with Clang, only linker is from MSVC. > And MinGW uses GCC toolchain. Why care about MSVC here? Ah, OK. I'm not too familiar with Windows port, i was assuming it uses MSVC.
On 17-Jul-20 4:43 PM, Burakov, Anatoly wrote: > On 17-Jul-20 4:35 PM, Dmitry Kozliuk wrote: >> On Fri, Jul 17, 2020, 18:21 Burakov, Anatoly >> <anatoly.burakov@intel.com <mailto:anatoly.burakov@intel.com>> wrote: >> >> On 16-Jul-20 11:04 PM, Stephen Hemminger wrote: >> > On Thu, 16 Jul 2020 14:41:41 +0100 >> > "Burakov, Anatoly" <anatoly.burakov@intel.com >> <mailto:anatoly.burakov@intel.com>> wrote: >> > >> >> On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: >> >>> On Wed, 15 Jul 2020 14:28:17 +0100 >> >>> "Burakov, Anatoly" <anatoly.burakov@intel.com >> <mailto:anatoly.burakov@intel.com>> wrote: >> >>> >> >>>>> -#define SKIP_MASTER SKIP_INITIAL >> >>>>> -#define CALL_MASTER CALL_INITIAL >> >>>>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is >> deprecated\"") SKIP_INITIAL >> >>>>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is >> deprecated\"") CALL_INITIAL >> >>>> >> >>>> Presumably this is a generic header, should we introduce >> GCC-specific >> >>>> things there? >> >>> >> >>> It works with Clang as well. Likely ICC but don't have that. >> >>> >> >> >> >> What about MSVC? >> >> >> FYI, DPDK on Windows is compiled with Clang, only linker is from MSVC. >> And MinGW uses GCC toolchain. Why care about MSVC here? > > Ah, OK. I'm not too familiar with Windows port, i was assuming it uses > MSVC. > Nevertheless, i would prefer having a macro for these kinds of cases, however rare they are.
On Fri, 17 Jul 2020 16:21:37 +0100 "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > On 16-Jul-20 11:04 PM, Stephen Hemminger wrote: > > On Thu, 16 Jul 2020 14:41:41 +0100 > > "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > > > >> On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: > >>> On Wed, 15 Jul 2020 14:28:17 +0100 > >>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > >>> > >>>>> -#define SKIP_MASTER SKIP_INITIAL > >>>>> -#define CALL_MASTER CALL_INITIAL > >>>>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is deprecated\"") SKIP_INITIAL > >>>>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is deprecated\"") CALL_INITIAL > >>>> > >>>> Presumably this is a generic header, should we introduce GCC-specific > >>>> things there? > >>> > >>> It works with Clang as well. Likely ICC but don't have that. > >>> > >> > >> What about MSVC? > >> > > > > _Pragma is C99 standard so MSVC know it. > > MSVC should ignore any pragman it doesn't understand. > > > > There is a better pragma for deprecating keywords in MSVC, but GCC and Clang don't > > understand it. > > > > Deprecating macros sounds like something we might want to do in the > future, can't we put some macro into rte_common.h to address this? e.g. > something like > > #ifdef MSVC > #define rte_deprecated_macro _msvc_pragma_whatever() > #else > #define rte_deprecated_macro _Pragma("GCC warning ...") > #endif > > and use this macro here? It gets hard to do macro in a macro,
On 18-Jul-20 3:22 AM, Stephen Hemminger wrote: > On Fri, 17 Jul 2020 16:21:37 +0100 > "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > >> On 16-Jul-20 11:04 PM, Stephen Hemminger wrote: >>> On Thu, 16 Jul 2020 14:41:41 +0100 >>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: >>> >>>> On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: >>>>> On Wed, 15 Jul 2020 14:28:17 +0100 >>>>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: >>>>> >>>>>>> -#define SKIP_MASTER SKIP_INITIAL >>>>>>> -#define CALL_MASTER CALL_INITIAL >>>>>>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is deprecated\"") SKIP_INITIAL >>>>>>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is deprecated\"") CALL_INITIAL >>>>>> >>>>>> Presumably this is a generic header, should we introduce GCC-specific >>>>>> things there? >>>>> >>>>> It works with Clang as well. Likely ICC but don't have that. >>>>> >>>> >>>> What about MSVC? >>>> >>> >>> _Pragma is C99 standard so MSVC know it. >>> MSVC should ignore any pragman it doesn't understand. >>> >>> There is a better pragma for deprecating keywords in MSVC, but GCC and Clang don't >>> understand it. >>> >> >> Deprecating macros sounds like something we might want to do in the >> future, can't we put some macro into rte_common.h to address this? e.g. >> something like >> >> #ifdef MSVC >> #define rte_deprecated_macro _msvc_pragma_whatever() >> #else >> #define rte_deprecated_macro _Pragma("GCC warning ...") >> #endif >> >> and use this macro here? > > It gets hard to do macro in a macro, > I don't have a strong opinion on this, but IMO it's certainly better than having a compiler-specific things in an API header file :)
On Mon, 20 Jul 2020 13:32:27 +0100 "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > On 18-Jul-20 3:22 AM, Stephen Hemminger wrote: > > On Fri, 17 Jul 2020 16:21:37 +0100 > > "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > > > >> On 16-Jul-20 11:04 PM, Stephen Hemminger wrote: > >>> On Thu, 16 Jul 2020 14:41:41 +0100 > >>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > >>> > >>>> On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: > >>>>> On Wed, 15 Jul 2020 14:28:17 +0100 > >>>>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > >>>>> > >>>>>>> -#define SKIP_MASTER SKIP_INITIAL > >>>>>>> -#define CALL_MASTER CALL_INITIAL > >>>>>>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is deprecated\"") SKIP_INITIAL > >>>>>>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is deprecated\"") CALL_INITIAL > >>>>>> > >>>>>> Presumably this is a generic header, should we introduce GCC-specific > >>>>>> things there? > >>>>> > >>>>> It works with Clang as well. Likely ICC but don't have that. > >>>>> > >>>> > >>>> What about MSVC? > >>>> > >>> > >>> _Pragma is C99 standard so MSVC know it. > >>> MSVC should ignore any pragman it doesn't understand. > >>> > >>> There is a better pragma for deprecating keywords in MSVC, but GCC and Clang don't > >>> understand it. > >>> > >> > >> Deprecating macros sounds like something we might want to do in the > >> future, can't we put some macro into rte_common.h to address this? e.g. > >> something like > >> > >> #ifdef MSVC > >> #define rte_deprecated_macro _msvc_pragma_whatever() > >> #else > >> #define rte_deprecated_macro _Pragma("GCC warning ...") > >> #endif > >> > >> and use this macro here? > > > > It gets hard to do macro in a macro, > > > > I don't have a strong opinion on this, but IMO it's certainly better > than having a compiler-specific things in an API header file :) > I was hoping for macro volunteer? Something like: #define RTE_DEPRECATED(foo) ...
On 20-Jul-20 7:51 PM, Stephen Hemminger wrote: > On Mon, 20 Jul 2020 13:32:27 +0100 > "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > >> On 18-Jul-20 3:22 AM, Stephen Hemminger wrote: >>> On Fri, 17 Jul 2020 16:21:37 +0100 >>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: >>> >>>> On 16-Jul-20 11:04 PM, Stephen Hemminger wrote: >>>>> On Thu, 16 Jul 2020 14:41:41 +0100 >>>>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: >>>>> >>>>>> On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: >>>>>>> On Wed, 15 Jul 2020 14:28:17 +0100 >>>>>>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: >>>>>>> >>>>>>>>> -#define SKIP_MASTER SKIP_INITIAL >>>>>>>>> -#define CALL_MASTER CALL_INITIAL >>>>>>>>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is deprecated\"") SKIP_INITIAL >>>>>>>>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is deprecated\"") CALL_INITIAL >>>>>>>> >>>>>>>> Presumably this is a generic header, should we introduce GCC-specific >>>>>>>> things there? >>>>>>> >>>>>>> It works with Clang as well. Likely ICC but don't have that. >>>>>>> >>>>>> >>>>>> What about MSVC? >>>>>> >>>>> >>>>> _Pragma is C99 standard so MSVC know it. >>>>> MSVC should ignore any pragman it doesn't understand. >>>>> >>>>> There is a better pragma for deprecating keywords in MSVC, but GCC and Clang don't >>>>> understand it. >>>>> >>>> >>>> Deprecating macros sounds like something we might want to do in the >>>> future, can't we put some macro into rte_common.h to address this? e.g. >>>> something like >>>> >>>> #ifdef MSVC >>>> #define rte_deprecated_macro _msvc_pragma_whatever() >>>> #else >>>> #define rte_deprecated_macro _Pragma("GCC warning ...") >>>> #endif >>>> >>>> and use this macro here? >>> >>> It gets hard to do macro in a macro, >>> >> >> I don't have a strong opinion on this, but IMO it's certainly better >> than having a compiler-specific things in an API header file :) >> > > I was hoping for macro volunteer? > > Something like: > #define RTE_DEPRECATED(foo) ... > Oh, sure, apologies for not picking up on that :D A bit on the ugly side, but should work: #define __rte_deprecated_macro(val) (_Pragma("GCC warning \"'" #val "'\" is deprecated\"") (val)) To be used as: #define NEW __rte_deprecated_macro(OLD) (I feel there could be confusion between __rte_deprecated and RTE_DEPRECATED, so both for consistency and clarity, i believe "__rte_deprecated_macro" would be a better name - however, no strong opinion, RTE_DEPRECATED is fine by me as well)
On 22-Jul-20 10:05 AM, Burakov, Anatoly wrote: > On 20-Jul-20 7:51 PM, Stephen Hemminger wrote: >> On Mon, 20 Jul 2020 13:32:27 +0100 >> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: >> >>> On 18-Jul-20 3:22 AM, Stephen Hemminger wrote: >>>> On Fri, 17 Jul 2020 16:21:37 +0100 >>>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: >>>>> On 16-Jul-20 11:04 PM, Stephen Hemminger wrote: >>>>>> On Thu, 16 Jul 2020 14:41:41 +0100 >>>>>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: >>>>>>> On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: >>>>>>>> On Wed, 15 Jul 2020 14:28:17 +0100 >>>>>>>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: >>>>>>>>>> -#define SKIP_MASTER SKIP_INITIAL >>>>>>>>>> -#define CALL_MASTER CALL_INITIAL >>>>>>>>>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is >>>>>>>>>> deprecated\"") SKIP_INITIAL >>>>>>>>>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is >>>>>>>>>> deprecated\"") CALL_INITIAL >>>>>>>>> >>>>>>>>> Presumably this is a generic header, should we introduce >>>>>>>>> GCC-specific >>>>>>>>> things there? >>>>>>>> >>>>>>>> It works with Clang as well. Likely ICC but don't have that. >>>>>>> >>>>>>> What about MSVC? >>>>>> >>>>>> _Pragma is C99 standard so MSVC know it. >>>>>> MSVC should ignore any pragman it doesn't understand. >>>>>> >>>>>> There is a better pragma for deprecating keywords in MSVC, but GCC >>>>>> and Clang don't >>>>>> understand it. >>>>> >>>>> Deprecating macros sounds like something we might want to do in the >>>>> future, can't we put some macro into rte_common.h to address this? >>>>> e.g. >>>>> something like >>>>> >>>>> #ifdef MSVC >>>>> #define rte_deprecated_macro _msvc_pragma_whatever() >>>>> #else >>>>> #define rte_deprecated_macro _Pragma("GCC warning ...") >>>>> #endif >>>>> >>>>> and use this macro here? >>>> >>>> It gets hard to do macro in a macro, >>> >>> I don't have a strong opinion on this, but IMO it's certainly better >>> than having a compiler-specific things in an API header file :) >>> >> >> I was hoping for macro volunteer? >> >> Something like: >> #define RTE_DEPRECATED(foo) ... >> > > Oh, sure, apologies for not picking up on that :D > > A bit on the ugly side, but should work: > > #define __rte_deprecated_macro(val) (_Pragma("GCC warning \"'" #val "'\" > is deprecated\"") (val)) > > To be used as: > > #define NEW __rte_deprecated_macro(OLD) > > (I feel there could be confusion between __rte_deprecated and > RTE_DEPRECATED, so both for consistency and clarity, i believe > "__rte_deprecated_macro" would be a better name - however, no strong > opinion, RTE_DEPRECATED is fine by me as well) > Sorry, realized that i've done it the other way around :D Perhaps this one would be better: #define __rte_deprecated_macro(old) _Pragma("GCC warning \"'" #old "'\" is deprecated\"") ... #define OLD __rte_deprecated_macro(OLD) NEW
On Wed, 22 Jul 2020 10:05:09 +0100 "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > On 20-Jul-20 7:51 PM, Stephen Hemminger wrote: > > On Mon, 20 Jul 2020 13:32:27 +0100 > > "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > > > >> On 18-Jul-20 3:22 AM, Stephen Hemminger wrote: > >>> On Fri, 17 Jul 2020 16:21:37 +0100 > >>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > >>> > >>>> On 16-Jul-20 11:04 PM, Stephen Hemminger wrote: > >>>>> On Thu, 16 Jul 2020 14:41:41 +0100 > >>>>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > >>>>> > >>>>>> On 15-Jul-20 9:29 PM, Stephen Hemminger wrote: > >>>>>>> On Wed, 15 Jul 2020 14:28:17 +0100 > >>>>>>> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote: > >>>>>>> > >>>>>>>>> -#define SKIP_MASTER SKIP_INITIAL > >>>>>>>>> -#define CALL_MASTER CALL_INITIAL > >>>>>>>>> +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is deprecated\"") SKIP_INITIAL > >>>>>>>>> +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is deprecated\"") CALL_INITIAL > >>>>>>>> > >>>>>>>> Presumably this is a generic header, should we introduce GCC-specific > >>>>>>>> things there? > >>>>>>> > >>>>>>> It works with Clang as well. Likely ICC but don't have that. > >>>>>>> > >>>>>> > >>>>>> What about MSVC? > >>>>>> > >>>>> > >>>>> _Pragma is C99 standard so MSVC know it. > >>>>> MSVC should ignore any pragman it doesn't understand. > >>>>> > >>>>> There is a better pragma for deprecating keywords in MSVC, but GCC and Clang don't > >>>>> understand it. > >>>>> > >>>> > >>>> Deprecating macros sounds like something we might want to do in the > >>>> future, can't we put some macro into rte_common.h to address this? e.g. > >>>> something like > >>>> > >>>> #ifdef MSVC > >>>> #define rte_deprecated_macro _msvc_pragma_whatever() > >>>> #else > >>>> #define rte_deprecated_macro _Pragma("GCC warning ...") > >>>> #endif > >>>> > >>>> and use this macro here? > >>> > >>> It gets hard to do macro in a macro, > >>> > >> > >> I don't have a strong opinion on this, but IMO it's certainly better > >> than having a compiler-specific things in an API header file :) > >> > > > > I was hoping for macro volunteer? > > > > Something like: > > #define RTE_DEPRECATED(foo) ... > > > > Oh, sure, apologies for not picking up on that :D > > A bit on the ugly side, but should work: > > #define __rte_deprecated_macro(val) (_Pragma("GCC warning \"'" #val "'\" > is deprecated\"") (val)) > > To be used as: > > #define NEW __rte_deprecated_macro(OLD) > > (I feel there could be confusion between __rte_deprecated and > RTE_DEPRECATED, so both for consistency and clarity, i believe > "__rte_deprecated_macro" would be a better name - however, no strong > opinion, RTE_DEPRECATED is fine by me as well) > I would prefer to keep to uppercase for macros. Will try it in V2
diff --git a/lib/librte_eal/include/rte_launch.h b/lib/librte_eal/include/rte_launch.h index 9b68685d99d4..8d58ca5302a7 100644 --- a/lib/librte_eal/include/rte_launch.h +++ b/lib/librte_eal/include/rte_launch.h @@ -76,8 +76,8 @@ enum rte_rmt_call_initial_t { /** * Deprecated backward compatiable definitions */ -#define SKIP_MASTER SKIP_INITIAL -#define CALL_MASTER CALL_INITIAL +#define SKIP_MASTER _Pragma("GCC warning \"'SKIP_MASTER' is deprecated\"") SKIP_INITIAL +#define CALL_MASTER _Pragma("GCC warning \"'CALL_MASTER' is deprecated\"") CALL_INITIAL /** * Launch a function on all lcores. diff --git a/lib/librte_eal/include/rte_lcore.h b/lib/librte_eal/include/rte_lcore.h index 069cb1f427b9..eaa7c0f0b67c 100644 --- a/lib/librte_eal/include/rte_lcore.h +++ b/lib/librte_eal/include/rte_lcore.h @@ -67,6 +67,7 @@ unsigned int rte_get_initial_lcore(void); * @return * the id of the initial lcore */ +__rte_deprecated unsigned int rte_get_master_lcore(void); /** @@ -216,7 +217,8 @@ unsigned int rte_get_next_lcore(unsigned int i, int skip_initial, int wrap); /** * Backward compatibility */ -#define RTE_LCORE_FOREACH_SLAVE(x) \ +#define RTE_LCORE_FOREACH_SLAVE(x) \ + _Pragma("GCC warning \"'RTE_LCORE_FOREACH_SLAVE' macro is deprecated\"") \ RTE_LCORE_FOREACH_WORKER(x)
Use of old RTE_LCORE_FOREACH_SLAVE and rte_get_master_lcore_id() are marked as deprecated. All uses of these in DPDK itself is gone. This will cause warnings for applications still using them. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/librte_eal/include/rte_launch.h | 4 ++-- lib/librte_eal/include/rte_lcore.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)