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 615890 - warn when there's an arg annotation that doesn't match the function definition
warn when there's an arg annotation that doesn't match the function definition
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2010-04-15 21:21 UTC by Tomeu Vizoso
Modified: 2015-02-07 16:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Warn about annotations for unknown args (1.49 KB, patch)
2010-04-28 11:58 UTC, Tomeu Vizoso
committed Details | Review
Warn about annotations for unknown args (1.39 KB, patch)
2010-04-28 12:33 UTC, Tomeu Vizoso
committed Details | Review

Description Tomeu Vizoso 2010-04-15 21:21:47 UTC
In this block:

/**
 * test_cairo_surface_full_out:
 * @out: (out) (transfer full):
 */
void
test_cairo_surface_full_out (cairo_surface_t **out)


the annotation for the out arg is ignored.

If I change 'out' to 'surface', it works:

/**
 * test_cairo_surface_full_out:
 * @surface: (out) (transfer full):
 */
void
test_cairo_surface_full_out (cairo_surface_t **surface)
Comment 1 Tomeu Vizoso 2010-04-28 08:39:05 UTC
Looks like 'array' is another reserved word which will cause annotations to be silently dropped.
Comment 2 Tomeu Vizoso 2010-04-28 10:39:51 UTC
Actually, what i think was going on is that the function definition had a different name for that arg.

What we should do is warn that the annotation refers to an arg that is not in the function declaration
Comment 3 Tomeu Vizoso 2010-04-28 11:58:22 UTC
Created attachment 159780 [details] [review]
Warn about annotations for unknown args
Comment 4 Johan (not receiving bugmail) Dahlin 2010-04-28 12:04:01 UTC
Review of attachment 159780 [details] [review]:

Looks good with the changes mentioned above.

::: giscanner/annotationparser.py
@@ +498,3 @@
 
+    def _check_arg_annotations(self, parent, params, block):
+        if block is not None:

Invert + return to reduce indentation

@@ +502,3 @@
+                if tag == TAG_RETURNS:
+                    continue
+                found = False

This python pattern is nicer:

for n in ns:
   if cond:
      break
else:
   return
# code only called when break was invoked.

@@ +507,3 @@
+                        found = True
+                        break
+                if not found:

and add else: return here
Comment 5 Tomeu Vizoso 2010-04-28 12:33:36 UTC
The following fix has been pushed:
24711bc Warn about annotations for unknown args
Comment 6 Tomeu Vizoso 2010-04-28 12:33:47 UTC
Created attachment 159785 [details] [review]
Warn about annotations for unknown args
Comment 7 André Klapper 2015-02-07 16:52:07 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]