Skip to content

Commit

Permalink
Fixed duplicate stdcall attributes in output
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobstanley committed Aug 25, 2011
1 parent c450b73 commit ad7a87e
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions mkstdcall.hs
Expand Up @@ -65,7 +65,7 @@ wrapWithStdcallD (CDecl ss ds n) = do
origFun <- fmap var (name declr)
let origArgs = map var (funArgs declr)
return $ CFunDef
(stdcall $ dllexport ss) declr []
(dllexport : stdcall : ss) declr []
(block $ call origFun origArgs) n
where
-- gets the first declarator
Expand Down Expand Up @@ -118,20 +118,11 @@ ident nam = Ident nam 0 undefNode
------------------------------------------------------------------------
-- Exported Functions / Calling Conventions

-- | Changes any declaration or definition which is marked
-- as 'extern' to use the 'stdcall' calling convention.
stdcall :: Data a => a -> a
stdcall = addAttr "stdcall"
stdcall :: CDeclSpec
stdcall = attr "stdcall"

dllexport :: Data a => a -> a
dllexport = addAttr "dllexport"

addAttr :: Data a => String -> a -> a
addAttr x = everywhere (mkT add)
where
add :: [CDeclSpec] -> [CDeclSpec]
add xs | isExtern xs = attr x : xs
| otherwise = xs
dllexport :: CDeclSpec
dllexport = attr "dllexport"

-- | Creates a attribute type qualification with the
-- specified identifier.
Expand Down

0 comments on commit ad7a87e

Please sign in to comment.