Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/a4b3fda552de6b26e132935866222cf63f815f0a

>---------------------------------------------------------------

commit a4b3fda552de6b26e132935866222cf63f815f0a
Author: Ian Lynagh <[email protected]>
Date:   Thu Feb 16 16:24:49 2012 +0000

    Add FunPtr to the types that toCType knows about

>---------------------------------------------------------------

 compiler/deSugar/DsForeign.lhs |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/compiler/deSugar/DsForeign.lhs b/compiler/deSugar/DsForeign.lhs
index 64587ba..55b2b23 100644
--- a/compiler/deSugar/DsForeign.lhs
+++ b/compiler/deSugar/DsForeign.lhs
@@ -669,10 +669,11 @@ showFFIType t = getOccString (getName (typeTyCon t))
 toCType :: Type -> SDoc
 toCType = f False
     where f voidOK t
-           -- First, if we have (Ptr t), then we need to convert t to a
-           -- C type and put a * after it.
+           -- First, if we have (Ptr t) of (FunPtr t), then we need to
+           -- convert t to a C type and put a * after it. If we don't
+           -- know a type for t, then "void" is fine, though.
            | Just (ptr, [t']) <- splitTyConApp_maybe t
-           , tyConName ptr == ptrTyConName
+           , tyConName ptr `elem` [ptrTyConName, funPtrTyConName]
               = f True t' <> char '*'
            -- Otherwise, if we have a type constructor application, then
            -- see if there is a C type associated with that constructor.



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to