summaryrefslogtreecommitdiff
path: root/tests/warn
diff options
context:
space:
mode:
authorGarrett Regier <garrett.regier@riftio.com>2015-07-06 18:54:23 -0700
committerColin Walters <walters@verbum.org>2015-10-04 17:34:12 -0400
commit09c466f0184e74ba6f279f103ad3be3a7e1f2a06 (patch)
tree717499c4cb224dd35ffef2feed10bc0a274b62ae /tests/warn
parent849f1eef10b18eddaf41c1e0b2cca87bf5d93739 (diff)
downloadgobject-introspection-09c466f0184e74ba6f279f103ad3be3a7e1f2a06.tar.gz
scanner: Warn and ignore return annotations when there is no return value
Otherwise the .gir can contain invalid data which would likely cause a crash at runtime. https://bugzilla.gnome.org/show_bug.cgi?id=752044 Signed-off-by: Garrett Regier <garrett.regier@riftio.com>
Diffstat (limited to 'tests/warn')
-rw-r--r--tests/warn/Makefile.am1
-rw-r--r--tests/warn/invalid-return.h19
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/warn/Makefile.am b/tests/warn/Makefile.am
index fb7e989d..5f47df0a 100644
--- a/tests/warn/Makefile.am
+++ b/tests/warn/Makefile.am
@@ -14,6 +14,7 @@ TESTS = \
invalid-option.h \
invalid-optional.h \
invalid-out.h \
+ invalid-return.h \
invalid-transfer.h \
missing-element-type.h \
return-gobject.h \
diff --git a/tests/warn/invalid-return.h b/tests/warn/invalid-return.h
new file mode 100644
index 00000000..c033b767
--- /dev/null
+++ b/tests/warn/invalid-return.h
@@ -0,0 +1,19 @@
+#include "common.h"
+
+/**
+ * TestInvalidReturnCallback:
+ *
+ * Returns:
+ */
+typedef void (*TestInvalidReturnCallback) (void);
+
+// EXPECT:6: Warning: Test: TestInvalidReturnCallback: invalid return annotation
+
+/**
+ * test_invalid_return:
+ *
+ * Returns:
+ */
+void test_invalid_return (void);
+
+// EXPECT:15: Warning: Test: test_invalid_return: invalid return annotation