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 556120 - expands #defined constants which are the default values of properties
expands #defined constants which are the default values of properties
Status: RESOLVED WONTFIX
Product: gtk-doc
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-doc maintainers
gtk-doc maintainers
Depends on:
Blocks:
 
 
Reported: 2008-10-13 11:42 UTC by Will Thompson
Modified: 2009-01-08 09:29 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Will Thompson 2008-10-13 11:42:57 UTC
telepathy-glib features the following property definition:

  /**
   * TpConnection:status:
   *
   * This connection's status, or TP_UNKNOWN_CONNECTION_STATUS if we don't
   * know yet.
   */
  param_spec = g_param_spec_uint ("status", "Status",
      "The status of this connection", 0, G_MAXUINT32,
      TP_UNKNOWN_CONNECTION_STATUS,
      G_PARAM_READABLE
      | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NICK);
  g_object_class_install_property (object_class, PROP_STATUS,
      param_spec);

where:

  #define TP_UNKNOWN_CONNECTION_STATUS ((TpConnectionStatus) -1)
  typedef enum {
      TP_CONNECTION_STATUS_CONNECTED = 0,
      TP_CONNECTION_STATUS_CONNECTING = 1,
      TP_CONNECTION_STATUS_DISCONNECTED = 2,
  } TpConnectionStatus;

In the generated documentation, this becomes:

  The "status" property

    "status"                   guint                 : Read

  This connection's status, or TP_UNKNOWN_CONNECTION_STATUS if we don't know yet.

  Default value: 4294967295

which is kind of unfortunate.  :-)

How hard would it be not to expand #defines in this case?
Comment 1 Stefan Sauer (gstreamer, gtkdoc dev) 2008-10-13 16:25:04 UTC
I think you are using gobject in the wrong way here. Turn the g_param_spec_uint() into a g_param_spec_enum and it will work as expected.

It would be not easy to work around it. Can you switch to an enum?
Comment 2 Will Thompson 2008-10-14 10:58:29 UTC
Not easily. :( TpConnectionStatus is generated from the Telepathy D-Bus specification, and unlike more recent enums doesn't reserve 0 for unknown. So we're stuck with the #define. It makes sense that gtk-doc can't really work around this; just thought I'd ask.

(I guess this is CANTFIX/WONTFIX.)
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2009-01-08 09:29:00 UTC
Problem is really that gtk-doc can't easily accociate the -1 with the right #define. I'llclose this - sry.