Copilot commented on code in PR #50979:
URL: https://github.com/apache/arrow/pull/50979#discussion_r3850188713
##########
cpp/cmake_modules/SetupCxxFlags.cmake:
##########
@@ -218,22 +218,11 @@ if(WIN32)
set(CXX_COMMON_FLAGS "/W3 /EHsc")
endif()
- # Disable C5105 (macro expansion producing 'defined' has undefined
- # behavior) warning because there are codes that produce this
- # warning in Windows Kits. e.g.:
- #
- # #define _CRT_INTERNAL_NONSTDC_NAMES
\
- # (
\
- # ( defined _CRT_DECLARE_NONSTDC_NAMES &&
_CRT_DECLARE_NONSTDC_NAMES) || \
- # (!defined _CRT_DECLARE_NONSTDC_NAMES && !__STDC__
) \
- # )
+ # Enable the conforming preprocessor to support C++20 features.
#
# See also:
- # * C5105:
https://docs.microsoft.com/en-US/cpp/error-messages/compiler-warnings/c5105
- # * Related reports:
- # *
https://developercommunity.visualstudio.com/content/problem/387684/c5105-with-stdioh-and-experimentalpreprocessor.html
- # *
https://developercommunity.visualstudio.com/content/problem/1249671/stdc17-generates-warning-compiling-windowsh.html
- set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd5105")
+ # *
https://devblogs.microsoft.com/cppblog/announcing-full-support-for-a-c-c-conformant-preprocessor-in-msvc/
+ set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /Zc:preprocessor")
Review Comment:
Enabling `/Zc:preprocessor` does not remove C5105 for Windows SDKs that
still expand `defined` from a macro; those headers are the reason this
suppression was present. Because Debug builds add `/WX` in this file, users
with such an SDK can now fail when including Windows headers. Please retain
`/wd5105` (or gate its removal on a supported SDK version).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]