Add warnings(); deprecate ExtraWarnings and NoWarnings flags
This commit is contained in:
parent
686f3f071a
commit
91635859b9
@ -646,6 +646,16 @@
|
||||
kind = "key-path-list",
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "warnings",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Off",
|
||||
"Default",
|
||||
"Extra",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
@ -696,6 +706,12 @@
|
||||
return DOC_URL .. "optimize"
|
||||
end)
|
||||
|
||||
api.deprecateValue("flags", { "ExtraWarnings", "NoWarnings" }, function(value)
|
||||
local map = { ExtraWarnings = "Extra", NoWarnings = "Off" }
|
||||
warnings (map[value] or "Default")
|
||||
return DOC_URL .. "warnings"
|
||||
end)
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
--
|
||||
|
@ -1185,21 +1185,16 @@
|
||||
|
||||
|
||||
function vc200x.warnings(cfg)
|
||||
-- if NoWarnings flags specified just disable warnings, and return.
|
||||
if cfg.flags.NoWarnings then
|
||||
if cfg.warnings == "Off" then
|
||||
_p(4,'WarningLevel="0"')
|
||||
return
|
||||
end
|
||||
|
||||
-- else setup all warning blocks as needed.
|
||||
_p(4,'WarningLevel="%d"', iif(cfg.flags.ExtraWarnings, 4, 3))
|
||||
|
||||
if cfg.flags.FatalWarnings then
|
||||
_p(4,'WarnAsError="%s"', vc200x.bool(true))
|
||||
end
|
||||
|
||||
if _ACTION < "vs2008" and not cfg.flags.Managed then
|
||||
_p(4,'Detect64BitPortabilityProblems="%s"', vc200x.bool(not cfg.flags.No64BitChecks))
|
||||
else
|
||||
_p(4,'WarningLevel="%d"', iif(cfg.warnings == "Extra", 4, 3))
|
||||
if cfg.flags.FatalWarnings then
|
||||
_p(4,'WarnAsError="%s"', vc200x.bool(true))
|
||||
end
|
||||
if _ACTION < "vs2008" and not cfg.flags.Managed then
|
||||
_p(4,'Detect64BitPortabilityProblems="%s"', vc200x.bool(not cfg.flags.No64BitChecks))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1126,7 +1126,7 @@
|
||||
|
||||
|
||||
function vc2010.treatWarningAsError(cfg)
|
||||
if cfg.flags.FatalWarnings and not cfg.flags.NoWarnings then
|
||||
if cfg.flags.FatalWarnings and cfg.warnings ~= "Off" then
|
||||
_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')
|
||||
end
|
||||
end
|
||||
@ -1146,13 +1146,8 @@
|
||||
|
||||
|
||||
function vc2010.warningLevel(cfg)
|
||||
local w = "Level3"
|
||||
if cfg.flags.NoWarnings then
|
||||
w = "TurnOffAllWarnings"
|
||||
elseif cfg.flags.ExtraWarnings then
|
||||
w = "Level4"
|
||||
end
|
||||
vc2010.element(3, "WarningLevel", nil, "%s", w)
|
||||
local map = { Off = "TurnOffAllWarnings", Extra = "Level4" }
|
||||
vc2010.element(3, "WarningLevel", nil, "%s", map[cfg.warnings] or "Level3")
|
||||
end
|
||||
|
||||
|
||||
|
@ -96,9 +96,7 @@
|
||||
x64 = "-m64",
|
||||
},
|
||||
flags = {
|
||||
ExtraWarnings = "-Wall -Wextra",
|
||||
FatalWarnings = "-Werror",
|
||||
NoWarnings = "-w",
|
||||
NoFramePointer = "-fomit-frame-pointer",
|
||||
Symbols = "-g"
|
||||
},
|
||||
@ -114,6 +112,10 @@
|
||||
vectorextensions = {
|
||||
SSE = "-msse",
|
||||
SSE2 = "-msse2",
|
||||
},
|
||||
warnings = {
|
||||
Extra = "-Wall -Wextra",
|
||||
Off = "-w",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,12 +22,16 @@
|
||||
--
|
||||
|
||||
snc.cflags = {
|
||||
ExtraWarnings = "-Xdiag=2",
|
||||
FatalWarnings = "-Xquit=2",
|
||||
flags = {
|
||||
FatalWarnings = "-Xquit=2",
|
||||
},
|
||||
warnings = {
|
||||
Extra = "-Xdiag=2",
|
||||
}
|
||||
}
|
||||
|
||||
function snc.getcflags(cfg)
|
||||
local flags = table.translate(cfg.flags, snc.cflags)
|
||||
local flags = config.mapFlags(cfg, snc.cflags)
|
||||
return flags
|
||||
end
|
||||
|
||||
|
@ -327,11 +327,11 @@
|
||||
|
||||
|
||||
--
|
||||
-- Verify the correct warnings settings are used when ExtraWarnings are enabled.
|
||||
-- Verify the correct warnings settings are used when extra warnings are enabled.
|
||||
--
|
||||
|
||||
function suite.runtimeLibraryIsDebug_onExtraWarnings()
|
||||
flags { "ExtraWarnings" }
|
||||
warnings "Extra"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
@ -374,11 +374,12 @@
|
||||
|
||||
|
||||
--
|
||||
-- Verify the correct warnings settings are used when NoWarnings are enabled.
|
||||
-- Verify the correct warnings settings are used when no warnings are enabled.
|
||||
--
|
||||
|
||||
function suite.runtimeLibraryIsDebug_onNoWarnings_whichDisablesAllOtherWarningsFlags()
|
||||
flags { "NoWarnings", "ExtraWarnings", "FatalWarnings" }
|
||||
flags { "FatalWarnings" }
|
||||
warnings "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
@ -421,12 +422,12 @@
|
||||
|
||||
|
||||
--
|
||||
-- Verify the correct warnings settings are used when NoWarnings are enabled.
|
||||
-- Verify the correct warnings settings are used when no warnings are enabled.
|
||||
--
|
||||
|
||||
function suite.runtimeLibraryIsDebug_onVS2005_NoWarnings()
|
||||
_ACTION = "vs2005"
|
||||
flags { "NoWarnings" }
|
||||
warnings "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
|
@ -76,11 +76,11 @@
|
||||
|
||||
|
||||
--
|
||||
-- If the ExtraWarnings flag is specified, pump up the volume.
|
||||
-- If extra warnings is specified, pump up the volume.
|
||||
--
|
||||
|
||||
function suite.warningLevel_onExtraWarnings()
|
||||
flags "ExtraWarnings"
|
||||
warnings "Extra"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
@ -90,11 +90,11 @@
|
||||
end
|
||||
|
||||
--
|
||||
-- If the NoWarnings flag is specified, mute on warnings.
|
||||
-- If the warnings are disabled, mute all warnings.
|
||||
--
|
||||
|
||||
function suite.warningLevel_onNoWarnings()
|
||||
flags "NoWarnings"
|
||||
warnings "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
@ -104,11 +104,13 @@
|
||||
end
|
||||
|
||||
--
|
||||
-- NoWarnings disables ExtraWarnings FatalWarnings flagss.
|
||||
-- If warnings are turned off, the fatal warnings flags should
|
||||
-- not be generated.
|
||||
--
|
||||
|
||||
function suite.warningLevel_onNoWarningsOverOtherWarningsFlags()
|
||||
flags { "NoWarnings", "ExtraWarnings", "FatalWarnings" }
|
||||
flags { "FatalWarnings" }
|
||||
warnings "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
|
@ -73,7 +73,7 @@
|
||||
--
|
||||
|
||||
function suite.cflags_onExtraWarnings()
|
||||
flags { "ExtraWarnings" }
|
||||
warnings "extra"
|
||||
prepare()
|
||||
test.isequal({ "-Wall -Wextra" }, gcc.getcflags(cfg))
|
||||
end
|
||||
@ -97,7 +97,7 @@
|
||||
end
|
||||
|
||||
function suite.cflags_onNoWarnings()
|
||||
flags { "NoWarnings" }
|
||||
warnings "Off"
|
||||
prepare()
|
||||
test.isequal({ "-w" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user