[C2hs] BUG: string.h, (FC4 x86_64)

Manuel M T Chakravarty chak at cse.unsw.edu.au
Thu May 25 00:58:43 EDT 2006


Udo Stenzel:
> Manuel M T Chakravarty wrote:
> > In the meantime, as a stop gap measure, we can use the C pre-processor
> > to get rid of the pesky __asm__ and __attribute__ annotations by passing
> > the following additional arguments to the pre-processor
> 
> Another option is to call the preprocessor as "cpp", not as "gcc".  This
> way cpp will only see standard code, without GNU extensions.
> 
> Incidentally, I stumbled upon this in connection with libdb.  It
> references types named u_int8_t, u_int32_t and so on, which are
> typedef'd as "unsigned int" with some obscure and afaict undocumented
> __attribute__.  C2hs throws the __attribute__ away and consequently
> thinks sizeof(u_int8_t)==4.  Ouch.  

Yes, c2hs should actually interpret the __attribute__ annotations,
rather than just ignoring them.  One problem is really that these gcc
extensions are rather poorly documented - at least, I had a trouble
finding something when I looked.

> Passing
> 
> 	-c cpp
> 
> to c2hs, I get more standard definitions and everything works, apart
> from u_int64_t going missing.  I'm not sure how to fix this in general
> and whether we should try at all.  Maybe these integer types need
> special treatment... and special cases are ugly.

I guess, we'd be fine, if we actually interpret __attribute__ in c2hs.	

Manuel




More information about the C2hs mailing list