After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 631507 - g-ir-scanner can't handle some of Mac OS X's system headers
g-ir-scanner can't handle some of Mac OS X's system headers
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Mac OS
: Normal major
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2010-10-06 10:14 UTC by Alexey Zakhlestin
Modified: 2015-02-07 17:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Failing header (2.66 KB, text/plain)
2010-10-06 10:15 UTC, Alexey Zakhlestin
  Details
Second failing header (11.49 KB, text/plain)
2010-10-06 10:16 UTC, Alexey Zakhlestin
  Details
scanner: Report __inline__ as the inline token (998 bytes, patch)
2013-08-26 10:37 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Alexey Zakhlestin 2010-10-06 10:14:36 UTC
Build process of libgda 4.0.11 calls g-ir-scanner tool, which scans gda's sources and follows chain of includes to system headers.

Here's the error I get:

/usr/include/libkern/i386/_OSByteOrder.h:49: syntax error, unexpected '{', expecting ',' or ';' in '{' at '{'
/usr/include/libkern/i386/_OSByteOrder.h:58: syntax error, unexpected '{', expecting ',' or ';' in '{' at '{'
/usr/include/libkern/i386/_OSByteOrder.h:96: syntax error, unexpected '{', expecting ',' or ';' in '{' at '{'
/usr/include/stdlib.h:272: syntax error, unexpected '^' in 'int atexit_b(void (^)(void));' at '^'
/usr/include/stdlib.h:274: syntax error, unexpected '^' in '     size_t, int (^)(const void *, const void *));' at '^'
/usr/include/stdlib.h:274: syntax error, unexpected ',', expecting identifier or '(' in '     size_t, int (^)(const void *, const void *));' at ','
/usr/include/stdlib.h:274: syntax error, unexpected ')', expecting identifier or '(' in '     size_t, int (^)(const void *, const void *));' at ')'
/usr/include/stdlib.h:301: syntax error, unexpected '^' in '     int (^)(const void *, const void *));' at '^'
/usr/include/stdlib.h:301: syntax error, unexpected ',', expecting identifier or '(' in '     int (^)(const void *, const void *));' at ','
/usr/include/stdlib.h:301: syntax error, unexpected ')', expecting identifier or '(' in '     int (^)(const void *, const void *));' at ')'
/usr/include/stdlib.h:307: syntax error, unexpected '^' in '     int (^)(const void *, const void *));' at '^'
/usr/include/stdlib.h:307: syntax error, unexpected ',', expecting identifier or '(' in '     int (^)(const void *, const void *));' at ','
/usr/include/stdlib.h:307: syntax error, unexpected ')', expecting identifier or '(' in '     int (^)(const void *, const void *));' at ')'
/usr/include/stdlib.h:313: syntax error, unexpected '^' in '     int (^)(const void *, const void *));' at '^'
/usr/include/stdlib.h:313: syntax error, unexpected ',', expecting identifier or '(' in '     int (^)(const void *, const void *));' at ','
/usr/include/stdlib.h:313: syntax error, unexpected ')', expecting identifier or '(' in '     int (^)(const void *, const void *));' at ')'
/usr/include/stdlib.h:319: syntax error, unexpected '^' in '     int (^)(const void *, const void *));' at '^'
/usr/include/stdlib.h:319: syntax error, unexpected ',', expecting identifier or '(' in '     int (^)(const void *, const void *));' at ','
/usr/include/stdlib.h:319: syntax error, unexpected ')', expecting identifier or '(' in '     int (^)(const void *, const void *));' at ')'

I'm supplying these 2 headers in attachments
Comment 1 Alexey Zakhlestin 2010-10-06 10:15:49 UTC
Created attachment 171815 [details]
Failing header
Comment 2 Alexey Zakhlestin 2010-10-06 10:16:41 UTC
Created attachment 171816 [details]
Second failing header
Comment 3 Daniel Macks 2010-10-10 19:03:28 UTC
^ is a block/closure syntax feature, maybe only on apple's compilers right now? See http://www.macresearch.org/cocoa-scientists-part-xxvii-getting-closure-objective-c for some info about it.
Comment 4 Alexey Zakhlestin 2011-02-22 11:42:35 UTC
same with gobject-introspecion 0.10.2 and libgda 4.2.4
Comment 5 Tomeu Vizoso 2011-03-21 06:10:48 UTC
Is it really just one issue? I cannot see any closure around _OSByteOrder.h:49

Would be helpful to identify further the individual issues that make compilation on OSX fail and file separate bugs with that information.

About the former, may be some issue with the whitespace formatting in that header. A fix is likely to be needed in:

http://git.gnome.org/browse/gobject-introspection/tree/giscanner/scannerparser.y

About the latter, we could extend the parser to understand ^, or just make sure that __BLOCKS__ is undefined when building on OSX.
Comment 6 Gregory Ewing 2011-03-21 08:39:40 UTC
Regarding the _OSByteOrder.h errors, the macro expansion of the
declarations concerned look like

static __inline__
__uint16_t
_OSSwapInt16(
    __uint16_t _data
)
{
    ...
}

It seems like the scanner doesn't know about __inline__.

I tried to hack the lexer to recognise "__inline__" as a synonym
for "inline", but it didn't seem to help. So either I performed
the hacking incorrectly, or there is more than one problem
here, or I've misdiagnosed the problem entirely.
Comment 7 jessevdk@gmail.com 2012-01-12 11:54:46 UTC
Adding __inline__ to the lexer fixes the problem for me.
Comment 8 rtjava 2012-03-11 16:40:02 UTC
could you tell me how to add __inline__ to the lexer? thanks
(In reply to comment #7)
> Adding __inline__ to the lexer fixes the problem for me.
Comment 9 Emmanuele Bassi (:ebassi) 2013-08-26 10:37:02 UTC
Created attachment 253110 [details] [review]
scanner: Report __inline__ as the inline token

Improves support on MacOS when scanning system headers.
Comment 10 Colin Walters 2014-02-10 18:53:28 UTC
Review of attachment 253110 [details] [review]:

Looks fine to me, thanks for the patch!
Comment 11 Colin Walters 2014-02-10 18:53:52 UTC
Attachment 253110 [details] pushed as b58425b - scanner: Report __inline__ as the inline token
Comment 12 André Klapper 2015-02-07 17:01:55 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]