Skip to content

Commit

Permalink
cmake: tell MSVC to properly report __cplusplus
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed May 16, 2024
1 parent 18a7772 commit 074ba03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmake/DaemonFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ if (MSVC)
set_c_cxx_flag("/fp:fast")
set_c_cxx_flag("/d2Zi+" RELWITHDEBINFO)

# https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
set_cxx_flag("/Zc:__cplusplus")

# At least Ninja doesn't remove the /W3 flag when we add /W4|/Wall one, which
# leads to compilation warnings. Remove /W3 entirely, as /W4|/Wall be used.
foreach(flag_var
Expand Down
2 changes: 2 additions & 0 deletions src/common/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0627r0.pdf */
// assignments so that containers move objects instead of copying them.
#if __cplusplus >= 201103
#define NOEXCEPT noexcept
#elif _MSC_VER
#define NOEXCEPT noexcept
#else
#define NOEXCEPT
#endif
Expand Down

0 comments on commit 074ba03

Please sign in to comment.