retitle 680329 Does not parse GCC "mode" attribute for integer sizes (used in sys/types.h) thanks
On Thu, Jul 05, 2012 at 01:03:33PM +1000, Erik de Castro Lopo wrote: > Josh Triplett wrote: > > > Package: c2hs > > Version: 0.16.3-2 > > Severity: important > > > > A library I'd like to write bindings to has a typedef of int64_t to a > > library-specific type name. c2hs seems to interpret that type as CInt, > > both in foreign import declarations and in {# type #} directives. It > > should interpret that type as a 64-bit integer type instead. > > I've seen this happen before and the cause was that the header file > defining the int64_t to something else did not include <stdint.h>. > > I think the solution was to tell c2hs somehow that <stdint.h> should be > included before the project specific header. The project does actually include <stdint.h>, but before it does so, it (indirectly) includes <sys/types.h>, which defines int64_t in a different way that c2hs can't cope with: $ cpp /usr/include/stdint.h | grep -w int64_t typedef long int int64_t; $ cpp /usr/include/sys/types.h | grep -w int64_t typedef int int64_t __attribute__ ((__mode__ (__DI__))); I'd guess that c2hs ignores the GCC-specific __attribute__ that overrides the size, and just sees "int". Including <stdint.h> at the top of my .chs file works around the problem, and causes c2hs to define the type as CLong. - Josh Triplett -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org