haskell / c2hs

c2hs is a pre-processor for Haskell FFI bindings to C libraries
http://hackage.haskell.org/package/c2hs
Other
198 stars 50 forks source link

struct typedef handling broke recently (libssh2 bindings do not compile) #152

Closed trofi closed 8 years ago

trofi commented 8 years ago

libssh2 fails to compile as:

include/libssh2_local.h:6: (column 1) [ERROR]  >>> Illegal use of incomplete type!
  Expected a fully defined structure or union tag; instead found incomplete type.

Trimmed down example looks like:

// a.h
struct a { int f; };

typedef struct a s_a;
-- a.chs
module M where

f = {# sizeof a #}
g = {# sizeof s_a #}

Fails as:

$ c2hs a.h a.chs 
c2hs: Errors during expansion of binding hooks:

a.h:3: (column 1) [ERROR]  >>> Illegal use of incomplete type!
  Expected a fully defined structure or union tag; instead found incomplete type.
ian-ross commented 8 years ago

@trofi OK, this is a regression caused by the fix to #141. I'll take a look after the weekend.

mrkkrp commented 8 years ago

Any progress on this?

ian-ross commented 8 years ago

No. Started a new job recently, zero time to work on C2HS. PRs more than welcome...

ian-ross commented 8 years ago

This now appears to be fixed in HEAD (I can build libssh2 with it anyway). I'll do a release either later today or in the next couple of days, depending on how another bug fix I'm doing goes.

kaoskorobase commented 8 years ago

Cool, thanks!