diff --git a/docs/markdown/snippets/msvc_cplusplus_define.md b/docs/markdown/snippets/msvc_cplusplus_define.md deleted file mode 100644 index eabfbe86e..000000000 --- a/docs/markdown/snippets/msvc_cplusplus_define.md +++ /dev/null @@ -1,7 +0,0 @@ -## MSVC now sets the __cplusplus #define accurately - -For reasons, MSVC will always return `199711L` for `__cplusplus`, even when a -newer c++ standard is explicitly requested, unless you pass a specific option to -the compiler for MSVC 2017 15.7 and newer. Older versions are unaffected by -this. Meson now always sets the option if it is available, as it is unlikley -that users want the default behavior. diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 057a39acd..44155d1bd 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -692,17 +692,6 @@ class VisualStudioCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixi del args[i] return args - def get_always_args(self) -> T.List[str]: - args = super().get_always_args() - - # update the __cplusplus #define to match the version given on the - # command line with /std:NNN, but only for versions above 15.7 (2017) - # https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-160 - if version_compare(self.version, '>= 15.7'): - args.append('/Zc:__cplusplus') - - return args - class ClangClCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixin, ClangClCompiler, CPPCompiler): def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', target: str, diff --git a/test cases/windows/18 msvc cplusplus define/main.cpp b/test cases/windows/18 msvc cplusplus define/main.cpp deleted file mode 100644 index bc0b1fdf2..000000000 --- a/test cases/windows/18 msvc cplusplus define/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -int main() { -#if __cplusplus == 199711L - return 1; -#else - return 0; -#endif -} diff --git a/test cases/windows/18 msvc cplusplus define/meson.build b/test cases/windows/18 msvc cplusplus define/meson.build deleted file mode 100644 index 92cf31628..000000000 --- a/test cases/windows/18 msvc cplusplus define/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('msvc __cplusplus', 'cpp', default_options : ['cpp_std=c++14']) - -cpp = meson.get_compiler('cpp') - -if cpp.get_id() != 'msvc' - error('MESON_SKIP_TEST: test is only relavent for msvc') -elif meson.project_version().version_compare('< 15.7') - error('MESON_SKIP_TEST: test is only relavent for msvc versions >= 15.7') -endif - -test( - 'main', - executable('main', 'main.cpp'), -) diff --git a/test cases/windows/3 cpp/meson.build b/test cases/windows/3 cpp/meson.build index a9e6569aa..7b8080e54 100644 --- a/test cases/windows/3 cpp/meson.build +++ b/test cases/windows/3 cpp/meson.build @@ -1,4 +1,4 @@ -project('wincpp', 'cpp', default_options : ['cpp_std=c++14']) +project('wincpp', 'cpp') exe = executable('prog', 'prog.cpp') test('wincpp', exe) diff --git a/unittests/windowstests.py b/unittests/windowstests.py index f2517f2c4..935964209 100644 --- a/unittests/windowstests.py +++ b/unittests/windowstests.py @@ -359,3 +359,4 @@ class WindowsTests(BasePlatformTests): raise SkipTest('C++ modules are only supported with VS 2019 Preview or newer.') self.init(os.path.join(self.unit_test_dir, '86 cpp modules')) self.build() +