diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 3599a995c..436f69982 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -1247,7 +1247,10 @@ class VisualStudioCCompiler(CCompiler): return ['/MDd'] def get_buildtype_args(self, buildtype): - return compilers.msvc_buildtype_args[buildtype] + args = compilers.msvc_buildtype_args[buildtype] + if version_compare(self.version, '<18.0'): + args = [arg for arg in args if arg != '/Gw'] + return args def get_buildtype_linker_args(self, buildtype): return compilers.msvc_buildtype_linker_args[buildtype] diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 34397aaf4..d08671ee9 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -145,8 +145,8 @@ arm_buildtype_args = {'plain': [], msvc_buildtype_args = {'plain': [], 'debug': ["/ZI", "/Ob0", "/Od", "/RTC1"], 'debugoptimized': ["/Zi", "/Ob1"], - 'release': ["/Ob2"], - 'minsize': ["/Zi", "/Ob1"], + 'release': ["/Ob2", "/Gw"], + 'minsize': ["/Zi", "/Gw"], } apple_buildtype_linker_args = {'plain': [], @@ -267,7 +267,7 @@ msvc_optimization_args = {'0': [], '1': ['/O1'], '2': ['/O2'], '3': ['/O3'], - 's': ['/Os'], + 's': ['/O1'], # Implies /Os. } clike_debug_args = {False: [],