Merge pull request #1447 from ethan-wallace/vs-warnings

Added /Wall to possible warning levels for Visual Studio
This commit is contained in:
Samuel Surtees 2020-06-21 15:37:56 +10:00 committed by GitHub
commit 2cee14c124
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 175 additions and 17 deletions

View File

@ -305,6 +305,7 @@
Default = "-wi",
High = "-wi",
Extra = "-wi",
Everything = "-wi",
},
}

View File

@ -85,6 +85,7 @@
-- Default = "-w", -- TODO: check this...
High = "-Wall",
Extra = "-Wall -Wextra",
Everything = "-Weverything",
},
symbols = {
On = "-g",

View File

@ -121,6 +121,7 @@
Default = "-wi",
High = "-wi",
Extra = "-wi", -- TODO: is there a way to get extra warnings?
Everything = "-wi",
},
symbols = {
On = "-g",

View File

@ -332,6 +332,23 @@
]]
end
function suite.runtimeLibraryIsDebug_onHighWarnings()
warnings "High"
prepare()
test.capture [[
<Tool
Name="VCCLCompilerTool"
Optimization="0"
BasicRuntimeChecks="3"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
DebugInformationFormat="0"
/>
]]
end
--
-- Verify the correct warnings settings are used when FatalWarnings are enabled.

View File

@ -76,6 +76,18 @@
]]
end
--
-- Ensure that high warnings lead to the level 4 debug option
--
function suite.warningLevel_onHighWarnings()
warnings "High"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
]]
end
--
-- If extra warnings is specified, pump up the volume.
@ -91,6 +103,20 @@
]]
end
--
-- If Everything is wanted, turn it ALL on
--
function suite.warningLevel_onEverythingWarnings()
warnings "Everything"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>EnableAllWarnings</WarningLevel>
]]
end
--
-- If the warnings are disabled, mute all warnings.
--
@ -105,6 +131,20 @@
]]
end
--
-- Check default warning level.
--
function suite.warningLevel_onDefaultWarnings()
warnings "Default"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
]]
end
--
-- If warnings are turned off, the fatal warnings flags should
-- not be generated.

View File

@ -1594,6 +1594,8 @@
local level
if cfg.warnings == p.OFF then
level = "0"
elseif cfg.warnings == "High" then
level = "4"
elseif cfg.warnings == "Extra" then
level = "4"
elseif not filecfg then

View File

@ -2727,13 +2727,13 @@
function m.warningLevel(cfg)
local map = { Off = "TurnOffAllWarnings", Extra = "Level4" }
local map = { Off = "TurnOffAllWarnings", High = "Level4", Extra = "Level4", Everything = "EnableAllWarnings" }
m.element("WarningLevel", nil, map[cfg.warnings] or "Level3")
end
function m.warningLevelFile(cfg, condition)
local map = { Off = "TurnOffAllWarnings", Extra = "Level4" }
local map = { Off = "TurnOffAllWarnings", High = "Level4", Extra = "Level4", Everything = "EnableAllWarnings" }
if cfg.warnings then
m.element("WarningLevel", condition, map[cfg.warnings] or "Level3")
end

View File

@ -2332,6 +2332,55 @@
]]
end
function suite.XCBuildConfigurationProject_OnNoWarnings()
warnings "Off"
prepare()
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
test.capture [[
A14350AC4595EE5E57CE36EC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
GCC_OPTIMIZATION_LEVEL = 0;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = obj/Debug;
ONLY_ACTIVE_ARCH = NO;
SYMROOT = bin/Debug;
WARNING_CFLAGS = "-w";
};
name = Debug;
};
]]
end
function suite.XCBuildConfigurationProject_OnHighWarnings()
warnings "High"
prepare()
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
test.capture [[
A14350AC4595EE5E57CE36EC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
GCC_OPTIMIZATION_LEVEL = 0;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = obj/Debug;
ONLY_ACTIVE_ARCH = NO;
SYMROOT = bin/Debug;
WARNING_CFLAGS = "-Wall";
};
name = Debug;
};
]]
end
function suite.XCBuildConfigurationProject_OnExtraWarnings()
warnings "Extra"
@ -2359,6 +2408,32 @@
end
function suite.XCBuildConfigurationProject_OnEverythingWarnings()
warnings "Everything"
prepare()
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
test.capture [[
A14350AC4595EE5E57CE36EC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
GCC_OPTIMIZATION_LEVEL = 0;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = obj/Debug;
ONLY_ACTIVE_ARCH = NO;
SYMROOT = bin/Debug;
WARNING_CFLAGS = "-Weverything";
};
name = Debug;
};
]]
end
function suite.XCBuildConfigurationProject_OnFatalWarnings()
flags { "FatalWarnings" }
prepare()

View File

@ -1450,8 +1450,14 @@
settings['SYMROOT'] = path.getrelative(tr.project.location, targetdir)
end
if cfg.warnings == "Extra" then
if cfg.warnings == "Off" then
settings['WARNING_CFLAGS'] = '-w'
elseif cfg.warnings == "High" then
settings['WARNING_CFLAGS'] = '-Wall'
elseif cfg.warnings == "Extra" then
settings['WARNING_CFLAGS'] = '-Wall -Wextra'
elseif cfg.warnings == "Everything" then
settings['WARNING_CFLAGS'] = '-Weverything'
end
overrideSettings(settings, cfg.xcodebuildsettings)

View File

@ -1309,6 +1309,7 @@
"Default",
"High",
"Extra",
"Everything",
}
}

View File

@ -101,9 +101,10 @@
RDRND = "-mrdrnd",
},
warnings = {
Extra = {"-Wall", "-Wextra"},
High = "-Wall",
Off = "-w",
High = "-Wall",
Extra = {"-Wall", "-Wextra"},
Everything = "-Weverything",
},
symbols = function(cfg, mappings)
local values = gcc.getdebugformat(cfg)

View File

@ -80,9 +80,10 @@
["SSE4.1"] = "/arch:SSE2",
},
warnings = {
Extra = "/W4",
High = "/W4",
Off = "/W0",
High = "/W4",
Extra = "/W4",
Everything = "/Wall",
},
staticruntime = {
-- this option must always be emit (does it??)

View File

@ -74,16 +74,28 @@
-- Check the translation of CFLAGS.
--
function suite.cflags_onNoWarnings()
warnings "Off"
prepare()
test.contains({ "-w" }, gcc.getcflags(cfg))
end
function suite.cflags_onHighWarnings()
warnings "High"
prepare()
test.contains({ "-Wall" }, gcc.getcflags(cfg))
end
function suite.cflags_onExtraWarnings()
warnings "extra"
warnings "Extra"
prepare()
test.contains({ "-Wall", "-Wextra" }, gcc.getcflags(cfg))
end
function suite.cflags_onHighWarnings()
warnings "high"
function suite.cflags_onEverythingWarnings()
warnings "Everything"
prepare()
test.contains({ "-Wall" }, gcc.getcflags(cfg))
test.contains({ "-Weverything" }, gcc.getcflags(cfg))
end
function suite.cflags_onFatalWarnings()
@ -112,12 +124,6 @@
test.contains({ "-ffloat-store" }, gcc.getcflags(cfg))
end
function suite.cflags_onNoWarnings()
warnings "Off"
prepare()
test.contains({ "-w" }, gcc.getcflags(cfg))
end
function suite.cflags_onSSE()
vectorextensions "SSE"
prepare()

View File

@ -224,6 +224,12 @@
test.contains("/W4", msc.getcflags(cfg))
end
function suite.cflags_OnEverythingWarnings()
warnings "Everything"
prepare()
test.contains("/Wall", msc.getcflags(cfg))
end
function suite.cflags_OnFatalWarnings()
flags "FatalWarnings"
prepare()