Merge pull request #1515 from cos-public/conformance-mode-flag

ConformanceMode flag implemented for >= vs2017
This commit is contained in:
Samuel Surtees 2020-09-24 08:36:38 +10:00 committed by GitHub
commit 96a3432529
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 2 deletions

View File

@ -428,6 +428,60 @@
]]
end
--
-- If ConformanceMode flag is set, add <ConformanceMode> element (supported from VS2017)
--
function suite.onConformanceModeOn_VS2015()
conformancemode "On"
p.action.set("vs2015")
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
]]
end
function suite.onConformanceModeOff_VS2017()
conformancemode "Off"
p.action.set("vs2017")
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<ConformanceMode>false</ConformanceMode>
]]
end
function suite.onConformanceModeOn_VS2017()
conformancemode "On"
p.action.set("vs2017")
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<ConformanceMode>true</ConformanceMode>
]]
end
function suite.onConformanceModeNotSpecified_VS2017()
p.action.set("vs2017")
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
]]
end
--
-- If staticruntime is specified, add the <RuntimeLibrary> element.

View File

@ -382,7 +382,8 @@
m.compileAs,
m.callingConvention,
m.languageStandard,
m.structMemberAlignment,
m.conformanceMode,
m.structMemberAlignment
}
if cfg.kind == p.STATICLIB then
@ -1474,6 +1475,18 @@
end
end
function m.conformanceMode(cfg)
if _ACTION >= "vs2017" then
if cfg.conformancemode ~= nil then
if cfg.conformancemode then
m.element("ConformanceMode", nil, "true")
else
m.element("ConformanceMode", nil, "false")
end
end
end
end
function m.structMemberAlignment(cfg)
local map = {
[1] = "1Byte",

View File

@ -782,6 +782,12 @@
}
}
api.register {
name = "conformancemode",
scope = "config",
kind = "boolean"
}
api.register {
name = "swiftversion",
scope = "config",