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 639206 - [scanner] constants defined using G_GINT64_CONSTANT and G_MAXINT64 are not generated
[scanner] constants defined using G_GINT64_CONSTANT and G_MAXINT64 are not ge...
Status: RESOLVED WONTFIX
Product: gobject-introspection
Classification: Platform
Component: g-ir-scanner
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2011-01-11 11:00 UTC by Guillaume Desmottes
Modified: 2018-01-24 18:23 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Guillaume Desmottes 2011-01-11 11:00:18 UTC
These 2 tp-glib constants are not exported in the gir file.

#define TP_USER_ACTION_TIME_NOT_USER_ACTION (G_GINT64_CONSTANT (0))

#define TP_USER_ACTION_TIME_CURRENT_TIME (G_MAXINT64)
Comment 1 Tomeu Vizoso 2011-02-05 16:34:32 UTC
Have looked a bit at how this is done currently in g-i and looks like the headers are first passed through cpp then parsed. As this will omit the constants, a second parsing pass is done on the lines that look like macros, this time without invoking cpp.

#define TP_USER_ACTION_TIME_CURRENT_TIME (G_MAXINT64)

This would not be a problem if G_MAXINT64 was defined. But it's not because it's defined in terms of G_GINT64_CONSTANT().

A solution would likely involve invoking cpp on the right side of those defines, then using the result as values for those constants.
Comment 2 Tomeu Vizoso 2011-02-07 10:59:16 UTC
(In reply to comment #1)
> A solution would likely involve invoking cpp on the right side of those
> defines, then using the result as values for those constants.

Have been playing a bit with this idea and while it would help with some other constants, it wouldn't work on this case, as it would end up evaluating to:

#define TP_USER_ACTION_TIME_CURRENT_TIME ((__extension__ (0LL)))

which the C parser cannot recognize as an integer literal without knowing that __extension__ is intended for gcc and can be ignored.

Any suggestions about how to solve this issue?
Comment 3 Guillaume Desmottes 2011-02-14 10:14:49 UTC
We have similar issue with features:

GQuark tp_connection_get_feature_quark_core (void) G_GNUC_CONST;
is propery exported, but


#define TP_CONNECTION_FEATURE_CORE \
  (tp_connection_get_feature_quark_core ())
is not
Comment 4 Johan (not receiving bugmail) Dahlin 2011-09-14 11:10:58 UTC
We only support int/float/string constants for now.

There's now support for Value: annotations to override the constant, it's sometimes necessary as we don't expand the pre-processed part on the right hide sand.
Comment 5 André Klapper 2015-02-07 17:10:58 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Comment 6 Emmanuele Bassi (:ebassi) 2018-01-24 18:23:37 UTC
Nothing happened in 7 years, so let's close this. Constants can be integers, floats, and strings; for anything computed, there's the Value annotation. Anything more complicated than that is usually an indication of some C trickery that does not translate to other languages.