Merge pull request #1046 from tdesveauxPKFX/struct-member-align

Add structmemberalign API
This commit is contained in:
Tom van Dijck 2018-04-12 20:45:55 +02:00 committed by GitHub
commit 8eecb5cfa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 0 deletions

View File

@ -1267,3 +1267,20 @@
</ClCompile>
]]
end
--
-- Check StructMemberAlignment
--
function suite.structMemberAlignment()
structmemberalign(1)
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<StructMemberAlignment>1Byte</StructMemberAlignment>
</ClCompile>
]]
end

View File

@ -348,6 +348,7 @@
m.compileAs,
m.callingConvention,
m.languageStandard,
m.structMemberAlignment,
}
if cfg.kind == p.STATICLIB then
@ -1345,6 +1346,20 @@
end
end
function m.structMemberAlignment(cfg)
local map = {
[1] = "1Byte",
[2] = "2Bytes",
[4] = "4Bytes",
[8] = "8Bytes",
[16] = "16Bytes"
}
local value = map[cfg.structmemberalign]
if value then
m.element("StructMemberAlignment", nil, value)
end
end
function m.additionalCompileOptions(cfg, condition)
local opts = cfg.buildoptions

View File

@ -1342,6 +1342,19 @@
kind = "boolean",
}
p.api.register {
name = "structmemberalign",
scope = "config",
kind = "integer",
allowed = {
"1",
"2",
"4",
"8",
"16",
}
}
-----------------------------------------------------------------------------
--
-- Field name aliases for backward compatibility