[gobject-introspection] Fix warning for missing (element-type)
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Fix warning for missing (element-type)
- Date: Tue, 30 Aug 2011 01:52:24 +0000 (UTC)
commit edb4146278f74030fba9bfd79e21f070f24d4434
Author: Colin Walters <walters verbum org>
Date: Mon Aug 29 21:51:34 2011 -0400
Fix warning for missing (element-type)
While looking for a different bug, I noticed that the introspectable
pass lists was missing GSList. And the warning was never set up
to fire anyways. Fix it and add a test.
giscanner/introspectablepass.py | 4 ++--
tests/warn/Makefile.am | 1 +
tests/warn/invalid-element-type.h | 2 ++
tests/warn/missing-element-type.h | 10 ++++++++++
4 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/introspectablepass.py b/giscanner/introspectablepass.py
index ebb1ded..95d54b0 100644
--- a/giscanner/introspectablepass.py
+++ b/giscanner/introspectablepass.py
@@ -84,8 +84,8 @@ class IntrospectablePass(object):
parent.introspectable = False
return
- if not isinstance(node.type, ast.List) and \
- (node.type.target_giname == 'GLib.List'):
+ if (isinstance(node.type, ast.List)
+ and node.type.element_type == ast.TYPE_ANY):
self._parameter_warning(parent, node, "Missing (element-type) annotation")
parent.introspectable = False
return
diff --git a/tests/warn/Makefile.am b/tests/warn/Makefile.am
index 7d81d9e..5ca3d82 100644
--- a/tests/warn/Makefile.am
+++ b/tests/warn/Makefile.am
@@ -12,6 +12,7 @@ TESTS = \
invalid-option.h \
invalid-out.h \
invalid-transfer.h \
+ missing-element-type.h \
unknown-parameter.h \
unresolved-type.h
diff --git a/tests/warn/invalid-element-type.h b/tests/warn/invalid-element-type.h
index 2b42459..a3e71f5 100644
--- a/tests/warn/invalid-element-type.h
+++ b/tests/warn/invalid-element-type.h
@@ -78,3 +78,5 @@ GList* test_unresolved_element_type(void);
// EXPECT:51: Warning: Test: element-type annotation takes at least one option, none given
// EXPECT:52: Warning: Test: invalid (element-type) for a GPtrArray, must be a pointer
// EXPECT:63: Warning: Test: test_unresolved_element_type: Unknown type: 'Unresolved'
+// EXPECT:3: Warning: Test: test_invalid_list_element_type: argument l1: Missing (element-type) annotation
+// EXPECT:3: Warning: Test: test_invalid_list_element_type: argument l2: Missing (element-type) annotation
diff --git a/tests/warn/missing-element-type.h b/tests/warn/missing-element-type.h
new file mode 100644
index 0000000..1f958a7
--- /dev/null
+++ b/tests/warn/missing-element-type.h
@@ -0,0 +1,10 @@
+#include "common.h"
+
+/**
+ * test_gslist_element_type:
+ *
+ * Returns: (transfer none): Some stuff
+ */
+GSList *test_gslist_element_type(void);
+
+// EXPECT:6: Warning: Test: test_gslist_element_type: return value: Missing (element-type) annotation
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]