[gobject-introspection] scanner: Warn if we're missing (element-type) for GPtrArray
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] scanner: Warn if we're missing (element-type) for GPtrArray
- Date: Mon, 10 Dec 2012 22:06:16 +0000 (UTC)
commit f8e95c68dc0e4a0fb35979db7415de8ec09e1e7e
Author: Colin Walters <walters verbum org>
Date: Mon Dec 10 13:12:13 2012 -0500
scanner: Warn if we're missing (element-type) for GPtrArray
For background,
See https://bugzilla.gnome.org/show_bug.cgi?id=629682
See https://bugzilla.gnome.org/show_bug.cgi?id=689871
Basically we should emit a warning here.
https://bugzilla.gnome.org/show_bug.cgi?id=689998
giscanner/introspectablepass.py | 2 +-
tests/warn/invalid-element-type.h | 1 +
tests/warn/missing-element-type.h | 8 ++++++++
3 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/introspectablepass.py b/giscanner/introspectablepass.py
index 97ccfe7..b87156a 100644
--- a/giscanner/introspectablepass.py
+++ b/giscanner/introspectablepass.py
@@ -87,7 +87,7 @@ class IntrospectablePass(object):
parent.introspectable = False
return
- if (isinstance(node.type, ast.List)
+ if (isinstance(node.type, (ast.List, ast.Array))
and node.type.element_type == ast.TYPE_ANY):
self._parameter_warning(parent, node, "Missing (element-type) annotation")
parent.introspectable = False
diff --git a/tests/warn/invalid-element-type.h b/tests/warn/invalid-element-type.h
index 52e3116..c9ff304 100644
--- a/tests/warn/invalid-element-type.h
+++ b/tests/warn/invalid-element-type.h
@@ -80,3 +80,4 @@ GList* test_unresolved_element_type(void);
// EXPECT:63: Warning: Test: test_unresolved_element_type: Unknown type: 'Unresolved'
// EXPECT:4: Warning: Test: test_invalid_list_element_type: argument l1: Missing (element-type) annotation
// EXPECT:4: Warning: Test: test_invalid_list_element_type: argument l2: Missing (element-type) annotation
+// EXPECT:50: Warning: Test: test_invalid_ptrarray_element_type: argument p1: Missing (element-type) annotation
diff --git a/tests/warn/missing-element-type.h b/tests/warn/missing-element-type.h
index 1f958a7..8720640 100644
--- a/tests/warn/missing-element-type.h
+++ b/tests/warn/missing-element-type.h
@@ -8,3 +8,11 @@
GSList *test_gslist_element_type(void);
// EXPECT:6: Warning: Test: test_gslist_element_type: return value: Missing (element-type) annotation
+
+/**
+ * test_ptrarray_element_type:
+ * @somearray: An array.
+ */
+void test_ptrarray_arg_element_type(GPtrArray *somearray);
+
+// EXPECT:16: Warning: Test: test_ptrarray_arg_element_type: argument somearray: Missing (element-type) annotation
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]