Fixed a problem with record abbreviations being pulled all the way up to the top (which C doesn't like)
This commit is contained in:
parent
33ca2fe253
commit
2941cbd049
|
@ -792,7 +792,7 @@ cgetCType m origT am
|
|||
|
||||
(A.Record n, _, False, A.Original) -> return $ Plain $ nameString n
|
||||
-- Abbrev and ValAbbrev, and mobile:
|
||||
(A.Record n, _, False, _) -> return $ Pointer $ const $ Plain $ nameString n
|
||||
(A.Record n, _, False, _) -> return $ Const . Pointer $ const $ Plain $ nameString n
|
||||
(A.Record n, _, True, A.Abbrev) -> return $ Pointer $ Pointer $ Plain $ nameString n
|
||||
(A.Record n, _, True, _) -> return $ Pointer $ const $ Plain $ nameString n
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ removeNesting = pass "Pull nested definitions to top level"
|
|||
doStructured s@(A.Spec m spec subS)
|
||||
= do spec'@(A.Specification _ n st) <- recurse spec
|
||||
isConst <- isConstantName n
|
||||
if isConst || canPull st then
|
||||
if (isConst && not (abbrevRecord st)) || canPull st then
|
||||
do debug $ "removeNesting: pulling up " ++ show n
|
||||
addPulled $ (m, Left spec')
|
||||
doStructured subS
|
||||
|
@ -232,3 +232,9 @@ removeNesting = pass "Pull nested definitions to top level"
|
|||
canPull (A.ProtocolCase _ _) = True
|
||||
canPull _ = False
|
||||
|
||||
-- C doesn't allow us to pull up pointers to records to the top-level
|
||||
abbrevRecord :: A.SpecType -> Bool
|
||||
abbrevRecord (A.Is _ _ (A.Record {}) _) = True
|
||||
abbrevRecord _ = False
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user