And fix a bug in the warning call in the scanner
if scope not in [ast.PARAM_SCOPE_CALL,
ast.PARAM_SCOPE_ASYNC,
ast.PARAM_SCOPE_NOTIFIED]:
- message.warn(
+ message.warn_node(
parent,
- "Invalid scope %r for parameter %r" % (scope, param.name))
+ "Invalid scope %r for parameter %r" % (scope, param.argname))
else:
param.scope = scope
param.transfer = ast.PARAM_TRANSFER_NONE
include $(top_srcdir)/common.mk
TESTS = \
+ callback-invalid-scope.h \
+ callback-missing-scope.h \
return-gobject.h \
unresolved-type.h
--- /dev/null
+#include "common.h"
+
+/**
+ * test_callback_invalid:
+ * @callback: (scope invalid):
+ *
+ */
+void test_callback_invalid(GCallback *callback, gpointer user_data);
+
+// EXPECT:8: Warning: Test: test_callback_invalid: argument callback: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
+// EXPECT:8: Warning: Test: Invalid scope 'invalid' for parameter 'callback'
--- /dev/null
+#include "common.h"
+
+void test_callback(GCallback *callback, gpointer user_data);
+
+// EXPECT:3: Warning: Test: test_callback: argument callback: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)