GNOME Bugzilla – Bug 639749
g-ir-scanner cannot handle complex.h
Last modified: 2018-01-25 16:06:13 UTC
Created attachment 178512 [details] g-ir-scanner log Including the standard C99 header complex.h [from glibc headers] in an introspected package leads to an afwul lots errors similar to /usr/include/bits/cmathcalls.h:129: syntax error, unexpected identifier, expecting ')' or ',' in 'extern long double creall (long double _Complex __z) __attribute__ ((__nothrow__)); extern long double __creall (long double _Complex __z) __attribute__ ((__nothrow__));' at '__z' Steps to reproduce: =====[ foo.h ]===== #include <complex.h> int foo_do(int x); =====[ foo.c ]===== #include "foo.h" int foo_do(int x) { return x; } =================== libtool --mode=compile gcc -c -o foo.lo foo.c libtool --mode=link gcc -o libfoo.la foo.lo g-ir-scanner --libtool="libtool" -I. --namespace=Foo --nsversion=1.0 --output=Foo-1.0.gir --pkg=glib-2.0 --include=GLib-2.0 --library=libfoo.la foo.c foo.h libfoo.la Supporting complex numbers (that are present both in C and many target languages) would be of course nice, but for start I'd be happy if not supporting them didn't make so much noise.
Also in real-world use g-ir-scanner somehow gets completely confused and prints /home/yeti/Projects/Gwyddion/GWYDDION-3-HEAD/libgwy/version.h:47: syntax error, unexpected $end in '# 47 "<stdin>" 2' at '' where version.h is whatever file was given it last on the command line. This specific file does not have 47 lines at all. I cannot reproduce this problem with a trivial setup as in the original report, but not including complex.h makes it go away too.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Fairly sure g-ir-scanner can cope with math.h and complex.h, these days; if that's not the case, I'd be happy to review a patch that added the tokens that make the lexxer choke to the list of ignored identifiers. Feel free to re-open the bug, if you have a patch.