Skip to content

Commit 20b0e0a

Browse files
committed
[gn build] Stop defining GTEST_LANG_CXX11, pass /Zc:__cplusplus with msvc
Ports: * https://reviews.llvm.org/D84023 * https://reviews.llvm.org/rG4f5ccc72f6a6e (but see https://reviews.llvm.org/rG4901199f5b84b223) No intended behavior change.
1 parent 5e82ee5 commit 20b0e0a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

llvm/utils/gn/build/BUILD.gn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ config("compiler_defaults") {
183183
cflags += [ "/EHs-c-" ]
184184
cflags_cc += [ "/std:c++17" ]
185185

186+
# cl.exe doesn't set __cplusplus correctly by default.
187+
# clang-cl gets it right by default, so don't needlessly add the flag there.
188+
if (!is_clang) {
189+
cflags_cc += [ "/Zc:__cplusplus" ]
190+
}
191+
186192
# The MSVC default value (1 MB) is not enough for parsing recursive C++
187193
# templates in Clang.
188194
ldflags += [ "/STACK:10000000" ]

llvm/utils/gn/secondary/third-party/unittest/BUILD.gn

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ config("googletest_config") {
77
"googletest/include",
88
]
99

10-
# LLVM requires C++11 but gtest doesn't correctly detect the availability
11-
# of C++11 on MSVC, so we force it on.
12-
defines = [ "GTEST_LANG_CXX11" ]
10+
defines = []
1311
if (host_os == "win") {
1412
defines += [ "GTEST_OS_WINDOWS" ]
1513
}

0 commit comments

Comments
 (0)