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 656773 - gtk-doc fails to find a symbol declared as 'char* const'
gtk-doc fails to find a symbol declared as 'char* const'
Status: RESOLVED FIXED
Product: gtk-doc
Classification: Platform
Component: general
1.18
Other Linux
: Normal normal
: 1.18
Assigned To: gtk-doc maintainers
gtk-doc maintainers
Depends on:
Blocks:
 
 
Reported: 2011-08-17 19:58 UTC by Michał Górny
Modified: 2011-08-22 11:48 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michał Górny 2011-08-17 19:58:10 UTC
My header file declares the following symbol:

	extern const char* const NOTIFY_SESSION_NO_APP_NAME;

While the symbol is completely correct, gtk-doc fails to find it:

	./libtinynotify-sections.txt:8: warning: No declaration found for: NOTIFY_SESSION_NO_APP_NAME

Same happens if I use 'extern char* const'; but if I use, say, 'extern const int', gtk-doc works I expected. My guess is that the code parser used by gtk-doc doesn't handle 'const' after type name correctly.
Comment 1 Michał Górny 2011-08-17 20:01:43 UTC
Ok, that's a definitely broken parser. The following declaration doesn't work as well:

	extern char* /*foo*/ bar;
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2011-08-18 11:22:42 UTC
Added a test for it locally. Regarding the 2nd example, then just don't do it. Everybody knows that gtk-doc uses a simple regexp based parser. Although I happily take patches for plugging a proper parser - have fun.
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2011-08-18 11:58:35 UTC
commit a0ac307ccd90c1afa890d7d4583f73dae30d23ad
Author: Stefan Kost <ensonic@users.sf.net>
Date:   Thu Aug 18 13:56:41 2011 +0200

    scan: improve parsing of externs
    
    An extern of the form "extern const type const name" was not recognised. Add a
    test for this as well. Fixes #656773
Comment 4 Michał Górny 2011-08-20 06:58:13 UTC
Thanks, it works but I'd like to notice that now gtk-doc is inconsistent in listing consts in the 'Synopsis' section: 'normal' consts are printed with full type (e.g. 'extern const int FOOBAR'), 'dual' consts are printed just as 'extern FOOBAR' [1]. Not sure if that was expected or side effect.

[1] http://dev.gentoo.org/~mgorny/libtinynotify/libtinynotify-notification.html
Comment 5 Stefan Sauer (gstreamer, gtkdoc dev) 2011-08-22 11:48:21 UTC
You are right, it wasn't good enough. I made further improvemnts.

commit 9a501f713ec52e3f38484d817b1e0a1e0ee41660
Author: Stefan Kost <ensonic@users.sf.net>
Date:   Mon Aug 22 13:46:05 2011 +0200

    scan,mkdb: more improvements on extern and global variable parsing
    
    Don't drop type details in gtkdoc-mkdb. Improve the layout and add more tests.


Does it look good for you now?