c2hs 0.28.1 → 0.28.2
raw patch · 8 files changed
+44/−8 lines, 8 filesdep ~language-c
Dependency ranges changed: language-c
Files
- ChangeLog +2/−0
- c2hs.cabal +4/−3
- src/C2HS/Gen/Bind.hs +9/−3
- src/Data/NameSpaces.hs +2/−2
- tests/bugs/issue-128/issue128.c +1/−0
- tests/bugs/issue-180/Issue180.chs +13/−0
- tests/bugs/issue-180/issue180.h +1/−0
- tests/test-bugs.hs +12/−0
ChangeLog view
@@ -1,3 +1,5 @@+0.28.2+ - Switch to language-c 0.6 [#176] 0.28.1 - Switch to language-c 0.5 [#157] - Fix class hook problem with imports [#155]
c2hs.cabal view
@@ -1,12 +1,12 @@ Name: c2hs-Version: 0.28.1+Version: 0.28.2 License: GPL-2 License-File: COPYING Copyright: Copyright (c) 1999-2007 Manuel M T Chakravarty 2005-2013 Duncan Coutts 2008 Benedikt Huber Author: Manuel M T Chakravarty-Maintainer: chak@cse.unsw.edu.au, duncan@community.haskell.org, ian@skybluetrades.net+Maintainer: chak@cse.unsw.edu.au, duncan@community.haskell.org, ian@skybluetrades.net, aditya.siram@gmail.com Stability: Stable Homepage: https://github.com/haskell/c2hs Bug-Reports: https://github.com/haskell/c2hs/issues@@ -101,6 +101,7 @@ tests/bugs/issue-151/*.chs tests/bugs/issue-151/*.h tests/bugs/issue-152/*.chs tests/bugs/issue-152/*.h tests/bugs/issue-155/*.chs tests/bugs/issue-155/*.h+ tests/bugs/issue-180/*.chs tests/bugs/issue-180/*.h source-repository head type: git@@ -111,7 +112,7 @@ Executable c2hs Build-Depends: base >= 2 && < 5, bytestring,- language-c >= 0.5 && < 0.6,+ language-c >= 0.6 && < 0.7, filepath, dlist
src/C2HS/Gen/Bind.hs view
@@ -521,7 +521,9 @@ else doSplit 0 mln True (f:acc) fs' | otherwise = if null (dropWhile isSpace s) || isJust mln then doSplit 0 mln wh (f:acc) fs'- else doSplit 0 (Just $ posRow pos) wh (f:acc) fs'+ else doSplit 0 mln' wh (f:acc) fs'+ where mln' | isSourcePos pos = Just $ posRow pos+ | otherwise = Nothing doSplit cdep mln wh acc (f@(CHSVerb s _) : fs') | s == "-}" = doSplit (cdep-1) mln wh (f:acc) fs' | s == "{-" = doSplit (cdep+1) mln wh (f:acc) fs'@@ -1438,8 +1440,12 @@ parms' <- addDft parms'' cts return (CHSParm imMarsh' hsTy True omMarsh' False p c : parms') addDft [] [] = return []- addDft ((CHSParm _ _ _ _ _ pos' _):_) [] =+ addDft (CHSPlusParm _:_) [] =+ marshArgMismatchErr pos "This parameter is in excess of the C arguments."+ addDft (CHSParm _ _ _ _ _ pos' _:_) [] = marshArgMismatchErr pos' "This parameter is in excess of the C arguments."+ addDft (CHSParm _ _ True _ _ pos' _:_) [_] =+ marshArgMismatchErr pos' "This parameter is in excess of the C arguments." addDft [] (_:_) = marshArgMismatchErr pos "Parameter marshallers are missing." --@@ -2303,7 +2309,7 @@ hasStdCallAttr = any isStdCallAttr . funAttrs funAttrs (CDecl specs declrs _) =- let (_,attrs',_,_,_) = partitionDeclSpecs specs+ let (_,attrs',_,_,_,_) = partitionDeclSpecs specs in attrs' ++ funEndAttrs declrs ++ funPtrAttrs declrs -- attrs after the function name, e.g. void foo() __attribute__((...));
src/Data/NameSpaces.hs view
@@ -77,7 +77,7 @@ -- -- * if the identfier is already declared, the resulting name space contains -- the new binding and the second component of the result contains the--- definition declared previosuly (which is henceforth not contained in the+-- definition declared previously (which is henceforth not contained in the -- name space anymore) -- defGlobal :: NameSpace a -> Ident -> a -> (NameSpace a, Maybe a)@@ -105,7 +105,7 @@ -- -- * if the identfier is already declared, the resulting name space contains -- the new binding and the second component of the result contains the--- definition declared previosuly (which is henceforth not contained in the+-- definition declared previously (which is henceforth not contained in the -- name space anymore) -- defLocal :: NameSpace a -> Ident -> a -> (NameSpace a, Maybe a)
tests/bugs/issue-128/issue128.c view
@@ -20,6 +20,7 @@ tststruct *p = (tststruct *)malloc(sizeof(tststruct)); p->a = ain; p->b = false;+ return p; } void free_tststruct(tststruct *s)
+ tests/bugs/issue-180/Issue180.chs view
@@ -0,0 +1,13 @@+module Main where++#include "issue180.h"++marshalIn = undefined++{#fun pure test as test1+ { 'marshalIn'* `Int'&} -> `()' #}++main :: IO ()+main = do+ test+ print "OK"
+ tests/bugs/issue-180/issue180.h view
@@ -0,0 +1,1 @@+void test(int arg);
tests/test-bugs.hs view
@@ -92,6 +92,7 @@ , testCase "Issue #151" issue151 , testCase "Issue #152" issue152 , testCase "Issue #155" issue155+ , testCase "Issue #180" issue180 ] ++ -- Some tests that won't work on Windows. if os /= "cygwin32" && os /= "mingw32"@@ -111,6 +112,17 @@ res <- absPath "./Capital" >>= cmd let expected = ["upper C();", "lower c();", "upper C();"] liftIO $ assertBool "" (T.lines res == expected)++issue180 :: Assertion+issue180 = c2hsShelly $ chdir "tests/bugs/issue-180" $ do+ mapM_ rm_f ["Issue180.chs.h"]+ errExit False $ do+ run "c2hs" [toTextIgnore "Issue180.chs"]+ code <- lastExitCode+ liftIO $ assertEqual "error code" 1 code+ stderr <- lastStderr+ let excessMsgCount = T.count "excess of the C arguments" stderr+ liftIO $ assertBool "correct error message" (excessMsgCount == 1) issue155 :: Assertion issue155 = c2hsShelly $ chdir "tests/bugs/issue-155" $ do