Skip to contentSkip to conversation

make dpdk buildable with latest msvc

PATCH Superseded Tyler Retzlaff 3 participants 8 messages Oct 17, 2023 – Oct 31, 2023 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover make dpdk buildable with latest msvc

This series makes some minor temporary modifications to the MSVC build to allow DPDK to be buildable. The changes are only temporary to allow Windows/MSVC CI pipeline to be established.

Warnings will be made clean in a future series and avoidance of STDC atomics check will be removed when the publicly available compiler is formally released.

With this series applied you can do the following from a "Developer Command Prompt for VS 2022 Preview" with Visual Studio 17.8.0 Preview 3.0 installed.

  meson setup --werror -Denable_stdatomic=true b
  meson compile -C b

Tyler Retzlaff (2):
build: temporarily disable MSVC warnings
eal: temporarily disable standard c atomics support for MSVC

 config/meson.build              | 3 +++
 lib/eal/include/rte_stdatomic.h | 2 ++
 2 files changed, 5 insertions(+)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/2 build: temporarily disable MSVC warnings

Temporarily disable integer truncation and conversion warnings for MSVC to allow CI pipeline to be established.

---
 config/meson.build | 3 +++
 1 file changed, 3 insertions(+)
config/meson.build +3 -0
index d56b0f9..6e8320e 100644
@@ -36,6 +36,9 @@ if is_ms_compiler
     # the MSVC compiler regards as unsafe but are used by DPDK
     dpdk_conf.set('_CRT_SECURE_NO_WARNINGS', 1)
 
+    # temporarily disable msvc specific warnings
+    add_project_arguments('/wd4244', '/wd4267', language: 'c')
+
     # enable non-locking atomic operations
     add_project_arguments('/experimental:c11atomics', language: 'c')
 
Signature · 1 line
1.8.3.1
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] build: temporarily disable MSVC warnings

Quoted 13 lines · Tyler Retzlaff

Temporarily disable integer truncation and conversion warnings for MSVC to allow CI pipeline to be established.

---
 config/meson.build | 3 +++
 1 file changed, 3 insertions(+)
config/meson.build +0 -0
index d56b0f9..6e8320e 100644

config/meson.build if is_ms_compiler · line 41

Quoted 6 lines
config/meson.build +3 -0
@@ -36,6 +36,9 @@ if is_ms_compiler
     # the MSVC compiler regards as unsafe but are used by DPDK
     dpdk_conf.set('_CRT_SECURE_NO_WARNINGS', 1)
 
+    # temporarily disable msvc specific warnings
+    add_project_arguments('/wd4244', '/wd4267', language: 'c')
+

Please add a comment line above indicating what the warning is being disabled, e.g. unsigned compare warning etc.

#3 lore raw

PATCH 2/2 eal: temporarily disable standard c atomics support for MSVC

In reply to Tyler Retzlaff

MSVC will define __STDC_NO_ATOMICS__ until versions of the compiler that support atomics is released. Currently we use the Preview version of the compiler so skip the test of __STDC_NO_ATOMICS__ avoiding failure.

This is a temporary change until the required compiler is released publicly but allows us to establish the MSVC CI pipeline.

---
 lib/eal/include/rte_stdatomic.h | 2 ++
 1 file changed, 2 insertions(+)
lib/eal/include/rte_stdatomic.h +2 -0
index 8579e2d..7a081cb 100644
@@ -12,9 +12,11 @@
 #endif
 
 #ifdef RTE_ENABLE_STDATOMIC
+#ifndef _MSC_VER
 #ifdef __STDC_NO_ATOMICS__
 #error enable_stdatomic=true but atomics not supported by toolchain
 #endif
+#endif
 
 #include <stdatomic.h>
 
Signature · 1 line
1.8.3.1
#4 lore raw

v2 cover make dpdk buildable with latest msvc

In reply to Tyler Retzlaff

This series makes some minor temporary modifications to the MSVC build to allow DPDK to be buildable. The changes are only temporary to allow Windows/MSVC CI pipeline to be established.

Warnings will be made clean in a future series and avoidance of STDC atomics check will be removed when the publicly available compiler is formally released.

With this series applied you can do the following from a "Developer Command Prompt for VS 2022 Preview" with Visual Studio 17.8.0 Preview 3.0 installed.

  meson setup --werror -Denable_stdatomic=true b
  meson compile -C b

v2:
* provide comments indicating which warnings are being disabled

Tyler Retzlaff (2):
build: temporarily disable MSVC warnings
eal: disable standard c atomics support check for MSVC

 config/meson.build              | 5 +++++
 lib/eal/include/rte_stdatomic.h | 2 ++
 2 files changed, 7 insertions(+)
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH v2 1/2 build: temporarily disable MSVC warnings

Temporarily disable integer truncation and conversion warnings for MSVC to allow CI pipeline to be established.

---
 config/meson.build | 5 +++++
 1 file changed, 5 insertions(+)
config/meson.build +5 -0
index d56b0f9..0968351 100644
@@ -36,6 +36,11 @@ if is_ms_compiler
     # the MSVC compiler regards as unsafe but are used by DPDK
     dpdk_conf.set('_CRT_SECURE_NO_WARNINGS', 1)
 
+    # temporarily disable msvc specific warnings
+    # - 4244 compiler detected conversion of integer to smaller type
+    # - 4267 compiler detected conversion of size_t to smaller type
+    add_project_arguments('/wd4244', '/wd4267', language: 'c')
+
     # enable non-locking atomic operations
     add_project_arguments('/experimental:c11atomics', language: 'c')
 
Signature · 1 line
1.8.3.1
#6 lore raw

PATCH v2 2/2 eal: disable standard c atomics support check for MSVC

In reply to Tyler Retzlaff

MSVC will define __STDC_NO_ATOMICS__ until versions of the compiler that support atomics is released. Currently we use the Preview version of the compiler so skip the test of __STDC_NO_ATOMICS__ avoiding failure.

This is a temporary change until the required compiler is released publicly but allows us to establish the MSVC CI pipeline.

---
 lib/eal/include/rte_stdatomic.h | 2 ++
 1 file changed, 2 insertions(+)
lib/eal/include/rte_stdatomic.h +2 -0
index 8579e2d..7a081cb 100644
@@ -12,9 +12,11 @@
 #endif
 
 #ifdef RTE_ENABLE_STDATOMIC
+#ifndef _MSC_VER
 #ifdef __STDC_NO_ATOMICS__
 #error enable_stdatomic=true but atomics not supported by toolchain
 #endif
+#endif
 
 #include <stdatomic.h>
 
Signature · 1 line
1.8.3.1
#7 lore raw
In reply to Tyler Retzlaff
Quoted 19 lines · Tyler Retzlaff

This series makes some minor temporary modifications to the MSVC build to allow DPDK to be buildable. The changes are only temporary to allow Windows/MSVC CI pipeline to be established.

Warnings will be made clean in a future series and avoidance of STDC atomics check will be removed when the publicly available compiler is formally released.

With this series applied you can do the following from a "Developer Command Prompt for VS 2022 Preview" with Visual Studio 17.8.0 Preview 3.0 installed.

  meson setup --werror -Denable_stdatomic=true b
  meson compile -C b

v2:
* provide comments indicating which warnings are being disabled

Quoted 8 lines

Tyler Retzlaff (2):
build: temporarily disable MSVC warnings
eal: disable standard c atomics support check for MSVC

 config/meson.build              | 5 +++++
 lib/eal/include/rte_stdatomic.h | 2 ++
 2 files changed, 7 insertions(+)

Series applied, thanks.

Signature · 1 line
David Marchand