summaryrefslogtreecommitdiff
path: root/tests/objects
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2018-11-17 22:22:03 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2022-02-24 19:59:24 +0100
commitda4ff03c5ca427cf7cc4574f52f5190dc1b0dfb9 (patch)
tree184fd1c8e207f2ee137b2d9bded274a855e4bb37 /tests/objects
parenta1530007a7c1b829cdf5876f4090d30b502c1bc3 (diff)
downloadvala-da4ff03c5ca427cf7cc4574f52f5190dc1b0dfb9.tar.gz
codegen: Emit GType definition for error domains
Fixes https://gitlab.gnome.org/GNOME/vala/issues/699
Diffstat (limited to 'tests/objects')
-rw-r--r--tests/objects/signals-error-marshal.c-expected25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/objects/signals-error-marshal.c-expected b/tests/objects/signals-error-marshal.c-expected
index 35e69052c..110f63cf4 100644
--- a/tests/objects/signals-error-marshal.c-expected
+++ b/tests/objects/signals-error-marshal.c-expected
@@ -15,6 +15,8 @@
#endif
#endif
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
#define TYPE_BAR (bar_get_type ())
typedef struct _Bar Bar;
@@ -50,6 +52,7 @@ typedef enum {
FOO_ERROR_BAD
} FooError;
#define FOO_ERROR foo_error_quark ()
+
struct _Bar {
gint i;
};
@@ -66,6 +69,7 @@ struct _FooClass {
static gpointer foo_parent_class = NULL;
VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Bar* bar_dup (const Bar* self);
VALA_EXTERN void bar_free (Bar* self);
@@ -101,6 +105,27 @@ foo_error_quark (void)
return g_quark_from_static_string ("foo-error-quark");
}
+static GType
+foo_error_get_type_once (void)
+{
+ static const GEnumValue values[] = {{FOO_ERROR_BAD, "FOO_ERROR_BAD", "bad"}, {0, NULL, NULL}};
+ GType foo_error_type_id;
+ foo_error_type_id = g_enum_register_static ("FooError", values);
+ return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+ static volatile gsize foo_error_type_id__once = 0;
+ if (g_once_init_enter (&foo_error_type_id__once)) {
+ GType foo_error_type_id;
+ foo_error_type_id = foo_error_get_type_once ();
+ g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+ }
+ return foo_error_type_id__once;
+}
+
Bar*
bar_dup (const Bar* self)
{