Deprecate SEH flag; add value to exceptionhandling()

This commit is contained in:
Jason Perkins 2015-06-23 19:03:28 -04:00 committed by Damien Courtois
parent 2a608f4ca4
commit 9f68132f53
6 changed files with 37 additions and 31 deletions

View File

@ -359,17 +359,7 @@
"Default", "Default",
"On", "On",
"Off", "Off",
}, "SEH"
}
api.register {
name = "rtti",
scope = "config",
kind = "string",
allowed = {
"Default",
"On",
"Off",
}, },
} }
@ -462,7 +452,7 @@
"OptimizeSpeed", -- DEPRECATED "OptimizeSpeed", -- DEPRECATED
"RelativeLinks", "RelativeLinks",
"ReleaseRuntime", -- DEPRECATED "ReleaseRuntime", -- DEPRECATED
"SEH", "SEH", -- DEPRECATED
"ShadowedVariables", "ShadowedVariables",
"StaticRuntime", "StaticRuntime",
"Symbols", "Symbols",
@ -854,6 +844,17 @@
tokens = true, tokens = true,
} }
api.register {
name = "rtti",
scope = "config",
kind = "string",
allowed = {
"Default",
"On",
"Off",
},
}
api.register { api.register {
name = "rules", name = "rules",
scope = "project", scope = "project",
@ -1174,6 +1175,13 @@
rtti "On" rtti "On"
end) end)
api.deprecateValue("flags", "SEH", 'Use `exceptionhandling "SEH"` instead',
function(value)
exceptionhandling "SEH"
end,
function(value)
exceptionhandling "Default"
end)
api.deprecateValue("flags", "Unsafe", nil, api.deprecateValue("flags", "Unsafe", nil,
function(value) function(value)
@ -1291,6 +1299,8 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
clr "Off" clr "Off"
exceptionhandling "Default"
rtti "Default"
-- Setting a default language makes some validation easier later -- Setting a default language makes some validation easier later

View File

@ -1124,7 +1124,7 @@
function m.exceptionHandling(cfg) function m.exceptionHandling(cfg)
if cfg.exceptionhandling == p.OFF then if cfg.exceptionhandling == p.OFF then
p.w('ExceptionHandling="%s"', iif(_ACTION < "vs2005", "FALSE", 0)) p.w('ExceptionHandling="%s"', iif(_ACTION < "vs2005", "FALSE", 0))
elseif cfg.flags.SEH and _ACTION > "vs2003" then elseif cfg.exceptionhandling == "SEH" and _ACTION > "vs2003" then
p.w('ExceptionHandling="2"') p.w('ExceptionHandling="2"')
end end
end end

View File

@ -1098,14 +1098,11 @@
function m.exceptionHandling(cfg) function m.exceptionHandling(cfg)
local value
if cfg.exceptionhandling == p.OFF then if cfg.exceptionhandling == p.OFF then
p.w('<ExceptionHandling>false</ExceptionHandling>') p.w('<ExceptionHandling>false</ExceptionHandling>')
elseif cfg.exceptionhandling == p.ON or cfg.flags.SEH then elseif cfg.exceptionhandling == "SEH" then
if cfg.flags.SEH then
p.w('<ExceptionHandling>Async</ExceptionHandling>') p.w('<ExceptionHandling>Async</ExceptionHandling>')
else
p.w('<ExceptionHandling>Sync</ExceptionHandling>')
end
end end
end end

View File

@ -40,7 +40,6 @@
MultiProcessorCompile = "/MP", MultiProcessorCompile = "/MP",
NoFramePointer = "/Oy", NoFramePointer = "/Oy",
NoMinimalRebuild = "/Gm-", NoMinimalRebuild = "/Gm-",
SEH = "/EHa",
Symbols = "/Z7", Symbols = "/Z7",
OmitDefaultLibrary = "/Zl", OmitDefaultLibrary = "/Zl",
}, },
@ -106,6 +105,11 @@
-- --
msc.cxxflags = { msc.cxxflags = {
exceptionhandling = {
Default = "/EHsc",
On = "/EHsc",
SEH = "/EHa",
},
rtti = { rtti = {
Off = "/GR-" Off = "/GR-"
} }
@ -113,11 +117,6 @@
function msc.getcxxflags(cfg) function msc.getcxxflags(cfg)
local flags = config.mapFlags(cfg, msc.cxxflags) local flags = config.mapFlags(cfg, msc.cxxflags)
if not cfg.flags.SEH and cfg.exceptionhandling ~= p.OFF then
table.insert(flags, "/EHsc")
end
return flags return flags
end end

View File

@ -509,7 +509,7 @@
end end
function suite.exceptions_onSEH() function suite.exceptions_onSEH()
flags "SEH" exceptionhandling "SEH"
prepare() prepare()
test.capture [[ test.capture [[
<ClCompile> <ClCompile>

View File

@ -227,25 +227,25 @@
-- Check handling of C++ language features. -- Check handling of C++ language features.
-- --
function suite.cflags_onExceptions() function suite.cxxflags_onExceptions()
exceptionhandling "on" exceptionhandling "on"
prepare() prepare()
test.contains("/EHsc", msc.getcxxflags(cfg)) test.contains("/EHsc", msc.getcxxflags(cfg))
end end
function suite.cflags_onSEH() function suite.cxxflags_onSEH()
flags "SEH" exceptionhandling "SEH"
prepare() prepare()
test.contains("/EHa", msc.getcxxflags(cfg)) test.contains("/EHa", msc.getcxxflags(cfg))
end end
function suite.cflags_onNoExceptions() function suite.cxxflags_onNoExceptions()
exceptionhandling "Off" exceptionhandling "Off"
prepare() prepare()
test.missing("/EHsc", msc.getcxxflags(cfg)) test.missing("/EHsc", msc.getcxxflags(cfg))
end end
function suite.cflags_onNoRTTI() function suite.cxxflags_onNoRTTI()
rtti "Off" rtti "Off"
prepare() prepare()
test.contains("/GR-", msc.getcxxflags(cfg)) test.contains("/GR-", msc.getcxxflags(cfg))