diff --git a/modules/vstudio/tests/vc2019/test_compile_settings.lua b/modules/vstudio/tests/vc2019/test_compile_settings.lua index 0ccc1b996..19366fc8e 100644 --- a/modules/vstudio/tests/vc2019/test_compile_settings.lua +++ b/modules/vstudio/tests/vc2019/test_compile_settings.lua @@ -198,7 +198,7 @@ -- function suite.disableSpecificWarningsWithClang() - disablewarnings { "disable" } + disablewarnings { "warningID" } toolset "clang" prepare() test.capture [[ @@ -206,7 +206,7 @@ NotUsing Level3 Disabled - -Wno-disable %(AdditionalOptions) + -Wno-warningID %(AdditionalOptions) ]] end @@ -215,7 +215,7 @@ -- function suite.fatalSpecificWarningsWithClang() - fatalwarnings { "disable" } + fatalwarnings { "warningID" } toolset "clang" prepare() test.capture [[ @@ -223,6 +223,35 @@ NotUsing Level3 Disabled - -Werror=disable %(AdditionalOptions) + -Werror=warningID %(AdditionalOptions) + ]] + end + +-- +-- Enable specific warnings. +-- + + function suite.enableSpecificWarnings() + enablewarnings { "warningID" } + prepare() + test.capture [[ + + NotUsing + Level3 + Disabled + /w1warningID %(AdditionalOptions) + ]] + end + + function suite.enableSpecificWarningsWithClang() + enablewarnings { "warningID" } + toolset "clang" + prepare() + test.capture [[ + + NotUsing + Level3 + Disabled + -WwarningID %(AdditionalOptions) ]] end diff --git a/modules/vstudio/vs2010_vcxproj.lua b/modules/vstudio/vs2010_vcxproj.lua index 0dc4d555d..0d05c65ea 100644 --- a/modules/vstudio/vs2010_vcxproj.lua +++ b/modules/vstudio/vs2010_vcxproj.lua @@ -2150,6 +2150,7 @@ if cfg.toolset and cfg.toolset:startswith("msc") then local value = iif(cfg.unsignedchar, "On", "Off") table.insert(opts, p.tools.msc.shared.unsignedchar[value]) + opts = table.join(opts, table.translate(cfg.enablewarnings, function(enable) return '/w1' .. enable end)) elseif _ACTION >= "vs2019" and cfg.toolset and cfg.toolset == "clang" then local value = iif(cfg.unsignedchar, "On", "Off") table.insert(opts, p.tools.msc.shared.unsignedchar[value]) @@ -2163,6 +2164,7 @@ end opts = table.join(opts, table.translate(cfg.disablewarnings, function(disable) return '-Wno-' .. disable end)) opts = table.join(opts, table.translate(p.filterFatalWarnings(cfg.fatalwarnings), function(disable) return '-Werror=' .. disable end)) + opts = table.join(opts, table.translate(cfg.enablewarnings, function(enable) return '-W' .. enable end)) end if #opts > 0 then