convert exceptionhandling, rtti and editandcontinue flags from boolean to "tri-states".
This commit is contained in:
parent
307e04ed88
commit
8d0b2565b5
@ -24,14 +24,14 @@
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"universal",
|
||||
"x86",
|
||||
"x86_64",
|
||||
p.X86,
|
||||
p.X86_64,
|
||||
},
|
||||
aliases = {
|
||||
i386 = "x86",
|
||||
amd64 = "x86_64",
|
||||
x32 = "x86", -- these should be DEPRECATED
|
||||
x64 = "x86_64",
|
||||
i386 = p.X86,
|
||||
amd64 = p.X86_64,
|
||||
x32 = p.X86, -- these should be DEPRECATED
|
||||
x64 = p.X86_64,
|
||||
},
|
||||
}
|
||||
|
||||
@ -343,19 +343,34 @@
|
||||
api.register {
|
||||
name = "editandcontinue",
|
||||
scope = "config",
|
||||
kind = "boolean",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Default",
|
||||
"On",
|
||||
"Off",
|
||||
},
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "exceptionhandling",
|
||||
scope = "config",
|
||||
kind = "boolean",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Default",
|
||||
"On",
|
||||
"Off",
|
||||
},
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "rtti",
|
||||
scope = "config",
|
||||
kind = "boolean",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Default",
|
||||
"On",
|
||||
"Off",
|
||||
},
|
||||
}
|
||||
|
||||
api.register {
|
||||
@ -1264,9 +1279,6 @@
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
clr "Off"
|
||||
editandcontinue "On"
|
||||
exceptionhandling "On"
|
||||
rtti "On"
|
||||
|
||||
-- Setting a default language makes some validation easier later
|
||||
|
||||
|
@ -753,10 +753,10 @@
|
||||
return 1
|
||||
else
|
||||
-- Edit-and-continue doesn't work for some configurations
|
||||
if not cfg.editandcontinue or
|
||||
config.isOptimizedBuild(cfg) or
|
||||
cfg.clr ~= p.OFF or
|
||||
cfg.architecture == p.X86_64
|
||||
if cfg.editandcontinue == p.OFF or
|
||||
config.isOptimizedBuild(cfg) or
|
||||
cfg.clr ~= p.OFF or
|
||||
cfg.architecture == p.X86_64
|
||||
then
|
||||
return 3
|
||||
else
|
||||
@ -1122,7 +1122,7 @@
|
||||
|
||||
|
||||
function m.exceptionHandling(cfg)
|
||||
if cfg.exceptionhandling == false then
|
||||
if cfg.exceptionhandling == p.OFF then
|
||||
p.w('ExceptionHandling="%s"', iif(_ACTION < "vs2005", "FALSE", 0))
|
||||
elseif cfg.flags.SEH and _ACTION > "vs2003" then
|
||||
p.w('ExceptionHandling="2"')
|
||||
@ -1519,8 +1519,10 @@
|
||||
|
||||
|
||||
function m.runtimeTypeInfo(cfg)
|
||||
if cfg.rtti == false and cfg.clr == p.OFF then
|
||||
if cfg.rtti == p.OFF and cfg.clr == p.OFF then
|
||||
p.w('RuntimeTypeInfo="false"')
|
||||
elseif cfg.rtti == p.ON then
|
||||
p.w('RuntimeTypeInfo="true"')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -919,6 +919,7 @@
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.additionalUsingDirectories(cfg)
|
||||
if #cfg.usingdirs > 0 then
|
||||
local dirs = table.concat(vstudio.path(cfg, cfg.usingdirs), ";")
|
||||
@ -1041,7 +1042,7 @@
|
||||
elseif cfg.architecture == "x86_64" or
|
||||
cfg.clr ~= p.OFF or
|
||||
config.isOptimizedBuild(cfg) or
|
||||
not cfg.editandcontinue
|
||||
cfg.editandcontinue == p.OFF
|
||||
then
|
||||
value = "ProgramDatabase"
|
||||
else
|
||||
@ -1097,9 +1098,9 @@
|
||||
|
||||
|
||||
function m.exceptionHandling(cfg)
|
||||
if cfg.exceptionhandling == false then
|
||||
if cfg.exceptionhandling == p.OFF then
|
||||
p.w('<ExceptionHandling>false</ExceptionHandling>')
|
||||
elseif cfg.exceptionhandling == true then
|
||||
elseif cfg.exceptionhandling == p.ON or cfg.flags.SEH then
|
||||
if cfg.flags.SEH then
|
||||
p.w('<ExceptionHandling>Async</ExceptionHandling>')
|
||||
else
|
||||
@ -1612,9 +1613,9 @@
|
||||
end
|
||||
|
||||
function m.runtimeTypeInfo(cfg)
|
||||
if cfg.rtti == false and cfg.clr == p.OFF then
|
||||
if cfg.rtti == p.OFF and cfg.clr == p.OFF then
|
||||
p.w('<RuntimeTypeInfo>false</RuntimeTypeInfo>')
|
||||
elseif cfg.rtti == true then
|
||||
elseif cfg.rtti == p.ON then
|
||||
p.w('<RuntimeTypeInfo>true</RuntimeTypeInfo>')
|
||||
end
|
||||
end
|
||||
|
@ -30,6 +30,8 @@
|
||||
premake.MACOSX = "macosx"
|
||||
premake.MAKEFILE = "Makefile"
|
||||
premake.NONE = "None"
|
||||
premake.DEFAULT = "Default"
|
||||
premake.ON = "On"
|
||||
premake.OFF = "Off"
|
||||
premake.POSIX = "posix"
|
||||
premake.PS3 = "ps3"
|
||||
|
@ -320,7 +320,7 @@
|
||||
|
||||
function config.getruntime(cfg)
|
||||
local linkage = iif(cfg.flags.StaticRuntime, "Static", "Shared")
|
||||
if (cfg.runtime == nil) then
|
||||
if not cfg.runtime then
|
||||
return linkage .. iif(config.isDebugBuild(cfg), "Debug", "Release")
|
||||
else
|
||||
return linkage .. cfg.runtime
|
||||
|
@ -115,10 +115,10 @@
|
||||
|
||||
function gcc.getcxxflags(cfg)
|
||||
local flags = config.mapFlags(cfg, gcc.cxxflags)
|
||||
if not cfg.exceptionhandling then
|
||||
if cfg.exceptionhandling == p.OFF then
|
||||
table.insert(flags, '-fno-exceptions')
|
||||
end
|
||||
if not cfg.rtti then
|
||||
if cfg.rtti == p.OFF then
|
||||
table.insert(flags, '-fno-rtti')
|
||||
end
|
||||
return flags
|
||||
|
@ -106,11 +106,16 @@
|
||||
function msc.getcxxflags(cfg)
|
||||
local flags = {}
|
||||
|
||||
if cfg.rtti == false then
|
||||
if cfg.rtti == premake.OFF then
|
||||
table.insert(flags, "/GR-")
|
||||
end
|
||||
if not cfg.flags.SEH and cfg.exceptionhandling then
|
||||
table.insert(flags, "/EHsc")
|
||||
|
||||
if cfg.exceptionhandling == premake.ON or cfg.flags.SEH then
|
||||
if cfg.flags.SEH then
|
||||
table.insert(flags, "/EHa")
|
||||
else
|
||||
table.insert(flags, "/EHsc")
|
||||
end
|
||||
end
|
||||
|
||||
return flags
|
||||
|
@ -45,15 +45,15 @@
|
||||
local flags = {}
|
||||
|
||||
-- turn on exceptions and RTTI by default, to match other toolsets
|
||||
if cfg.exceptionhandling then
|
||||
if cfg.exceptionhandling == p.ON then
|
||||
table.insert(flags, "-Xc+=exceptions")
|
||||
else
|
||||
elseif cfg.exceptionhandling == p.OFF then
|
||||
table.insert(flags, "-Xc-=exceptions")
|
||||
end
|
||||
|
||||
if cfg.rtti then
|
||||
if cfg.rtti == p.ON then
|
||||
table.insert(flags, "-Xc+=rtti")
|
||||
else
|
||||
elseif cfg.rtti == p.OFF then
|
||||
table.insert(flags, "-Xc-=rtti")
|
||||
end
|
||||
|
||||
|
@ -36,8 +36,6 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
@ -223,8 +221,6 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
@ -237,8 +233,6 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
@ -300,8 +294,6 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<AdditionalOptions>/xyz /abc %(AdditionalOptions)</AdditionalOptions>
|
||||
]]
|
||||
end
|
||||
@ -448,8 +440,6 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
@ -485,8 +475,6 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
]]
|
||||
end
|
||||
@ -499,8 +487,6 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||
]]
|
||||
end
|
||||
@ -542,7 +528,6 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
]]
|
||||
end
|
||||
@ -555,8 +540,6 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
]]
|
||||
end
|
||||
@ -703,8 +686,6 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
]]
|
||||
end
|
||||
|
@ -228,10 +228,17 @@
|
||||
--
|
||||
|
||||
function suite.cflags_onExceptions()
|
||||
exceptionhandling "on"
|
||||
prepare()
|
||||
test.contains("/EHsc", msc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onSEH()
|
||||
flags "SEH"
|
||||
prepare()
|
||||
test.contains("/EHa", msc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onNoExceptions()
|
||||
flags "NoExceptions"
|
||||
prepare()
|
||||
|
Loading…
Reference in New Issue
Block a user