windows: build warnings with clang
PATCH 1/1 windows: build warnings with clang
Compiling with Clang (11.0, --buildtype=debug) for Windows produces deprecated warnings related to secure crt functions.
Disable this by defining -D_CRT_SECURE_NO_WARNINGS.
It is unclear exactly which commit this fixes. It is probably a consequence of building more libraries for Windows.
--- config/meson.build | 5 +++++ 1 file changed, 5 insertions(+)
config/meson.build +5 -0
@@ -279,6 +279,11 @@ if is_windows add_project_arguments('-D__USE_MINGW_ANSI_STDIO', language: 'c') endif + # Disable secure CRT deprecated warnings for clang + if cc.get_id() == 'clang' + add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'c') + endif + add_project_link_arguments('-lws2_32', language: 'c') # Contrary to docs, VirtualAlloc2() is exported by mincore.lib
Signature · 1 line
2.25.1
Quoted 2 lines · Nick Connolly
Compiling with Clang (11.0, --buildtype=debug) for Windows produces deprecated warnings related to secure crt functions.
Please explain what these warnings mean and why disabling them is OK. FWIW, I examined present warnings and found no useful ones. Also, --buildtype=debug is not necessary to trigger these warnings.
Proposed wording (feel free to adjust):
Microsoft CRT defines Windows-specific secure alternatives to standard library functions and triggers warnings when "insecure" functions are used [1]. However, calling code already has all necessary checks around those functions, so these warnings are not useful for DPDK. MinGW provides its own CRT without this issue.
[1]:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/security-features-in-the-crt?view=msvc-160
Quoted 4 lines
Disable this by defining -D_CRT_SECURE_NO_WARNINGS.
It is unclear exactly which commit this fixes. It is probably a consequence of building more libraries for Windows.
Tip: Unless you want to make this paragraph part of the commit, you can write such notices below "---" line, like version info.
Quoted 22 lines
Signed-off-by Nick Connolly <[email protected]>--- config/meson.build | 5 +++++ 1 file changed, 5 insertions(+)config/meson.build +5
-0@@ -279,6 +279,11 @@ if is_windows add_project_arguments('-D__USE_MINGW_ANSI_STDIO', language: 'c') endif + # Disable secure CRT deprecated warnings for clang + if cc.get_id() == 'clang' + add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'c') + endif + add_project_link_arguments('-lws2_32', language: 'c') # Contrary to docs, VirtualAlloc2() is exported by mincore.lib
PATCH v2 1/1 windows: build warnings with clang
In reply to Nick ConnollyMicrosoft CRT defines Windows-specific secure alternatives to standard library functions and triggers warnings when "insecure" functions are used [1]. However, calling code already has all necessary checks around those functions, so these warnings are not useful for DPDK. MinGW provides its own CRT without this issue.
[1]:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/security-features-in-the-crt?view=msvc-160
Disable this by defining -D_CRT_SECURE_NO_WARNINGS.
---
v2:
* Adjust commit wording as per Dmitry Kozlyuk <[email protected]>
Note: It is unclear exactly which commit this fixes. It is probably a consequence of building more libraries for Windows.
config/meson.build | 5 +++++ 1 file changed, 5 insertions(+)
config/meson.build +5 -0
@@ -279,6 +279,11 @@ if is_windows add_project_arguments('-D__USE_MINGW_ANSI_STDIO', language: 'c') endif + # Disable secure CRT deprecated warnings for clang + if cc.get_id() == 'clang' + add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'c') + endif + add_project_link_arguments('-lws2_32', language: 'c') # Contrary to docs, VirtualAlloc2() is exported by mincore.lib
Signature · 1 line
2.25.1
Quoted 11 lines · Nick Connolly
Microsoft CRT defines Windows-specific secure alternatives to standard library functions and triggers warnings when "insecure" functions are used [1]. However, calling code already has all necessary checks around those functions, so these warnings are not useful for DPDK. MinGW provides its own CRT without this issue.
[1]:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/security-features-in-the-crt?view=msvc-160Disable this by defining -D_CRT_SECURE_NO_WARNINGS.
Quoted 7 lines
Signed-off-by Nick Connolly <[email protected]>---
v2:
* Adjust commit wording as per Dmitry Kozlyuk <[email protected]>Note: It is unclear exactly which commit this fixes. It is probably a consequence of building more libraries for Windows.
Thomas Monjalon
Applied03/12/2020 01:02, Dmitry Kozlyuk:
Quoted 17 lines · Nick Connolly
Quoted 16 lines
Microsoft CRT defines Windows-specific secure alternatives to standard library functions and triggers warnings when "insecure" functions are used [1]. However, calling code already has all necessary checks around those functions, so these warnings are not useful for DPDK. MinGW provides its own CRT without this issue.
[1]:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/security-features-in-the-crt?view=msvc-160Disable this by defining -D_CRT_SECURE_NO_WARNINGS.
Signed-off-by Nick Connolly <[email protected]>---
v2:
* Adjust commit wording as per Dmitry Kozlyuk <[email protected]>
Quoted 4 lines
Quoted 2 lines
Note: It is unclear exactly which commit this fixes. It is probably a consequence of building more libraries for Windows.
Acked-by Dmitry Kozlyuk <[email protected]>
Applied, thanks
Copying [email protected] - given that 20.11 has now been released I assume this needs to be applied there as well.
Quoted 24 lines · Thomas Monjalon
03/12/2020 01:02, Dmitry Kozlyuk:
Quoted 12 lines · Nick Connolly
Quoted 11 lines
Microsoft CRT defines Windows-specific secure alternatives to standard library functions and triggers warnings when "insecure" functions are used [1]. However, calling code already has all necessary checks around those functions, so these warnings are not useful for DPDK. MinGW provides its own CRT without this issue.
[1]:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/security-features-in-the-crt?view=msvc-160Disable this by defining -D_CRT_SECURE_NO_WARNINGS.
Quoted 8 lines
Quoted 7 lines
Signed-off-by Nick Connolly <[email protected]>---
v2:
* Adjust commit wording as per Dmitry Kozlyuk <[email protected]>Note: It is unclear exactly which commit this fixes. It is probably a consequence of building more libraries for Windows.
Acked-by Dmitry Kozlyuk <[email protected]>Applied, thanks
Xueming(Steven) Li
AppliedQuoted 2 lines · Nick Connolly
Copying [email protected] - given that 20.11 has now been released I assume this needs to be applied there as well.
This patch was ignored due to the backport scanning scripts check commit message from upstream git repo, not mail thread. Remember to add "Cc: [email protected]" in message body, or a "Fixes" tag.
Applied to 20.11.4 now.
Quoted 27 lines · Thomas Monjalon
Quoted 24 lines
03/12/2020 01:02, Dmitry Kozlyuk:
Quoted 12 lines · Nick Connolly
Quoted 11 lines
Microsoft CRT defines Windows-specific secure alternatives to standard library functions and triggers warnings when "insecure" functions are used [1]. However, calling code already has all necessary checks around those functions, so these warnings are not useful for DPDK. MinGW provides its own CRT without this issue.
Disable this by defining -D_CRT_SECURE_NO_WARNINGS.
Quoted 8 lines
Quoted 7 lines
Signed-off-by Nick Connolly <[email protected]>---
v2:
* Adjust commit wording as per Dmitry Kozlyuk <[email protected]>Note: It is unclear exactly which commit this fixes. It is probably a consequence of building more libraries for Windows.
Acked-by Dmitry Kozlyuk <[email protected]>Applied, thanks
Hi Nick,
Thanks for this patch. Could not see the deprecated warnings anymore.
Quoted 6 lines · Nick Connolly
Microsoft CRT defines Windows-specific secure alternatives to standard library functions and triggers warnings when "insecure" functions are used [1]. However, calling code already has all necessary checks around those functions, so these warnings are not useful for DPDK. MinGW provides its own CRT without this issue.
Quoted 7 lines
[1]:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/security-features-in-the-crt?view=msvc-160Disable this by defining -D_CRT_SECURE_NO_WARNINGS.
Signed-off-by Nick Connolly <[email protected]>---