[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-c2hs
Subject: [C2hs] [c2hs] #49: Run return value marshaller before output parameter marshallers
From: "c2hs" <cvs-ghc () haskell ! org>
Date: 2012-10-08 2:23:33
Message-ID: 063.1e2b8d2c0f46a40e40d61d038ce0ef81 () abbot ! galois ! com
[Download RAW message or body]
#49: Run return value marshaller before output parameter marshallers
--------------------+-------------------------------------------------------
Reporter: guest | Type: defect
Status: new | Priority: normal
Milestone: | Component: general
Version: 0.16.0 | Keywords:
--------------------+-------------------------------------------------------
Many C functions provide an error code as a return value, and have output
parameters that they do not set unless the return value indicates success.
Handling such functions requires checking the return value before running
any output marshallers. The reverse situation (an error code as an output
parameter that needs checking before the return value) almost never
occurs. Thus, run the return value marshaller before the output parameter
marshallers, so that the return value marshaller can generate an exception
that will prevent the output marshallers from running.
{{{
diff -rN -u old-c2hs/src/C2HS/Gen/Bind.hs new-c2hs/src/C2HS/Gen/Bind.hs
--- old-c2hs/src/C2HS/Gen/Bind.hs 2012-10-07 19:22:14.515183247
-0700
+++ new-c2hs/src/C2HS/Gen/Bind.hs 2012-10-07 19:22:14.515183247
-0700
@@ -894,8 +894,8 @@
funBody = joinLines marshIns ++
mkMarsh2 ++
call ++
- joinLines marshOuts ++
marshRes ++
+ joinLines marshOuts ++
" " ++
(if isImpure || not isPure then "return " else "") ++
ret
return $ sig ++ funHead ++ funBody
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/c2hs/ticket/49>
c2hs <http://www.cse.unsw.edu.au/~chak/haskell/c2hs/>
C->Haskell, An Interface Generator for Haskell
_______________________________________________
C2hs mailing list
C2hs@haskell.org
http://www.haskell.org/mailman/listinfo/c2hs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic