GNOME Bugzilla – Bug 656773
gtk-doc fails to find a symbol declared as 'char* const'
Last modified: 2011-08-22 11:48:21 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.
Ok, that's a definitely broken parser. The following declaration doesn't work as well: extern char* /*foo*/ bar;
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.
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
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
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?