provide Windows/MSVC lcore macros
PATCH 1/1 provide Windows/MSVC lcore macros
Provide MSVC compatible macros RTE_DEFINE_PER_LCORE and RTE_DECLARE_PER_LCORE that expand appropriately for Windows/MSVC
NOTICE:
It is intentional that devtools/checkpatches.pl generates an error about parenthesis to allow comparison with clang/gcc versions of these macros which also do not have the parenthesis.
``` ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parenthesis #31: FILE: lib/eal/include/rte_per_lcore.h:42: +#define RTE_DEFINE_PER_LCORE(type, name) \ + __declspec(thread) typeof(type) per_lcore_##name ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parenthesis #34: FILE: lib/eal/include/rte_per_lcore.h:45: +#define RTE_DECLARE_PER_LCORE(type, name) \ + extern __declspec(thread) typeof(type) per_lcore_##name ```
Tyler Retzlaff (1):
eal: provide per lcore macros for MSVC
lib/eal/include/rte_per_lcore.h | 8 ++++++++ 1 file changed, 8 insertions(+)
Signature · 1 line
1.8.3.1
PATCH 1/1 eal: provide per lcore macros for MSVC
Provide per lcore macros that use __declspec(thread) and uses C23 typeof.
--- lib/eal/include/rte_per_lcore.h | 8 ++++++++ 1 file changed, 8 insertions(+)
lib/eal/include/rte_per_lcore.h +8 -0
@@ -24,6 +24,7 @@#include <pthread.h> +#ifndef RTE_TOOLCHAIN_MSVC /** * Macro to define a per lcore variable "var" of type "type", don't * use keywords like "static" or "volatile" in type, just prefix the
@@ -37,6 +38,13 @@*/ #define RTE_DECLARE_PER_LCORE (type, name) \ extern __thread __typeof__(type) per_lcore_##name +#else +#define RTE_DEFINE_PER_LCORE (type, name) \ + __declspec(thread) typeof(type) per_lcore_##name + +#define RTE_DECLARE_PER_LCORE (type, name) \ + extern __declspec(thread) typeof(type) per_lcore_##name +#endif /** * Read/write the per-lcore variable value
Signature · 1 line
1.8.3.1
Re: [PATCH] eal: provide per lcore macros for MSVC
10/07/2023 23:29, Tyler Retzlaff:
Quoted 10 lines
Provide per lcore macros that use
__declspec(thread)and uses C23 typeof.Signed-off-by Tyler Retzlaff <[email protected]>---
lib/eal/include/rte_per_lcore.h +1
-0+#ifndef RTE_TOOLCHAIN_MSVC /** * Macro to define a per lcore variable "var" of type "type", don't * use keywords like "static" or "volatile" in type, just prefix the
lib/eal/include/rte_per_lcore.h line 47
Quoted 10 lines
lib/eal/include/rte_per_lcore.h +7
-0@@ -37,6 +38,13 @@*/ #define RTE_DECLARE_PER_LCORE (type, name) \ extern __thread __typeof__(type) per_lcore_##name +#else +#define RTE_DEFINE_PER_LCORE (type, name) \ + __declspec(thread) typeof(type) per_lcore_##name + +#define RTE_DECLARE_PER_LCORE (type, name) \ + extern __declspec(thread) typeof(type) per_lcore_##name +#endif
It would be better (here and in other MSVC patches) to have the opposite logic: start with MSVC implementation.
#ifdef MSVC
MSVC implementation
#else
POSIX implementation
#endif
PATCH v2 1/1 provide Windows/MSVC lcore macros
In reply to Tyler RetzlaffProvide MSVC compatible macros RTE_DEFINE_PER_LCORE and RTE_DECLARE_PER_LCORE that expand appropriately for Windows/MSVC
NOTICE:
It is intentional that devtools/checkpatches.pl generates an error about parenthesis to allow comparison with clang/gcc versions of these macros which also do not have the parenthesis.
``` ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parenthesis #31: FILE: lib/eal/include/rte_per_lcore.h:42: +#define RTE_DEFINE_PER_LCORE(type, name) \ + __declspec(thread) typeof(type) per_lcore_##name ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parenthesis #34: FILE: lib/eal/include/rte_per_lcore.h:45: +#define RTE_DECLARE_PER_LCORE(type, name) \ + extern __declspec(thread) typeof(type) per_lcore_##name ```
v2:
* invert macro test for msvc #ifndef -> #ifdef
Tyler Retzlaff (1):
eal: provide per lcore macros for MSVC
lib/eal/include/rte_per_lcore.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
PATCH v2 1/1 eal: provide per lcore macros for MSVC
Provide per lcore macros that use __declspec(thread) and uses C23 typeof.
--- lib/eal/include/rte_per_lcore.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
lib/eal/include/rte_per_lcore.h +9 -1
@@ -24,19 +24,27 @@#include <pthread.h> +#ifdef RTE_TOOLCHAIN_MSVC /** * Macro to define a per lcore variable "var" of type "type", don't * use keywords like "static" or "volatile" in type, just prefix the * whole macro. */ #define RTE_DEFINE_PER_LCORE (type, name) \ - __thread __typeof__(type) per_lcore_##name + __declspec(thread) typeof(type) per_lcore_##name/** * Macro to declare an extern per lcore variable "var" of type "type" */ #define RTE_DECLARE_PER_LCORE (type, name) \ + extern __declspec(thread) typeof(type) per_lcore_##name +#else +#define RTE_DEFINE_PER_LCORE (type, name) \ + __thread __typeof__(type) per_lcore_##name + +#define RTE_DECLARE_PER_LCORE (type, name) \ extern __thread __typeof__(type) per_lcore_##name +#endif /** * Read/write the per-lcore variable value
Signature · 1 line
1.8.3.1
Re: [PATCH v2] eal: provide per lcore macros for MSVC
Quoted 5 lines · On Tue, 11 Jul 2023 08:52:27 -0700 Tyler Retzlaff…
Provide per lcore macros that use
__declspec(thread)and uses C23 typeof.Signed-off-by Tyler Retzlaff <[email protected]>---
David Marchand
AppliedRe: [PATCH v2] eal: provide per lcore macros for MSVC
Quoted 9 lines · Stephen Hemminger
Quoted 4 lines · On Tue, 11 Jul 2023 08:52:27 -0700 Tyler Retzlaff…
Provide per lcore macros that use
__declspec(thread)and uses C23 typeof.Signed-off-by Tyler Retzlaff <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand
Re: [PATCH v2] eal: provide per lcore macros for MSVC
In reply to Tyler Retzlaff11/07/2023 17:52, Tyler Retzlaff:
Quoted 12 lines
lib/eal/include/rte_per_lcore.h +2
-1+#ifdef RTE_TOOLCHAIN_MSVC /** * Macro to define a per lcore variable "var" of type "type", don't * use keywords like "static" or "volatile" in type, just prefix the * whole macro. */ #define RTE_DEFINE_PER_LCORE (type, name) \ - __thread __typeof__(type) per_lcore_##name + __declspec(thread) typeof(type) per_lcore_##name/** * Macro to declare an extern per lcore variable "var" of type "type"
lib/eal/include/rte_per_lcore.h line 47
Quoted 10 lines
lib/eal/include/rte_per_lcore.h +7
-0*/ #define RTE_DECLARE_PER_LCORE (type, name) \ + extern __declspec(thread) typeof(type) per_lcore_##name +#else +#define RTE_DEFINE_PER_LCORE (type, name) \ + __thread __typeof__(type) per_lcore_##name + +#define RTE_DECLARE_PER_LCORE (type, name) \ extern __thread __typeof__(type) per_lcore_##name +#endif
I'm afraid you damaged the doxygen document here. Please check what happens when generating doxygen. I suppose it does not take the RTE_TOOLCHAIN_MSVC path, so it does not find any comment.
Re: [PATCH v2] eal: provide per lcore macros for MSVC
Quoted 20 lines · Thomas Monjalon
11/07/2023 17:52, Tyler Retzlaff:
Quoted 19 lines
lib/eal/include/rte_per_lcore.h +7
-1+#ifdef RTE_TOOLCHAIN_MSVC /** * Macro to define a per lcore variable "var" of type "type", don't * use keywords like "static" or "volatile" in type, just prefix the * whole macro. */ #define RTE_DEFINE_PER_LCORE (type, name) \ - __thread __typeof__(type) per_lcore_##name + __declspec(thread) typeof(type) per_lcore_##name/** * Macro to declare an extern per lcore variable "var" of type "type" */ #define RTE_DECLARE_PER_LCORE (type, name) \ + extern __declspec(thread) typeof(type) per_lcore_##name +#else +#define RTE_DEFINE_PER_LCORE (type, name) \ + __thread __typeof__(type) per_lcore_##name +
Quoted 8 lines
lib/eal/include/rte_per_lcore.h line 47
Quoted 3 lines
lib/eal/include/rte_per_lcore.h +2
-0+#define RTE_DECLARE_PER_LCORE (type, name) \ extern __thread __typeof__(type) per_lcore_##name +#endif I'm afraid you damaged the doxygen document here. Please check what happens when generating doxygen. I suppose it does not take the
RTE_TOOLCHAIN_MSVCpath, so it does not find any comment.
Thanks Thomas i will look into fixing it.
Quoted 2 lines
Re: [PATCH v2] eal: provide per lcore macros for MSVC
01/09/2023 01:08, Tyler Retzlaff:
Quoted 30 lines · Thomas Monjalon
Quoted 20 lines
11/07/2023 17:52, Tyler Retzlaff:
Quoted 19 lines
lib/eal/include/rte_per_lcore.h +7
-1+#ifdef RTE_TOOLCHAIN_MSVC /** * Macro to define a per lcore variable "var" of type "type", don't * use keywords like "static" or "volatile" in type, just prefix the * whole macro. */ #define RTE_DEFINE_PER_LCORE (type, name) \ - __thread __typeof__(type) per_lcore_##name + __declspec(thread) typeof(type) per_lcore_##name/** * Macro to declare an extern per lcore variable "var" of type "type" */ #define RTE_DECLARE_PER_LCORE (type, name) \ + extern __declspec(thread) typeof(type) per_lcore_##name +#else +#define RTE_DEFINE_PER_LCORE (type, name) \ + __thread __typeof__(type) per_lcore_##name +Quoted 8 lines
lib/eal/include/rte_per_lcore.h line 47
Quoted 3 lines
lib/eal/include/rte_per_lcore.h +2
-0+#define RTE_DECLARE_PER_LCORE (type, name) \ extern __thread __typeof__(type) per_lcore_##name +#endif I'm afraid you damaged the doxygen document here. Please check what happens when generating doxygen. I suppose it does not take the
RTE_TOOLCHAIN_MSVCpath, so it does not find any comment.
Quoted 1 line
Thanks Thomas i will look into fixing it.
Please can you send the fix?
Re: [PATCH v2] eal: provide per lcore macros for MSVC
Quoted 31 lines · Thomas Monjalon
01/09/2023 01:08, Tyler Retzlaff:
Quoted 30 lines · Thomas Monjalon
Quoted 28 lines
11/07/2023 17:52, Tyler Retzlaff:
Quoted 12 lines
lib/eal/include/rte_per_lcore.h +2
-1+#ifdef RTE_TOOLCHAIN_MSVC /** * Macro to define a per lcore variable "var" of type "type", don't * use keywords like "static" or "volatile" in type, just prefix the * whole macro. */ #define RTE_DEFINE_PER_LCORE (type, name) \ - __thread __typeof__(type) per_lcore_##name + __declspec(thread) typeof(type) per_lcore_##name/** * Macro to declare an extern per lcore variable "var" of type "type" lib/eal/include/rte_per_lcore.h line 47
Quoted 10 lines
lib/eal/include/rte_per_lcore.h +7
-0*/ #define RTE_DECLARE_PER_LCORE (type, name) \ + extern __declspec(thread) typeof(type) per_lcore_##name +#else +#define RTE_DEFINE_PER_LCORE (type, name) \ + __thread __typeof__(type) per_lcore_##name + +#define RTE_DECLARE_PER_LCORE (type, name) \ extern __thread __typeof__(type) per_lcore_##name +#endif I'm afraid you damaged the doxygen document here. Please check what happens when generating doxygen. I suppose it does not take the
RTE_TOOLCHAIN_MSVCpath, so it does not find any comment.
Quoted 4 lines
Quoted 1 line
Thanks Thomas i will look into fixing it.
Please can you send the fix?
Sure, do you want me to just move the documentation to the non MSVC path or do you have another prefered solution in mind?