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 572790 - #defines should be parsed in .h files but not .c files
#defines should be parsed in .h files but not .c files
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2009-02-22 22:47 UTC by Dan Winship
Modified: 2015-02-07 16:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add test to make sure #defines are parsed in .h files but not .h files (2.23 KB, patch)
2009-02-22 22:48 UTC, Dan Winship
none Details | Review
Bug 572790 - Don't register #defines from .c files as constants (7.01 KB, patch)
2009-02-24 19:24 UTC, Colin Walters
accepted-commit_now Details | Review

Description Dan Winship 2009-02-22 22:47:57 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. :)
Comment 1 Dan Winship 2009-02-22 22:48:01 UTC
Created attachment 129288 [details] [review]
Add test to make sure #defines are parsed in .h files but not .h files
Comment 2 Colin Walters 2009-02-24 19:24:13 UTC
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 3 Johan (not receiving bugmail) Dahlin 2009-02-24 19:27:56 UTC
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.
Comment 4 Colin Walters 2009-02-24 19:32:18 UTC
I'd like to use the filename data for error messages too later (bug 570818)
Comment 5 Colin Walters 2009-02-25 17:09:09 UTC
This one was pushed.
Comment 6 André Klapper 2015-02-07 16:55:27 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]