[v3,3/3] eal: remove typeof from per lcore macros
Checks
Commit Message
The design of the macros requires a type to be provided to the macro.
By expanding the type parameter inside of typeof it also inadvertently
allows an expression to be used which appears not to have been intended
after evaluating the parameter name and existing macro use.
Technically this is an API break but only for applications that were
using these macros outside of the original design intent.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
doc/guides/rel_notes/release_24_03.rst | 5 +++++
lib/eal/include/rte_per_lcore.h | 8 ++++----
2 files changed, 9 insertions(+), 4 deletions(-)
Comments
> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Tuesday, 13 February 2024 20.12
>
> The design of the macros requires a type to be provided to the macro.
>
> By expanding the type parameter inside of typeof it also inadvertently
> allows an expression to be used which appears not to have been intended
> after evaluating the parameter name and existing macro use.
>
> Technically this is an API break but only for applications that were
> using these macros outside of the original design intent.
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Series-acked-by: Morten Brørup <mb@smartsharesystems.com>
@@ -89,6 +89,11 @@ API Changes
Also, make sure to start the actual text at the margin.
=======================================================
+* eal: Removed ``typeof(type)`` from the expansion of ``RTE_DEFINE_PER_LCORE``
+ and ``RTE_DECLARE_PER_LCORE`` macros aligning them with their intended design.
+ If use with an expression is desired applications can adapt by supplying
+ ``typeof(e)`` as an argument.
+
* gso: ``rte_gso_segment`` now returns -ENOTSUP for unknown protocols.
@@ -24,10 +24,10 @@
#ifdef RTE_TOOLCHAIN_MSVC
#define RTE_DEFINE_PER_LCORE(type, name) \
- __declspec(thread) typeof(type) per_lcore_##name
+ __declspec(thread) type per_lcore_##name
#define RTE_DECLARE_PER_LCORE(type, name) \
- extern __declspec(thread) typeof(type) per_lcore_##name
+ extern __declspec(thread) type per_lcore_##name
#else
/**
* Macro to define a per lcore variable "var" of type "type", don't
@@ -35,13 +35,13 @@
* whole macro.
*/
#define RTE_DEFINE_PER_LCORE(type, name) \
- __thread __typeof__(type) per_lcore_##name
+ __thread type per_lcore_##name
/**
* Macro to declare an extern per lcore variable "var" of type "type"
*/
#define RTE_DECLARE_PER_LCORE(type, name) \
- extern __thread __typeof__(type) per_lcore_##name
+ extern __thread type per_lcore_##name
#endif
/**