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 673806 - annotationparser: indent _parse_comment_block gtkdoc code
annotationparser: indent _parse_comment_block gtkdoc code
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal major
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
: 673975 674008 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-04-09 23:31 UTC by Alban Browaeys
Modified: 2015-02-07 16:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
annotationparser: indent _parse_comment_block gtkdoc code (10.41 KB, patch)
2012-04-09 23:31 UTC, Alban Browaeys
committed Details | Review
patch to regress.h which triggers the bug (570 bytes, patch)
2012-04-17 15:09 UTC, Colin Walters
committed Details | Review

Description Alban Browaeys 2012-04-09 23:31:43 UTC
Created attachment 211682 [details] [review]
annotationparser: indent _parse_comment_block gtkdoc code

The current logic in _parse_comment_block of the annotationparser
check the identifier and use variables that only makes sense if a
result was returned (column_offset, original_line). This patch
indent the logic so it is only triggered if a result is found.
Otherwise it returns None as expected by call chain
"parse >  parse_comment_block > _parse_comment_block":
ie in "parse":
   comment_block = self.parse_comment_block(comment)
   if comment_block is not None:

This still raises a lot of warnings but does not abort while generating
gir for libgnomekbd, mutter or telepathy-glib (those thus have to be
tweaked not to call g-ir-scanner with --warn-error at least until the
parser mask those false positives or the doc from those projects is
fixed to comply with the behaviour expected by giscanner).
Comment 1 Dieter Verfaillie 2012-04-17 12:41:02 UTC
Do you have an example GTK-Doc comment block that triggers the
abort you are describing? The only situation I can imagine where
that might happen is if a line in the comment block does not start
with ' * ' (which is invalid for both GTK-Doc and the new AnnotationParser).
That is exactly what "result = COMMENT_ASTERISK_RE.match(line)"
is testing.

If that's the case, the following should fix the problem. But I'd
still like an example GTK-Doc comment block so we can add it
to the test suite :)

diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 3a6a09d..5e3f413 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -619,6 +619,9 @@ class AnnotationParser(object):
 
                 # Get rid of ' * ' at start of the line.
                 line = line[result.end(0):]
+            else:
+                original_line = line
+                column_offset = 0
 
             ####################################################################
             # Check for GTK-Doc comment block identifier.
Comment 2 Dieter Verfaillie 2012-04-17 12:42:46 UTC
*** Bug 673975 has been marked as a duplicate of this bug. ***
Comment 3 Dieter Verfaillie 2012-04-17 12:45:54 UTC
*** Bug 674008 has been marked as a duplicate of this bug. ***
Comment 4 Colin Walters 2012-04-17 15:09:59 UTC
Created attachment 212216 [details] [review]
patch to regress.h which triggers the bug
Comment 5 Colin Walters 2012-04-17 15:10:52 UTC
Dieter, care to fold the test patch into Alban's patch and commit?
Comment 6 Colin Walters 2012-04-17 15:14:01 UTC
Nevermind i'll just do it =)

Attachment 211682 [details] pushed as f41525d - annotationparser: indent _parse_comment_block gtkdoc code
Comment 7 André Klapper 2015-02-07 16:55:17 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]