When the option "/Zc:__cplusplus" is not specified explicitly, macro's value is "199711L", and gtest cannot determine c++11 support correctly.
https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus
Differential D84023
Make MSVC generate appropriate __cplusplus macro definition tatyana-krasnukha on Jul 17 2020, 6:36 AM. Authored by
Details When the option "/Zc:__cplusplus" is not specified explicitly, macro's value is "199711L", and gtest cannot determine c++11 support correctly. https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus
Diff Detail
Unit Tests Event TimelineComment Actions No updates, just to trigger rebasing onto master where tests should be already fixed. Comment Actions It also fixes warnings about using deprecated std::tr1, which became errors in VS 2019, produced while compiling lldbUtilityHelpers project (http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/17887/steps/test/logs/stdio). Comment Actions I think this should be okay. VS2017 or higher are required to build LLVM and this support is in VS2017. Comment Actions LLVM documentation says: "You will need Visual Studio 2017 or higher, with the latest Update installed". Does this mean Visual Studio 2017 version 15.9? Because the /Zc:__cplusplus option is available starting in Visual Studio 2017 version 15.7. That's why this patch led to multiple warnings on the lldb-x64-windows-ninja buildbot, which uses Visual Studio 2017 version 15.0, and I don't know whether I should revert the commit or not. Comment Actions The warning is due to the version of Gtest that LLVM is using. Here's a discussion of the problem and a solution is to update to Gtest 1.8.1 LLVM is using a fork of Gtest 1.8.0. Comment Actions The option "/Zc:__cplusplus" solves this problem. With this option passed, Gtest doesn't try using namespace tr1. I don't have such warnings if pass this option. Though, Gtest 1.8.1 will be required anyway when LLVM will switch to C++17. Comment Actions I see. The option "/Zc:__cplusplus" affects GTEST_LANG_CXX11 but not GTEST_HAS_TR1_TUPLE. I didn't have warnings just because my LLVM fork uses C++17. |