diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-11-17 22:22:03 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2022-02-24 19:59:24 +0100 |
commit | da4ff03c5ca427cf7cc4574f52f5190dc1b0dfb9 (patch) | |
tree | 184fd1c8e207f2ee137b2d9bded274a855e4bb37 /tests/asynchronous/catch-error-scope.c-expected | |
parent | a1530007a7c1b829cdf5876f4090d30b502c1bc3 (diff) | |
download | vala-da4ff03c5ca427cf7cc4574f52f5190dc1b0dfb9.tar.gz |
codegen: Emit GType definition for error domains
Fixes https://gitlab.gnome.org/GNOME/vala/issues/699
Diffstat (limited to 'tests/asynchronous/catch-error-scope.c-expected')
-rw-r--r-- | tests/asynchronous/catch-error-scope.c-expected | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/asynchronous/catch-error-scope.c-expected b/tests/asynchronous/catch-error-scope.c-expected index 289b79029..4f15904f8 100644 --- a/tests/asynchronous/catch-error-scope.c-expected +++ b/tests/asynchronous/catch-error-scope.c-expected @@ -2,10 +2,10 @@ * generated from asynchronous_catch_error_scope.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #include <gio/gio.h> #include <stdlib.h> #include <string.h> -#include <glib-object.h> #if !defined(VALA_EXTERN) #if defined(_MSC_VER) @@ -17,6 +17,7 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) typedef struct _FooData FooData; typedef struct _Block1Data Block1Data; @@ -30,6 +31,7 @@ typedef enum { FOO_ERROR_FAIL } FooError; #define FOO_ERROR foo_error_quark () + struct _FooData { int _state_; GObject* _source_object_; @@ -50,6 +52,7 @@ struct _Block1Data { }; VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; static void foo_data_free (gpointer _data); VALA_EXTERN void foo (GAsyncReadyCallback _callback_, gpointer _user_data_); @@ -71,6 +74,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_FAIL, "FOO_ERROR_FAIL", "fail"}, {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; +} + static void foo_data_free (gpointer _data) { |