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 411739 - Gtk-doc fails to handle "struct tm * function_name ();"
Gtk-doc fails to handle "struct tm * function_name ();"
Status: RESOLVED FIXED
Product: gtk-doc
Classification: Platform
Component: general
1.7
Other Linux
: Normal normal
: 1.9
Assigned To: gtk-doc maintainers
gtk-doc maintainers
Depends on:
Blocks:
 
 
Reported: 2007-02-24 22:53 UTC by Mikael Hallendal
Modified: 2007-09-22 19:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
partial fix (1.24 KB, patch)
2007-07-17 11:08 UTC, Yeti
committed Details | Review

Description Mikael Hallendal 2007-02-24 22:53:55 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.
Comment 1 Yeti 2007-07-17 11:08:33 UTC
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).
Comment 2 Yeti 2007-07-17 11:36:01 UTC
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.
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2007-08-12 17:25:52 UTC
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.
Comment 4 Mikael Hallendal 2007-08-13 20:56:35 UTC
Very nice, thanks a lot!