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 789087 - gint and guint misrepresented as functions
gint and guint misrepresented as functions
Status: RESOLVED OBSOLETE
Product: gtk-doc
Classification: Platform
Component: general
1.26
Other All
: Normal normal
: ---
Assigned To: gtk-doc maintainers
gtk-doc maintainers
Depends on:
Blocks:
 
 
Reported: 2017-10-17 10:18 UTC by Jan Alexander Steffens (heftig)
Modified: 2018-05-22 13:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gutils: move defines below prototypes to fix the docs (1.66 KB, patch)
2017-10-25 20:10 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review

Description Jan Alexander Steffens (heftig) 2017-10-17 10:18:18 UTC
The "Basic Types" documentation page lists the `gint` and `guint` symbols as functions instead of types.

This seems to have been introduced somewhere between 2.46.2 and 2.48.2 (or perhaps in the gtk-doc versions used), as seen in the hosted docs:

https://developer.gnome.org/glib/2.46/glib-Basic-Types.html#gint
https://developer.gnome.org/glib/2.48/glib-Basic-Types.html#gint
Comment 1 Philip Withnall 2017-10-17 11:24:47 UTC
Looks like a bug in gtk-doc. Reproducible with glib master and gtk-doc 1.26.1 (95a93122a2934e618024f291620edd9c9a3c4e3b).
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2017-10-25 20:09:50 UTC
This was introduces by
https://git.gnome.org/browse/glib/commit/glib/gutils.h?id=9834f79279574e2cddc4dcb6149da9bd782dd40d

and is not really a gtk-doc bug. gtk-doc would ideally understand this and at least print a better error. I am attaching a patch for glib, let me know if I should push it.
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2017-10-25 20:10:33 UTC
Created attachment 362291 [details] [review]
gutils: move defines below prototypes to fix the docs
Comment 4 Philip Withnall 2017-10-25 23:13:22 UTC
How on earth are the definitions of the g_bit_*() functions (in gutils.h) affecting the generated documentation for guint and gint (in gtypes.h)?
Comment 5 Stefan Sauer (gstreamer, gtkdoc dev) 2017-10-26 18:38:53 UTC
It is a header file and it clobbers the previous decl. I will add some code to handle this better, the patch is offered to fix the docs now.
In any case, most people know that gtk-doc parses headers using a bunch of regexp, challenging the parse is not a good idea :/
Comment 6 Philip Withnall 2017-10-27 10:48:17 UTC
(In reply to Stefan Sauer (gstreamer, gtkdoc dev) from comment #5)
> It is a header file and it clobbers the previous decl. I will add some code
> to handle this better, the patch is offered to fix the docs now.
> In any case, most people know that gtk-doc parses headers using a bunch of
> regexp, challenging the parse is not a good idea :/

Are you planning to fix this in gtk-doc soon, or will it take a while? I’d rather not push the workaround to GLib unless the gtk-doc fix is going to take a while.
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2017-11-01 20:02:10 UTC
This is the first time it was reported and it is a special case. I need to first figure which regexp to adjust and to carefully test that it has no side effects. Not sure when I can look into it :/
Comment 8 Stefan Sauer (gstreamer, gtkdoc dev) 2017-11-04 12:14:45 UTC
You probably want to add the GLIB_AVAILABLE_* defines into the --ignore-decorators
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2017-11-04 19:40:39 UTC
Fixing this is not going to be easy.
1) We have two declarations for the same symbol (e.g. g_bit_nth_lsf) - one is the macro and one is the actual function.
2) the prototype looks as if:
   "GLIB_AVAILABLE_IN_ALL" is the return type, 
   "gint" is the function name and
   "(g_bit_nth_lsf)" are the parameters

scan.py:ScanHeader:306:INFO:no decl: #define g_bit_nth_lsf(mask, nth_bit) g_bit_nth_lsf_impl(mask, nth_bit)
scan.py:ScanHeader:364:INFO:Macro: "g_bit_nth_lsf"

scan.py:ScanHeader:306:INFO:no decl: 
scan.py:ScanHeader:306:INFO:no decl: GLIB_AVAILABLE_IN_ALL
scan.py:ScanHeader:306:INFO:no decl: gint    (g_bit_nth_lsf)         (gulong mask,
scan.py:ScanHeader:552:INFO:Function  (2): "gint", Returns: "GLIB_AVAILABLE_IN_ALL"
scan.py:ScanHeader:635:INFO:in decl: skip=0 gint   nth_bit);

Finally, why do we have one impl and both macros that redirect to the impl *and* functions that do this? Backwards compat?
Maybe the functions prototypes should be removed from the header?
Comment 10 Philip Withnall 2017-11-07 13:55:23 UTC
I’ve filed bug #790015 with some patches to fix various issues with the GLib docs (including adding GLIB_AVAILABLE_* and GLIB_DEPRECATED_* to the --ignore-decorators, thanks for the hint). It improves the docs, but it doesn’t solve the issue here.

If I put #ifndef __GTK_DOC_IGNORE__ around the #defines for g_bit_nth_lsf() and friends, I get the following, which perhaps provides a bit more insight into the problem:

WARNING:root:Cannnot parse args for function in "g_bit_nth_lsf)         (gulong mask, gint   nth_bit
"
WARNING:root:Cannnot parse args for function in "g_bit_storage)         (gulong number
"
/opt/gnome/source/glib/glib/docs.c:1591: warning: Field description for GFloatIEEE754::v_float is not used from source code comment block.
./glib-sections.txt:1867: warning: No declaration found for g_bit_nth_lsf.
./glib-sections.txt:1868: warning: No declaration found for g_bit_nth_msf.
./glib-sections.txt:1869: warning: No declaration found for g_bit_storage.
Comment 11 GNOME Infrastructure Team 2018-05-22 13:12:54 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk-doc/issues/39.