c-for-go icon indicating copy to clipboard operation
c-for-go copied to clipboard

unexpected identifier strtof32

Open abemedia opened this issue 3 years ago • 2 comments

When trying to build bindings for Python 3.9 I get the following error: processing python.yml ⠹[ERR] /usr/include/stdlib.h:140:17: unexpected identifier strtof32, expected one of ['(', ')', ',', ':', ';', '=', '[', '{', _Bool, _Complex, _Noreturn, _Static_assert, asm, auto, char, const, double, enum, extern, float, inline, int, long, register, restrict, short, signed, static, struct, typedef, typedefname, typeof, union, unsigned, void, volatile]

This is the stdlib code causing the issue:

#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
extern _Float32 strtof32 (const char *__restrict __nptr,
			  char **__restrict __endptr)
     __THROW __nonnull ((1));
#endif

It seems both _Float32 and _Float64 don't exist in moderc.org/cc

This is my c-for-go config so far:

GENERATOR:
  PackageName: python
  PackageDescription: Package python provides Go bindings for Python.
  PackageLicense: THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS.
  PkgConfigOpts: [python3]
PARSER:
  SourcesPaths:
    - Python.h

abemedia avatar Aug 08 '22 17:08 abemedia

I guess it will be broken in many other places too, but at least try to avoid this error by:

  1. overriding __HAVE_FLOAT32 as 0
  2. implementing strtof32 as a noop stub

xlab avatar Aug 08 '22 20:08 xlab

Stubs worked, however there's loads more issues. Since all these issues are in the standard library, do you know a version of it that works with c-for-go?

abemedia avatar Aug 10 '22 06:08 abemedia