parent
41555ca86f
commit
da1bddb084
3 changed files with 30 additions and 4 deletions
|
|
@ -525,7 +525,8 @@ proc genRecordFieldsAux(m: BModule, n: PNode,
|
|||
of nkOfBranch, nkElse:
|
||||
let k = lastSon(n[i])
|
||||
if k.kind != nkSym:
|
||||
let a = genRecordFieldsAux(m, k, rectype, check, unionPrefix & "_i" & $i & ".")
|
||||
let structName = "_" & mangleRecFieldName(m, n[0].sym) & "_" & $i
|
||||
let a = genRecordFieldsAux(m, k, rectype, check, unionPrefix & $structName & ".")
|
||||
if a != nil:
|
||||
if tfPacked notin rectype.flags:
|
||||
unionBody.add("struct {")
|
||||
|
|
@ -535,7 +536,7 @@ proc genRecordFieldsAux(m: BModule, n: PNode,
|
|||
else:
|
||||
unionBody.addf("#pragma pack(push, 1)$nstruct{", [])
|
||||
unionBody.add(a)
|
||||
unionBody.addf("} _i$1;$n", [rope($i)])
|
||||
unionBody.addf("} $1;$n", [structName])
|
||||
if tfPacked in rectype.flags and hasAttribute notin CC[m.config.cCompiler].props:
|
||||
unionBody.addf("#pragma pack(pop)$n", [])
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue