GNOME Bugzilla – Bug 418027
gtkdoc-mkdb does not handle #ifdef in enum {}
Last modified: 2007-09-22 19:49:14 UTC
gtkdoc-mkdb --module=gobject --source-dir=../../../gobject --output-format=xml --expand-content-files="" --main-sgml-file=gobject-docs.sgml Cannot parse enumeration member "#ifndef G_DISABLE_DEPRECATED G_PARAM_PRIVATE = G_PARAM_STATIC_NAME" at /opt/gnome/share/gtk-doc/data/gtkdoc-common.pl line 287, <INPUT> line 416. Cannot parse enumeration member "#endif G_PARAM_STATIC_NICK = 1 << 6" at /opt/gnome/share/gtk-doc/data/gtkdoc-common.pl line 287, <INPUT> line 416. This removes documentation from tmpl files!
Created attachment 84594 [details] [review] fixes parsing structs or enums with #ifdefs okay to commit?
The regular expressions look a bit weird to me. Why not just something like: # ignore preprocessor directives next if $line =~ /^#/;
That was my first attempt. Let me illustrate the problem: enum { G_FLAG1 = 1, #ifdef DEPRECATED G_FLAG2, #endif G_FLAG3, }; The whole enum gets processed using /msg in the regexp and line gets splitted on ',' thus for the #ifdef you have $line="#ifdef DEPRECATED\n G_FLAG2," and if you drop that you loose the actual enum value. Same applies to #endif.
Oh yes, I see. Go ahead and commit it then.
2007-03-16 Stefan Kost <ensonic@users.sf.net> * gtkdoc-common.pl.in: handle preprocessor statements in enum and struct declarations. Fixes #418027.