Skip to content

Commit

Permalink
[cmake][msvc] Enable standards-conforming preprocessor
Browse files Browse the repository at this point in the history
Since we now only support Visual Studio 2019 16.7 and newer, we're able to use the /Zc:preprocessor flag that turns on the standards-conforming preprocessor. Among other things, it correctly expands __VA_ARGS__. This enables removal of some boilerplate in D135128.

Reviewed By: Bigcheese, thieta

Differential Revision: https://reviews.llvm.org/D135128
  • Loading branch information
jansvoboda11 committed Nov 2, 2022
1 parent 4b21ecf commit 12d8e7c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llvm/cmake/modules/HandleLLVMOptions.cmake
Expand Up @@ -481,6 +481,10 @@ if( MSVC )

append("/Zc:inline" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)

# Enable standards-conforming preprocessor.
# https://learn.microsoft.com/en-us/cpp/build/reference/zc-preprocessor
append("/Zc:preprocessor" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)

# Some projects use the __cplusplus preprocessor macro to check support for
# a particular version of the C++ standard. When this option is not specified
# explicitly, macro's value is "199711L" that implies C++98 Standard.
Expand Down

0 comments on commit 12d8e7c

Please sign in to comment.