stringpooling api. (#682)

* stringpooling api.

* add options to msc.lua
This commit is contained in:
Tom van Dijck 2017-02-01 08:47:50 -08:00 committed by GitHub
parent aae8917042
commit ac2919e74c
6 changed files with 81 additions and 1 deletions

View File

@ -969,6 +969,12 @@
}
}
api.register {
name = "stringpooling",
scope = "config",
kind = "boolean"
}
api.register {
name = "symbols",
scope = "config",

View File

@ -1979,7 +1979,13 @@
end
function m.stringPooling(cfg)
if config.isOptimizedBuild(cfg) then
if cfg.stringpooling ~= nil then
if cfg.stringpooling then
m.element("StringPooling", nil, "true")
else
m.element("StringPooling", nil, "false")
end
elseif config.isOptimizedBuild(cfg) then
m.element("StringPooling", nil, "true")
end
end

View File

@ -493,6 +493,9 @@
-- replacement, if any, to the result
local values = cfg[field.name]
if type(values) == "boolean" then
values = iif(values, "On", "Off")
end
if type(values) ~= "table" then
values = { values }
end

View File

@ -75,6 +75,10 @@
Extra = "/W4",
Off = "/W0",
},
stringpooling = {
On = "/GF",
Off = "/GF-",
},
symbols = {
On = "/Z7"
}

View File

@ -786,3 +786,47 @@
<Optimization>Disabled</Optimization>
]]
end
--
-- Check handling of the stringpooling api
--
function suite.onStringPoolingOff()
stringpooling 'Off'
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<StringPooling>false</StringPooling>
]]
end
function suite.onStringPoolingOn()
stringpooling 'On'
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<StringPooling>true</StringPooling>
]]
end
function suite.onStringPoolingNotSpecified()
optimize "On"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling>
]]
end

View File

@ -77,6 +77,23 @@
test.contains("/GL", msc.getldflags(cfg))
end
function suite.cflags_onStringPoolingOn()
stringpooling "On"
prepare()
test.contains("/GF", msc.getcflags(cfg))
end
function suite.cflags_onStringPoolingOff()
stringpooling "Off"
prepare()
test.contains("/GF-", msc.getcflags(cfg))
end
function suite.cflags_onStringPoolingNotSpecified()
prepare()
test.excludes("/GF", msc.getcflags(cfg))
test.excludes("/GF-", msc.getcflags(cfg))
end
--
-- Check the translation of symbols.