GNOME Bugzilla – Bug 411739
Gtk-doc fails to handle "struct tm * function_name ();"
Last modified: 2007-09-22 19:16:22 UTC
I have a public function that looks like: struct tm * lm_utils_get_localtime (const gchar *stamp); When trying to add this to my generated Gtk-docs I get: WARNING: No declaration found for: lm_utils_get_localtime However, if I try to change "struct tm *" to "foo *" for example it works like intended.
Created attachment 91885 [details] [review] partial fix Makes the case struct tm * lm_utils_get_localtime (const gchar *stamp); work (i.e. the type is on the same line as the function name).
This is hard to fix properly with the current `read line by line and desperately try to match something' parser in gtkdoc-scan. It sees for instance the line struct foo and it has to decide whether it will continue { int bar; double baz; }; or gimme_some_foo(int bar, double baz); Obviously, it can't decide at that point. So it will always get one of these cases wrong. All possible fixes include the introduction of something more resembling a proper parser (by decreasing cleanness): 1. Wait for Perl6 and its grammars. Then rewrite the mad thing. 2. Use something like Parse::RecDescent. 3. At least use the classic m/\G.../gc loop instead of going by lines. In any case it would be quite some work to rewrite.
2007-08-12 Stefan Kost <ensonic@users.sf.net> * gtkdoc-scan.in: * tests/bugs/docs/tester-sections.txt: * tests/bugs/src/tester.c: * tests/bugs/src/tester.h: Improved scan logic. Fixes #411739.
Very nice, thanks a lot!