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 629708 - No warning for parameter name mismatch
No warning for parameter name mismatch
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-09-14 20:18 UTC by Owen Taylor
Modified: 2015-02-07 16:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add parameter mismatch warnings (2.66 KB, patch)
2010-09-14 21:52 UTC, Johan (not receiving bugmail) Dahlin
none Details | Review
Add parameter mismatch warnings (3.60 KB, patch)
2010-09-14 21:54 UTC, Johan (not receiving bugmail) Dahlin
reviewed Details | Review
Add a parameter mismatch warning (5.93 KB, patch)
2010-09-14 22:38 UTC, Johan (not receiving bugmail) Dahlin
committed Details | Review
[gio] Fix a broken doc string (632 bytes, patch)
2010-09-14 22:38 UTC, Johan (not receiving bugmail) Dahlin
committed Details | Review

Description Owen Taylor 2010-09-14 20:18:50 UTC
According to bug 629595, if you have in the header file:

 void frob_foo(Frob f, int *retval);

And in the C file:

 /**
  * frob_foo:
  * @frob:
  * @int_p: (out): 
  *
  */

The name mismatch for the out parameter causes the annotation to silently be skipped, no warning.
Comment 1 Johan (not receiving bugmail) Dahlin 2010-09-14 20:46:15 UTC
We don't parse C files, we only lex them to get out comments. That means that we can only compare the parameter names for the doc comment and the header.

So something like this should be right:

Warning: foo.h:45: frob_foo: 2nd parameter mismatch, doc=int_p, header=retval
Comment 2 Colin Walters 2010-09-14 21:00:33 UTC
There's obviously 3 separate argument lists; header, C file, gtk-doc.  My suggestion here is we warn if:

* There is an annotation
* All 3 do not match exactly
Comment 3 Johan (not receiving bugmail) Dahlin 2010-09-14 21:52:14 UTC
Created attachment 170294 [details] [review]
Add parameter mismatch warnings
Comment 4 Johan (not receiving bugmail) Dahlin 2010-09-14 21:53:43 UTC
(In reply to comment #2)
> There's obviously 3 separate argument lists; header, C file, gtk-doc.  My
> suggestion here is we warn if:
> 
> * There is an annotation
> * All 3 do not match exactly

Agreed, but including C in the mix is going to be so much work that it is not worth it. Basically we need to parse C a lot better than we do today.
Comment 5 Johan (not receiving bugmail) Dahlin 2010-09-14 21:54:34 UTC
Created attachment 170295 [details] [review]
Add parameter mismatch warnings
Comment 6 Owen Taylor 2010-09-14 22:04:19 UTC
Review of attachment 170295 [details] [review]:

Suggestion for a wording change below. Otherwise makes sense to me.

::: giscanner/maintransformer.py
@@ +562,3 @@
     def _apply_annotations_params(self, parent, params, block):
+        if not block:
+            return

A little bit nervous making to change this, wonder why it was calling self._apply_annotations_param(parent, param, None) for unannotated parameters, but I can't find anything it was actually doing in that case.

::: tests/warn/unknown-parameter.h
@@ +17,3 @@
+void test_param_mismatch2(int a, int *out2);
+
+// EXPECT:: Warning: Test: test_param_mismatch2: missing parameter 'wrong_name2', should be one of 'a', 'out2'

This warning seems unnecessarily confusing to me.

 'unknown parameter '%s' in documentation comment, ....'

Would immediately let you know which way you had screwed up.
Comment 7 Johan (not receiving bugmail) Dahlin 2010-09-14 22:37:54 UTC
The following fixes have been pushed:
c31120d Add a parameter mismatch warning
839afcc [gio] Fix a broken doc string
Comment 8 Johan (not receiving bugmail) Dahlin 2010-09-14 22:38:07 UTC
Created attachment 170301 [details] [review]
Add a parameter mismatch warning
Comment 9 Johan (not receiving bugmail) Dahlin 2010-09-14 22:38:14 UTC
Created attachment 170302 [details] [review]
[gio] Fix a broken doc string
Comment 10 André Klapper 2015-02-07 16:56:12 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]