GNOME Bugzilla – Bug 629708
No warning for parameter name mismatch
Last modified: 2015-02-07 16:56:12 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.
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
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
Created attachment 170294 [details] [review] Add parameter mismatch warnings
(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.
Created attachment 170295 [details] [review] Add parameter mismatch warnings
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.
The following fixes have been pushed: c31120d Add a parameter mismatch warning 839afcc [gio] Fix a broken doc string
Created attachment 170301 [details] [review] Add a parameter mismatch warning
Created attachment 170302 [details] [review] [gio] Fix a broken doc string
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]