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 471014 - G_CONST_RETURN * G_CONST_RETURN * function not picked up
G_CONST_RETURN * G_CONST_RETURN * function not picked up
Status: RESOLVED FIXED
Product: gtk-doc
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: 1.9
Assigned To: gtk-doc maintainers
gtk-doc maintainers
: 486678 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-08-28 08:09 UTC by Paolo Borelli
Modified: 2007-10-15 06:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (780 bytes, patch)
2007-08-28 09:02 UTC, Paolo Borelli
needs-work Details | Review
better patch (762 bytes, patch)
2007-08-29 17:07 UTC, Yeti
committed Details | Review

Description Paolo Borelli 2007-08-28 08:09:05 UTC
In gtksourceview we are experiencing problems documenting functions that return G_CONST_RETURN * G_CONST_RETURN *.

I am pretty sure that I managed to make them work at some point in the past by tweaking the spaces between 'G_CONST_RETURN' and '*' (which would be a bug by itself) but at the moment they are not picked up at all.

For an example check the function gtk_source_style_scheme_manager_get_scheme_ids in:

http://svn.gnome.org/viewcvs/gtksourceview/trunk/gtksourceview/gtksourcestyleschememanager.h?revision=1650&view=markup
http://svn.gnome.org/viewcvs/gtksourceview/trunk/gtksourceview/gtksourcestyleschememanager.c?revision=1650&view=markup
http://svn.gnome.org/viewcvs/gtksourceview/trunk/docs/reference/gtksourceview-2.0-sections.txt?revision=1650&view=markup
Comment 1 Paolo Borelli 2007-08-28 09:02:37 UTC
Created attachment 94489 [details] [review]
patch

This quick oneliner seems to fix the issue for me.

Someone who actually knows perl could make the patch better for sure, among other things it seems that the regex to match the return value of a function is cut&pasted many times instead of being factored out in a variable.
Also probably the regex should be made more robust to whitespaces among const and *.
Comment 2 Yeti 2007-08-28 22:39:39 UTC
Confirmed with svn trunk.

The patch in attachment 1 [details] makes it to pick the declaration.  However, the second G_CONST_RETURN* is then missing in the documentation because it only appears in a non-grouping group (?:...).

We should also accept an arbitrary sequence of mixed * and const (and const-equivalents and restrict), not just one level.  Someday someone will want to return const gchar *const *const*...
Comment 3 Yeti 2007-08-28 22:42:25 UTC
Attachment 94489 [details] of course, not 1.
Comment 4 Yeti 2007-08-29 17:07:51 UTC
Created attachment 94557 [details] [review]
better patch

Allow arbitrary number const/*-stuff and put all into the right group so that it actually appears in the documentation.

The case with return type on the same line as name and args works for me, so I did not touch it (not that I understand the regexp).
Comment 5 Stefan Sauer (gstreamer, gtkdoc dev) 2007-09-11 19:18:39 UTC
Is this in gtkdoc-scan only?
Comment 6 Yeti 2007-09-11 20:07:25 UTC
With this fix the examples in the bug report build correctly.  So only this gtkdoc-scan fix is necessary.

However, 3+ levels of G_CONST_RETURN seem to require a fix somewhere else and/or the corrected regexp does not work as expected.
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2007-09-17 22:13:41 UTC
2007-09-18  Stefan Kost  <ensonic@users.sf.net>

	patch by: David Nečas <yeti@physics.muni.cz>

	* gtkdoc-scan.in:
	  Parse reoccuring const. Fixes #471014.
Comment 8 Yeti 2007-10-15 06:32:52 UTC
*** Bug 486678 has been marked as a duplicate of this bug. ***