diff options
author | Joe Crayne <joe@jerkface.net> | 2019-03-20 00:14:35 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-03-20 00:14:35 -0400 |
commit | 5bfc85eaf313171c48860f41dd31ef10e0402b56 (patch) | |
tree | ac2312243e73f28d39c234a0e8baca4c18855991 /monkeypatch.hs | |
parent | 8bb81e3c6c677c6118e804d03d57607f5869b29d (diff) |
Stub-generation fixes.
Diffstat (limited to 'monkeypatch.hs')
-rw-r--r-- | monkeypatch.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/monkeypatch.hs b/monkeypatch.hs index b5f76d4..7806f07 100644 --- a/monkeypatch.hs +++ b/monkeypatch.hs | |||
@@ -1044,8 +1044,9 @@ c2haskell opts cs cmodname missings incs (CTranslUnit edecls _) = do | |||
1044 | 1044 | ||
1045 | -- TODO: make idempotent | 1045 | -- TODO: make idempotent |
1046 | makeStatic :: [CDeclarationSpecifier NodeInfo] -> [CDeclarationSpecifier NodeInfo] | 1046 | makeStatic :: [CDeclarationSpecifier NodeInfo] -> [CDeclarationSpecifier NodeInfo] |
1047 | makeStatic xs = CStorageSpec (CStatic undefNode) : xs | 1047 | makeStatic xs = CStorageSpec (CStatic undefNode) : filter nonStorages xs |
1048 | -- makeStatic xs = CStorageSpec (CStatic ()) : xs | 1048 | where nonStorages (CStorageSpec _) = False |
1049 | nonStorages _ = True | ||
1049 | 1050 | ||
1050 | makePointer1 :: Maybe (CDeclarator NodeInfo) | 1051 | makePointer1 :: Maybe (CDeclarator NodeInfo) |
1051 | -> Maybe (CDeclarator NodeInfo) | 1052 | -> Maybe (CDeclarator NodeInfo) |
@@ -1170,12 +1171,15 @@ setBody bdy (CDeclExt (CDecl xs ys pos)) = (CFDefExt (CFunDef xs v [] bdy p | |||
1170 | (Just y,_,_):_ -> y | 1171 | (Just y,_,_):_ -> y |
1171 | _ -> CDeclr Nothing [] Nothing [] pos | 1172 | _ -> CDeclr Nothing [] Nothing [] pos |
1172 | 1173 | ||
1174 | |||
1175 | doesReturnValue (CTypeSpec (CVoidType _):_) = False | ||
1176 | doesReturnValue (x:xs) = doesReturnValue xs | ||
1177 | doesReturnValue [] = True | ||
1178 | |||
1173 | makeStub :: CExternalDeclaration NodeInfo | 1179 | makeStub :: CExternalDeclaration NodeInfo |
1174 | -> CExternalDeclaration NodeInfo | 1180 | -> CExternalDeclaration NodeInfo |
1175 | makeStub d = -- @(CDeclExt (CDecl xs ys pos)) = | 1181 | makeStub d = -- @(CDeclExt (CDecl xs ys pos)) = |
1176 | let rval = case getReturnValue d of | 1182 | let rval = doesReturnValue $ getReturnValue d |
1177 | [ CTypeSpec (CVoidType _) ] -> False -- void function. | ||
1178 | _ -> True | ||
1179 | name = concatMap identToString $ take 1 $ catMaybes $ sym d | 1183 | name = concatMap identToString $ take 1 $ catMaybes $ sym d |
1180 | msg = "undefined: " ++ concatMap (HS.prettyPrint . makeAcceptableDecl) (take 1 $ sig d) ++ "\n" | 1184 | msg = "undefined: " ++ concatMap (HS.prettyPrint . makeAcceptableDecl) (take 1 $ sig d) ++ "\n" |
1181 | in case getArgList d of | 1185 | in case getArgList d of |