From 97b30ae5e77d5e36d127d02b247d6d41b8e1c8c3 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sun, 2 Dec 2012 12:15:53 -0500 Subject: WarnLib: New library for testing API that emits warnings Both GIMarshallingTests and Regress right now use --warn-error; but in some cases (e.g. GErrors without a corresponding enum), we still want bindings to support the functionality. So add this new library where we can add C API that emits introspection warnings. https://bugzilla.gnome.org/show_bug.cgi?id=689488 --- tests/scanner/warnlib.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/scanner/warnlib.c (limited to 'tests/scanner/warnlib.c') diff --git a/tests/scanner/warnlib.c b/tests/scanner/warnlib.c new file mode 100644 index 00000000..4fc8515d --- /dev/null +++ b/tests/scanner/warnlib.c @@ -0,0 +1,20 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +#include "config.h" + +#include "warnlib.h" + +GQuark +warnlib_unpaired_error_quark (void) +{ + return g_quark_from_static_string ("warnlib-unpaired-error"); +} + +gboolean +warnlib_throw_unpaired (GError **error) +{ + g_set_error_literal (error, warnlib_unpaired_error_quark (), 0, + "Unpaired error"); + return FALSE; +} + -- cgit v1.2.1 From b714353e38cf72b6cb2754d413b3688a47624028 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 3 Feb 2013 10:50:21 -0500 Subject: tests: Move do_moo to warnlib We want to warn on unnamed params in declarations to ensure that all functions are bindable. Thus, we need to move a test containing unnamed params to WarnLib so it can be tested. https://bugzilla.gnome.org/show_bug.cgi?id=693098 --- tests/scanner/warnlib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/scanner/warnlib.c') diff --git a/tests/scanner/warnlib.c b/tests/scanner/warnlib.c index 4fc8515d..940d2b6a 100644 --- a/tests/scanner/warnlib.c +++ b/tests/scanner/warnlib.c @@ -18,3 +18,16 @@ warnlib_throw_unpaired (GError **error) return FALSE; } +typedef WarnLibWhateverIface WarnLibWhateverInterface; +G_DEFINE_INTERFACE (WarnLibWhatever, warnlib_whatever, G_TYPE_OBJECT) + +static void +warnlib_whatever_default_init(WarnLibWhateverIface *iface) +{ +} + +void +warnlib_whatever_do_moo (WarnLibWhatever *self, int x, gpointer y) +{ + WARNLIB_WHATEVER_GET_IFACE(self)->do_moo (self, x, y); +} -- cgit v1.2.1 From 001631bf9b9e672154492bf6547c0c7c985ed3e0 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Fri, 23 Aug 2013 08:48:05 +0200 Subject: giscanner: write virtual method instance parameter docs to .gir file --- tests/scanner/warnlib.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/scanner/warnlib.c') diff --git a/tests/scanner/warnlib.c b/tests/scanner/warnlib.c index 940d2b6a..d7c1e2a1 100644 --- a/tests/scanner/warnlib.c +++ b/tests/scanner/warnlib.c @@ -31,3 +31,17 @@ warnlib_whatever_do_moo (WarnLibWhatever *self, int x, gpointer y) { WARNLIB_WHATEVER_GET_IFACE(self)->do_moo (self, x, y); } + +/** + * warnlib_whatever_do_boo: + * @self: a WarnLibWhatever + * @x: x parameter + * @y: y parameter + * + * Does boo. + */ +void +warnlib_whatever_do_boo (WarnLibWhatever *self, int x, gpointer y) +{ + WARNLIB_WHATEVER_GET_IFACE(self)->do_boo (self, x, y); +} -- cgit v1.2.1