GNOME Bugzilla – Bug 572790
#defines should be parsed in .h files but not .c files
Last modified: 2015-02-07 16:55:27 UTC
gobject-introspection currently includes #defines from .c files as <constant> nodes in the .gir file, which is clearly wrong. It should only be including #defines from .h files. I'm attaching a regression test, but I don't actually have the corresponding fix that makes the regression test pass. :)
Created attachment 129288 [details] [review] Add test to make sure #defines are parsed in .h files but not .h files
Created attachment 129423 [details] [review] Bug 572790 - Don't register #defines from .c files as constants We keep track of the source filename for every symbol. This enables us to later filter symbols based on that name.
Comment on attachment 129423 [details] [review] Bug 572790 - Don't register #defines from .c files as constants >diff --git a/giscanner/transformer.py b/giscanner/transformer.py >+ # Don't create constants for non-public things >+ # http://bugzilla.gnome.org/show_bug.cgi?id=572790 >+ if not symbol.source_filename.endswith('.h'): >+ return None Since you're not actually using the filename for anything, what about doing that comparison in C and call it "in_header" instead? Looks good whatever you decide to do.
I'd like to use the filename data for error messages too later (bug 570818)
This one was pushed.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]