Open Kleidukos opened 11 months ago
Here is the bit of the header it chokes on:
static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CAST
_castf64_u64(double __A) {
return __builtin_bit_cast(unsigned long long, __A);
}
Error: p/ghc/9.4.7/mingw/lib/clang/14.0.6/include/ia32intrin.h:222: (column 29) [ERROR] >>> Syntax error !
The symbol `unsigned' does not fit here.
It seems like __builtin_bit_cast
is a C++ construct, so it is not surprising that c2hs chokes on it.
Maybe, but basically it seems c2hs
is dysfunctional on Windows since GHC 9.4, whatever you do. It would be nice to fix it, even if in ad-hoc way.
I don't have access to Windows machine at the moment but can you try invoking c2hs
like this:
c2hs -C -D"__builtin_bit_cast(A,B)=((A)B)" <file.chs>
The double quotes escape their contents on zsh
, for sh
you probably need single quotes:
c2hs -C -D'__builtin_bit_cast(A,B)=((A)B)' <file.chs>
This will just parse __builtin_bit_cast(unsigned long long, __A)
as ((unsigned long long) __A)
.
I have addressed this in https://github.com/visq/language-c/pull/96
Symptoms described at https://github.com/vmchale/libarchive/pull/34