GNOME Bugzilla – Bug 471014
G_CONST_RETURN * G_CONST_RETURN * function not picked up
Last modified: 2007-10-15 06:32:52 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
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 *.
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*...
Attachment 94489 [details] of course, not 1.
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).
Is this in gtkdoc-scan only?
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.
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.
*** Bug 486678 has been marked as a duplicate of this bug. ***