diff options
Diffstat (limited to 'tests')
37 files changed, 802 insertions, 8 deletions
diff --git a/tests/asynchronous/bug793158.c-expected b/tests/asynchronous/bug793158.c-expected index 218575392..8ad749607 100644 --- a/tests/asynchronous/bug793158.c-expected +++ b/tests/asynchronous/bug793158.c-expected @@ -15,6 +15,8 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) + #define TYPE_FOO (foo_get_type ()) #define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo)) #define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass)) @@ -38,6 +40,7 @@ typedef enum { FOO_ERROR_BAR } FooError; #define FOO_ERROR foo_error_quark () + struct _Foo { GObject parent_instance; FooPrivate * priv; @@ -61,6 +64,7 @@ VALA_EXTERN GMainLoop* loop; GMainLoop* loop = NULL; VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref) static void foo_bar_data_free (gpointer _data); @@ -87,6 +91,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_BAR, "FOO_ERROR_BAR", "bar"}, {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_bar_data_free (gpointer _data) { 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) { diff --git a/tests/asynchronous/catch-in-finally.c-expected b/tests/asynchronous/catch-in-finally.c-expected index 9779a393a..ca37912bb 100644 --- a/tests/asynchronous/catch-in-finally.c-expected +++ b/tests/asynchronous/catch-in-finally.c-expected @@ -2,8 +2,8 @@ * generated from asynchronous_catch_in_finally.vala, do not modify */ #include <glib.h> -#include <gio/gio.h> #include <glib-object.h> +#include <gio/gio.h> #include <stdlib.h> #include <string.h> @@ -17,6 +17,7 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) typedef struct _FailData FailData; typedef struct _MayFailData MayFailData; typedef struct _FooData FooData; @@ -33,6 +34,7 @@ typedef enum { FOO_ERROR_FAIL } FooError; #define FOO_ERROR foo_error_quark () + struct _FailData { int _state_; GObject* _source_object_; @@ -78,6 +80,7 @@ VALA_EXTERN GMainLoop* loop; GMainLoop* loop = NULL; VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; static void fail_data_free (gpointer _data); VALA_EXTERN void fail (GAsyncReadyCallback _callback_, gpointer _user_data_); @@ -131,6 +134,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 fail_data_free (gpointer _data) { diff --git a/tests/asynchronous/out-parameter-free-on-error.c-expected b/tests/asynchronous/out-parameter-free-on-error.c-expected index f6468651b..a4673d0a8 100644 --- a/tests/asynchronous/out-parameter-free-on-error.c-expected +++ b/tests/asynchronous/out-parameter-free-on-error.c-expected @@ -15,6 +15,8 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) + #define TYPE_MANAM (manam_get_type ()) #define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam)) #define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass)) @@ -43,6 +45,7 @@ typedef enum { FOO_ERROR_FAIL } FooError; #define FOO_ERROR foo_error_quark () + struct _Manam { GObject parent_instance; ManamPrivate * priv; @@ -82,6 +85,7 @@ VALA_EXTERN GMainLoop* loop; GMainLoop* loop = NULL; VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref) VALA_EXTERN Manam* manam_new (void); @@ -111,6 +115,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; +} + Manam* manam_construct (GType object_type) { diff --git a/tests/basic-types/default-gtype.c-expected b/tests/basic-types/default-gtype.c-expected index 4d1268f2e..995f00be5 100644 --- a/tests/basic-types/default-gtype.c-expected +++ b/tests/basic-types/default-gtype.c-expected @@ -35,6 +35,8 @@ typedef enum { #define TYPE_FOO_FLAG (foo_flag_get_type ()) +#define TYPE_FOO_ERROR (foo_error_get_type ()) + #define TYPE_FOO_STRUCT (foo_struct_get_type ()) typedef struct _FooStruct FooStruct; typedef enum { @@ -60,6 +62,7 @@ typedef enum { FOO_ERROR_FAIL } FooError; #define FOO_ERROR foo_error_quark () + struct _FooStruct { gint i; }; @@ -77,6 +80,7 @@ static GType ifoo_get_type_once (void); VALA_EXTERN GType foo_enum_get_type (void) G_GNUC_CONST ; VALA_EXTERN GType foo_flag_get_type (void) G_GNUC_CONST ; VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN GType foo_struct_get_type (void) G_GNUC_CONST ; VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self); VALA_EXTERN void foo_struct_free (FooStruct* self); @@ -159,6 +163,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; +} + FooStruct* foo_struct_dup (const FooStruct* self) { diff --git a/tests/control-flow/bug764440.c-expected b/tests/control-flow/bug764440.c-expected index b49776996..e5e3b5b8a 100644 --- a/tests/control-flow/bug764440.c-expected +++ b/tests/control-flow/bug764440.c-expected @@ -2,6 +2,7 @@ * generated from control_flow_bug764440.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #include <stdlib.h> #include <string.h> @@ -15,12 +16,15 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) + typedef enum { FOO_ERROR_BAR } FooError; #define FOO_ERROR foo_error_quark () VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN const gchar* get_bar (GError** error); static void _vala_main (void); @@ -30,6 +34,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_BAR, "FOO_ERROR_BAR", "bar"}, {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; +} + const gchar* get_bar (GError** error) { diff --git a/tests/control-flow/lock-if-throw.c-expected b/tests/control-flow/lock-if-throw.c-expected index ee259cffc..7912c9826 100644 --- a/tests/control-flow/lock-if-throw.c-expected +++ b/tests/control-flow/lock-if-throw.c-expected @@ -15,6 +15,8 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) + #define TYPE_FOO (foo_get_type ()) #define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo)) #define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass)) @@ -32,6 +34,7 @@ typedef enum { FOO_ERROR_FAIL } FooError; #define FOO_ERROR foo_error_quark () + struct _Foo { GTypeInstance parent_instance; volatile int ref_count; @@ -56,6 +59,7 @@ static gint Foo_private_offset; static gpointer foo_parent_class = NULL; VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN gpointer foo_ref (gpointer instance); VALA_EXTERN void foo_unref (gpointer instance); VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name, @@ -84,6 +88,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 inline gpointer foo_get_instance_private (Foo* self) { diff --git a/tests/dbus/errors_client.c-expected b/tests/dbus/errors_client.c-expected index 908ddc35c..8f1209285 100644 --- a/tests/dbus/errors_client.c-expected +++ b/tests/dbus/errors_client.c-expected @@ -17,6 +17,8 @@ #endif #endif +#define TYPE_TEST_ERROR (test_error_get_type ()) + #define TYPE_TEST (test_get_type ()) #define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test)) #define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST)) @@ -42,6 +44,7 @@ typedef enum { TEST_ERROR_WORSE } TestError; #define TEST_ERROR test_error_quark () + struct _TestIface { GTypeInterface parent_iface; void (*test_void) (Test* self, GError** error); @@ -52,6 +55,7 @@ struct _TestIface { }; VALA_EXTERN GQuark test_error_quark (void); +GType test_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ; VALA_EXTERN guint test_register_object (void* object, GDBusConnection* connection, diff --git a/tests/dbus/errors_server.c-expected b/tests/dbus/errors_server.c-expected index 3bcdc0c48..8406a6eab 100644 --- a/tests/dbus/errors_server.c-expected +++ b/tests/dbus/errors_server.c-expected @@ -17,6 +17,8 @@ #endif #endif +#define TYPE_TEST_ERROR (test_error_get_type ()) + #define TYPE_TEST (test_get_type ()) #define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test)) #define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass)) @@ -47,6 +49,7 @@ typedef enum { TEST_ERROR_WORSE } TestError; #define TEST_ERROR test_error_quark () + struct _Test { GObject parent_instance; TestPrivate * priv; @@ -61,6 +64,7 @@ VALA_EXTERN GMainLoop* main_loop; GMainLoop* main_loop = NULL; VALA_EXTERN GQuark test_error_quark (void); +GType test_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref) VALA_EXTERN guint test_register_object (void* object, diff --git a/tests/delegates/error-pos.c-expected b/tests/delegates/error-pos.c-expected index 25e92dc3b..1aa5874f1 100644 --- a/tests/delegates/error-pos.c-expected +++ b/tests/delegates/error-pos.c-expected @@ -2,9 +2,9 @@ * generated from delegates_error_pos.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #include <stdlib.h> #include <string.h> -#include <glib-object.h> #include <gobject/gvaluecollector.h> #if !defined(VALA_EXTERN) @@ -17,6 +17,7 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) typedef gchar* (*FooFunc) (gint i, GError** error, gpointer user_data); #define TYPE_BAR (bar_get_type ()) @@ -42,6 +43,7 @@ typedef enum { FOO_ERROR_BAR } FooError; #define FOO_ERROR foo_error_quark () + struct _Bar { GTypeInstance parent_instance; volatile int ref_count; @@ -60,6 +62,7 @@ struct _ParamSpecBar { static gpointer bar_parent_class = NULL; VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN gpointer bar_ref (gpointer instance); VALA_EXTERN void bar_unref (gpointer instance); VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name, @@ -97,6 +100,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_BAR, "FOO_ERROR_BAR", "bar"}, {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; +} + gchar* bar_foo (Bar* self, GError** error, diff --git a/tests/delegates/params-array-with-throws.c-expected b/tests/delegates/params-array-with-throws.c-expected index a00603906..68b33b8d7 100644 --- a/tests/delegates/params-array-with-throws.c-expected +++ b/tests/delegates/params-array-with-throws.c-expected @@ -2,6 +2,7 @@ * generated from delegates_params_array_with_throws.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #include <stdlib.h> #include <string.h> @@ -15,6 +16,7 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) typedef void (*FooFunc) (GError** error, const gchar* _first_array, ...); #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } @@ -28,6 +30,7 @@ typedef enum { #define FOO_ERROR foo_error_quark () VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN void foo (GError** error, gchar* _first_array, ...); @@ -50,6 +53,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"}, {FOO_ERROR_WORSE, "FOO_ERROR_WORSE", "worse"}, {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 _vala_array_add1 (const gchar** * array, gint* length, diff --git a/tests/delegates/variadic.c-expected b/tests/delegates/variadic.c-expected index ae5d477d6..176dd015e 100644 --- a/tests/delegates/variadic.c-expected +++ b/tests/delegates/variadic.c-expected @@ -4,6 +4,7 @@ #include <stdlib.h> #include <string.h> #include <glib.h> +#include <glib-object.h> #include <stdarg.h> #if !defined(VALA_EXTERN) @@ -18,6 +19,8 @@ typedef void (*FooFunc) (const gchar* first, ...); typedef void (*BarFunc) (const gchar* first, ...); + +#define TYPE_BAZ_ERROR (baz_error_get_type ()) typedef void (*BazFunc) (const gchar* first, GError** error, ...); #define _g_free0(var) (var = (g_free (var), NULL)) #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); @@ -32,6 +35,7 @@ typedef enum { #define BAZ_ERROR baz_error_quark () VALA_EXTERN GQuark baz_error_quark (void); +GType baz_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN void foo (const gchar* first, ...); VALA_EXTERN void baz (const gchar* first, @@ -49,6 +53,27 @@ baz_error_quark (void) return g_quark_from_static_string ("baz-error-quark"); } +static GType +baz_error_get_type_once (void) +{ + static const GEnumValue values[] = {{BAZ_ERROR_BAD, "BAZ_ERROR_BAD", "bad"}, {BAZ_ERROR_WORSE, "BAZ_ERROR_WORSE", "worse"}, {0, NULL, NULL}}; + GType baz_error_type_id; + baz_error_type_id = g_enum_register_static ("BazError", values); + return baz_error_type_id; +} + +GType +baz_error_get_type (void) +{ + static volatile gsize baz_error_type_id__once = 0; + if (g_once_init_enter (&baz_error_type_id__once)) { + GType baz_error_type_id; + baz_error_type_id = baz_error_get_type_once (); + g_once_init_leave (&baz_error_type_id__once, baz_error_type_id); + } + return baz_error_type_id__once; +} + void foo (const gchar* first, ...) diff --git a/tests/errors/bug567181.c-expected b/tests/errors/bug567181.c-expected index db3a661b0..6d811473f 100644 --- a/tests/errors/bug567181.c-expected +++ b/tests/errors/bug567181.c-expected @@ -23,6 +23,8 @@ typedef struct _Foo Foo; typedef struct _FooClass FooClass; + +#define TYPE_ERROR (error_get_type ()) typedef struct _FooPrivate FooPrivate; enum { FOO_0_PROPERTY, @@ -39,6 +41,7 @@ typedef enum { ERROR_FOOBAR } Error; #define ERROR error_quark () + struct _Foo { GObject parent_instance; FooPrivate * priv; @@ -55,6 +58,7 @@ static gpointer foo_parent_class = NULL; VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref) VALA_EXTERN GQuark error_quark (void); +GType error_get_type (void) G_GNUC_CONST ; VALA_EXTERN Foo* foo_new (GError** error); VALA_EXTERN Foo* foo_construct (GType object_type, GError** error); @@ -69,6 +73,27 @@ error_quark (void) return g_quark_from_static_string ("error-quark"); } +static GType +error_get_type_once (void) +{ + static const GEnumValue values[] = {{ERROR_FOOBAR, "ERROR_FOOBAR", "foobar"}, {0, NULL, NULL}}; + GType error_type_id; + error_type_id = g_enum_register_static ("Error", values); + return error_type_id; +} + +GType +error_get_type (void) +{ + static volatile gsize error_type_id__once = 0; + if (g_once_init_enter (&error_type_id__once)) { + GType error_type_id; + error_type_id = error_get_type_once (); + g_once_init_leave (&error_type_id__once, error_type_id); + } + return error_type_id__once; +} + static gpointer _g_object_ref0 (gpointer self) { diff --git a/tests/errors/bug579101.c-expected b/tests/errors/bug579101.c-expected index a3b312bab..0fac3fdd2 100644 --- a/tests/errors/bug579101.c-expected +++ b/tests/errors/bug579101.c-expected @@ -2,6 +2,7 @@ * generated from errors_bug579101.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #include <stdlib.h> #include <string.h> @@ -15,6 +16,7 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) #define _g_free0(var) (var = (g_free (var), NULL)) #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } @@ -27,6 +29,7 @@ typedef enum { #define FOO_ERROR foo_error_quark () VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN void do_foo (gint* i); VALA_EXTERN gchar* do_bar (gint* i); VALA_EXTERN gchar* do_manam (gint* i); @@ -38,6 +41,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; +} + void do_foo (gint* i) { diff --git a/tests/errors/bug623049.c-expected b/tests/errors/bug623049.c-expected index 0dc36ff53..403ab58af 100644 --- a/tests/errors/bug623049.c-expected +++ b/tests/errors/bug623049.c-expected @@ -14,6 +14,8 @@ #endif #endif +#define TYPE_FOO (foo_get_type ()) + #define TYPE_CLS_A (cls_a_get_type ()) #define CLS_A(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLS_A, ClsA)) #define CLS_A_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLS_A, ClsAClass)) @@ -51,6 +53,7 @@ typedef enum { FOO_BAR } Foo; #define FOO foo_quark () + struct _ClsA { GObject parent_instance; ClsAPrivate * priv; @@ -73,6 +76,7 @@ static gpointer cls_a_parent_class = NULL; static gpointer cls_b_parent_class = NULL; VALA_EXTERN GQuark foo_quark (void); +GType foo_get_type (void) G_GNUC_CONST ; VALA_EXTERN GType cls_a_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClsA, g_object_unref) VALA_EXTERN ClsA* cls_a_new (GError** error); @@ -93,6 +97,27 @@ foo_quark (void) return g_quark_from_static_string ("foo-quark"); } +static GType +foo_get_type_once (void) +{ + static const GEnumValue values[] = {{FOO_BAR, "FOO_BAR", "bar"}, {0, NULL, NULL}}; + GType foo_type_id; + foo_type_id = g_enum_register_static ("Foo", values); + return foo_type_id; +} + +GType +foo_get_type (void) +{ + static volatile gsize foo_type_id__once = 0; + if (g_once_init_enter (&foo_type_id__once)) { + GType foo_type_id; + foo_type_id = foo_get_type_once (); + g_once_init_leave (&foo_type_id__once, foo_type_id); + } + return foo_type_id__once; +} + ClsA* cls_a_construct (GType object_type, GError** error) diff --git a/tests/errors/bug778224.c-expected b/tests/errors/bug778224.c-expected index b62036448..1ebb8379a 100644 --- a/tests/errors/bug778224.c-expected +++ b/tests/errors/bug778224.c-expected @@ -2,6 +2,7 @@ * generated from errors_bug778224.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #if !defined(VALA_EXTERN) #if defined(_MSC_VER) @@ -13,12 +14,14 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) typedef struct _Foo Foo; typedef enum { FOO_ERROR_BAR } FooError; #define FOO_ERROR foo_error_quark () + struct _Foo { gint i; }; @@ -27,6 +30,7 @@ VALA_EXTERN gboolean true; gboolean true = TRUE; VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN Foo foo (GError** error); static void _vala_main (void); @@ -36,6 +40,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_BAR, "FOO_ERROR_BAR", "bar"}, {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; +} + Foo foo (GError** error) { diff --git a/tests/errors/catch-error-code.c-expected b/tests/errors/catch-error-code.c-expected index e5132b736..7fcd6f486 100644 --- a/tests/errors/catch-error-code.c-expected +++ b/tests/errors/catch-error-code.c-expected @@ -2,6 +2,7 @@ * generated from errors_catch_error_code.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #if !defined(VALA_EXTERN) #if defined(_MSC_VER) @@ -13,6 +14,8 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) + typedef enum { FOO_ERROR_BAR, FOO_ERROR_FOO @@ -20,6 +23,7 @@ typedef enum { #define FOO_ERROR foo_error_quark () VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; static void _vala_main (void); GQuark @@ -28,6 +32,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_BAR, "FOO_ERROR_BAR", "bar"}, {FOO_ERROR_FOO, "FOO_ERROR_FOO", "foo"}, {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 _vala_main (void) { diff --git a/tests/errors/catch-in-finally.c-expected b/tests/errors/catch-in-finally.c-expected index cecb359e8..fadaeed6d 100644 --- a/tests/errors/catch-in-finally.c-expected +++ b/tests/errors/catch-in-finally.c-expected @@ -2,6 +2,7 @@ * generated from errors_catch_in_finally.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #include <stdlib.h> #include <string.h> @@ -15,6 +16,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))) #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } @@ -27,6 +29,7 @@ typedef enum { #define FOO_ERROR foo_error_quark () VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN void fail (GError** error); VALA_EXTERN void may_fail (GError** error); VALA_EXTERN void foo (GError** error); @@ -39,6 +42,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; +} + void fail (GError** error) { diff --git a/tests/errors/default-gtype.c-expected b/tests/errors/default-gtype.c-expected index a65b92b1f..d38b8aaf2 100644 --- a/tests/errors/default-gtype.c-expected +++ b/tests/errors/default-gtype.c-expected @@ -14,6 +14,7 @@ #endif #endif +#define TYPE_FOO (foo_get_type ()) #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } #define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } @@ -25,6 +26,7 @@ typedef enum { #define FOO foo_quark () VALA_EXTERN GQuark foo_quark (void); +GType foo_get_type (void) G_GNUC_CONST ; static void _vala_main (void); GQuark @@ -33,6 +35,27 @@ foo_quark (void) return g_quark_from_static_string ("foo-quark"); } +static GType +foo_get_type_once (void) +{ + static const GEnumValue values[] = {{FOO_MANAM, "FOO_MANAM", "manam"}, {0, NULL, NULL}}; + GType foo_type_id; + foo_type_id = g_enum_register_static ("Foo", values); + return foo_type_id; +} + +GType +foo_get_type (void) +{ + static volatile gsize foo_type_id__once = 0; + if (g_once_init_enter (&foo_type_id__once)) { + GType foo_type_id; + foo_type_id = foo_get_type_once (); + g_once_init_leave (&foo_type_id__once, foo_type_id); + } + return foo_type_id__once; +} + static void _vala_main (void) { diff --git a/tests/errors/delegate-throws-error-code.c-expected b/tests/errors/delegate-throws-error-code.c-expected index 5ccd6e4de..fadfb48f8 100644 --- a/tests/errors/delegate-throws-error-code.c-expected +++ b/tests/errors/delegate-throws-error-code.c-expected @@ -2,6 +2,7 @@ * generated from errors_delegate_throws_error_code.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #if !defined(VALA_EXTERN) #if defined(_MSC_VER) @@ -13,6 +14,7 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) typedef void (*FooFunc) (gpointer user_data, GError** error); typedef enum { @@ -22,6 +24,7 @@ typedef enum { #define FOO_ERROR foo_error_quark () VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; static void _vala_main (void); static void __lambda4_ (GError** error); static void ___lambda4__foo_func (gpointer self, @@ -33,6 +36,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_FOO, "FOO_ERROR_FOO", "foo"}, {FOO_ERROR_BAR, "FOO_ERROR_BAR", "bar"}, {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 __lambda4_ (GError** error) { diff --git a/tests/errors/errorcode.c-expected b/tests/errors/errorcode.c-expected index 45c7db847..1e25de2fb 100644 --- a/tests/errors/errorcode.c-expected +++ b/tests/errors/errorcode.c-expected @@ -2,6 +2,7 @@ * generated from errors_errorcode.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #include <gio/gio.h> #if !defined(VALA_EXTERN) @@ -14,6 +15,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))) #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } @@ -28,6 +30,7 @@ typedef enum { #define FOO_ERROR foo_error_quark () VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN void bar (gint code); static void _vala_main (void); @@ -37,6 +40,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_REALLY_BAD, "FOO_ERROR_REALLY_BAD", "really-bad"}, {FOO_ERROR_NOT_SO_GOOD, "FOO_ERROR_NOT_SO_GOOD", "not-so-good"}, {FOO_ERROR_EVEN_WORSE, "FOO_ERROR_EVEN_WORSE", "even-worse"}, {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; +} + void bar (gint code) { diff --git a/tests/errors/errordomain-static-method.c-expected b/tests/errors/errordomain-static-method.c-expected index f369c2d79..070ee2e7c 100644 --- a/tests/errors/errordomain-static-method.c-expected +++ b/tests/errors/errordomain-static-method.c-expected @@ -2,6 +2,7 @@ * generated from errors_errordomain_static_method.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #include <stdlib.h> #include <string.h> @@ -15,6 +16,7 @@ #endif #endif +#define TYPE_FOO (foo_get_type ()) #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } @@ -27,6 +29,7 @@ typedef enum { #define FOO foo_quark () VALA_EXTERN GQuark foo_quark (void); +GType foo_get_type (void) G_GNUC_CONST ; VALA_EXTERN GError* foo_from_string (const gchar* _error_); static void _vala_main (void); @@ -48,6 +51,27 @@ foo_quark (void) return g_quark_from_static_string ("foo-quark"); } +static GType +foo_get_type_once (void) +{ + static const GEnumValue values[] = {{FOO_BAD, "FOO_BAD", "bad"}, {0, NULL, NULL}}; + GType foo_type_id; + foo_type_id = g_enum_register_static ("Foo", values); + return foo_type_id; +} + +GType +foo_get_type (void) +{ + static volatile gsize foo_type_id__once = 0; + if (g_once_init_enter (&foo_type_id__once)) { + GType foo_type_id; + foo_type_id = foo_get_type_once (); + g_once_init_leave (&foo_type_id__once, foo_type_id); + } + return foo_type_id__once; +} + static void _vala_main (void) { diff --git a/tests/errors/errordomain.c-expected b/tests/errors/errordomain.c-expected index 3ef447771..51d8a1f06 100644 --- a/tests/errors/errordomain.c-expected +++ b/tests/errors/errordomain.c-expected @@ -2,6 +2,7 @@ * generated from errors_errordomain.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #if !defined(VALA_EXTERN) #if defined(_MSC_VER) @@ -13,12 +14,15 @@ #endif #endif +#define TYPE_FOO (foo_get_type ()) + typedef enum { FOO_BAD } Foo; #define FOO foo_quark () VALA_EXTERN GQuark foo_quark (void); +GType foo_get_type (void) G_GNUC_CONST ; static void _vala_main (void); GQuark @@ -27,6 +31,27 @@ foo_quark (void) return g_quark_from_static_string ("foo-quark"); } +static GType +foo_get_type_once (void) +{ + static const GEnumValue values[] = {{FOO_BAD, "FOO_BAD", "bad"}, {0, NULL, NULL}}; + GType foo_type_id; + foo_type_id = g_enum_register_static ("Foo", values); + return foo_type_id; +} + +GType +foo_get_type (void) +{ + static volatile gsize foo_type_id__once = 0; + if (g_once_init_enter (&foo_type_id__once)) { + GType foo_type_id; + foo_type_id = foo_get_type_once (); + g_once_init_leave (&foo_type_id__once, foo_type_id); + } + return foo_type_id__once; +} + static void _vala_main (void) { diff --git a/tests/errors/errors.c-expected b/tests/errors/errors.c-expected index 6294d88ea..25c46745a 100644 --- a/tests/errors/errors.c-expected +++ b/tests/errors/errors.c-expected @@ -17,6 +17,8 @@ #endif #endif +#define TYPE_BAR_ERROR (bar_error_get_type ()) + #define TYPE_BAR (bar_get_type ()) #define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar)) #define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass)) @@ -40,6 +42,7 @@ typedef enum { BAR_ERROR_BAR } BarError; #define BAR_ERROR bar_error_quark () + struct _Bar { GObject parent_instance; BarPrivate * priv; @@ -52,6 +55,7 @@ struct _BarClass { static gpointer bar_parent_class = NULL; VALA_EXTERN GQuark bar_error_quark (void); +GType bar_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref) VALA_EXTERN void bar_foo (Bar* self, @@ -76,6 +80,27 @@ bar_error_quark (void) return g_quark_from_static_string ("bar-error-quark"); } +static GType +bar_error_get_type_once (void) +{ + static const GEnumValue values[] = {{BAR_ERROR_FOO, "BAR_ERROR_FOO", "foo"}, {BAR_ERROR_BAR, "BAR_ERROR_BAR", "bar"}, {0, NULL, NULL}}; + GType bar_error_type_id; + bar_error_type_id = g_enum_register_static ("BarError", values); + return bar_error_type_id; +} + +GType +bar_error_get_type (void) +{ + static volatile gsize bar_error_type_id__once = 0; + if (g_once_init_enter (&bar_error_type_id__once)) { + GType bar_error_type_id; + bar_error_type_id = bar_error_get_type_once (); + g_once_init_leave (&bar_error_type_id__once, bar_error_type_id); + } + return bar_error_type_id__once; +} + void bar_foo (Bar* self, GError** error) diff --git a/tests/errors/loops.c-expected b/tests/errors/loops.c-expected index b85da1cf9..e42138013 100644 --- a/tests/errors/loops.c-expected +++ b/tests/errors/loops.c-expected @@ -2,6 +2,7 @@ * generated from errors_loops.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #include <stdlib.h> #include <string.h> @@ -15,6 +16,7 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) #define _g_free0(var) (var = (g_free (var), NULL)) typedef enum { @@ -23,6 +25,7 @@ typedef enum { #define FOO_ERROR foo_error_quark () VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN gchar** get_array (gint* result_length1, GError** error); VALA_EXTERN gboolean get_bool (GError** error); @@ -45,6 +48,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; +} + gchar** get_array (gint* result_length1, GError** error) diff --git a/tests/errors/method-throws-error-code.c-expected b/tests/errors/method-throws-error-code.c-expected index 1fa8f2be4..dceef5dfb 100644 --- a/tests/errors/method-throws-error-code.c-expected +++ b/tests/errors/method-throws-error-code.c-expected @@ -2,6 +2,7 @@ * generated from errors_method_throws_error_code.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #if !defined(VALA_EXTERN) #if defined(_MSC_VER) @@ -13,6 +14,8 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) + typedef enum { FOO_ERROR_FOO, FOO_ERROR_BAR @@ -20,6 +23,7 @@ typedef enum { #define FOO_ERROR foo_error_quark () VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN void foo (GError** error); static void _vala_main (void); @@ -29,6 +33,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_FOO, "FOO_ERROR_FOO", "foo"}, {FOO_ERROR_BAR, "FOO_ERROR_BAR", "bar"}, {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; +} + void foo (GError** error) { diff --git a/tests/errors/unhandled.c-expected b/tests/errors/unhandled.c-expected index 6de43da7c..deb2f7f3f 100644 --- a/tests/errors/unhandled.c-expected +++ b/tests/errors/unhandled.c-expected @@ -16,6 +16,8 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) + #define TYPE_FOO (foo_get_type ()) #define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo)) #define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass)) @@ -37,6 +39,7 @@ typedef enum { FOO_ERROR_FAIL } FooError; #define FOO_ERROR foo_error_quark () + struct _Foo { GObject parent_instance; FooPrivate * priv; @@ -49,6 +52,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 foo_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref) VALA_EXTERN Foo* foo_new (void); @@ -80,6 +84,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; +} + Foo* foo_construct (GType object_type) { diff --git a/tests/genie/exception.c-expected b/tests/genie/exception.c-expected index 976e2c579..d75111d7f 100644 --- a/tests/genie/exception.c-expected +++ b/tests/genie/exception.c-expected @@ -4,6 +4,7 @@ #include <stdlib.h> #include <string.h> #include <glib.h> +#include <glib-object.h> #if !defined(VALA_EXTERN) #if defined(_MSC_VER) @@ -15,6 +16,7 @@ #endif #endif +#define TYPE_TEST_ERROR (test_error_get_type ()) #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) typedef enum { @@ -27,6 +29,7 @@ typedef enum { static void _vala_main (gchar** args, gint args_length1); VALA_EXTERN GQuark test_error_quark (void); +GType test_error_get_type (void) G_GNUC_CONST ; static void _vala_main (gchar** args, @@ -53,3 +56,24 @@ test_error_quark (void) return g_quark_from_static_string ("test-error-quark"); } +static GType +test_error_get_type_once (void) +{ + static const GEnumValue values[] = {{TEST_ERROR_FAIL, "TEST_ERROR_FAIL", "fail"}, {TEST_ERROR_BAD, "TEST_ERROR_BAD", "bad"}, {TEST_ERROR_WORSE, "TEST_ERROR_WORSE", "worse"}, {0, NULL, NULL}}; + GType test_error_type_id; + test_error_type_id = g_enum_register_static ("TestError", values); + return test_error_type_id; +} + +GType +test_error_get_type (void) +{ + static volatile gsize test_error_type_id__once = 0; + if (g_once_init_enter (&test_error_type_id__once)) { + GType test_error_type_id; + test_error_type_id = test_error_get_type_once (); + g_once_init_leave (&test_error_type_id__once, test_error_type_id); + } + return test_error_type_id__once; +} + diff --git a/tests/girwriter/GirTest-1.0.gir-expected b/tests/girwriter/GirTest-1.0.gir-expected index 72b408d5a..c308e62a1 100644 --- a/tests/girwriter/GirTest-1.0.gir-expected +++ b/tests/girwriter/GirTest-1.0.gir-expected @@ -37,12 +37,17 @@ <bitfield name="RenamedBitfield" c:type="GirTestNamedBitfield" glib:type-name="GirTestNamedBitfield" glib:get-type="gir_test_named_bitfield_get_type"> <member name="value1" c:identifier="GIR_TEST_NAMED_BITFIELD_VALUE1" value="1"/> </bitfield> - <enumeration name="ErrorTest" c:type="GirTestErrorTest" glib:error-domain="gir-test-error-test-quark"> + <enumeration name="ErrorTest" c:type="GirTestErrorTest" glib:type-name="GirTestErrorTest" glib:get-type="gir_test_error_test_get_type" glib:error-domain="gir-test-error-test-quark"> <member name="failed" c:identifier="GIR_TEST_ERROR_TEST_FAILED" value="0"/> <member name="smelly" c:identifier="GIR_TEST_ERROR_TEST_SMELLY" value="1"/> <member name="fishy" c:identifier="GIR_TEST_ERROR_TEST_FISHY" value="23"/> </enumeration> - <enumeration name="RenamedError" c:type="GirTestNamedError" glib:error-domain="gir-test-named-error-quark"> + <enumeration name="PlainErrorTest" c:type="GirTestPlainErrorTest" glib:error-domain="gir-test-plain-error-test-quark"> + <member name="failed" c:identifier="GIR_TEST_PLAIN_ERROR_TEST_FAILED" value="0"/> + <member name="smelly" c:identifier="GIR_TEST_PLAIN_ERROR_TEST_SMELLY" value="1"/> + <member name="fishy" c:identifier="GIR_TEST_PLAIN_ERROR_TEST_FISHY" value="23"/> + </enumeration> + <enumeration name="RenamedError" c:type="GirTestNamedError" glib:type-name="GirTestNamedError" glib:get-type="gir_test_named_error_get_type" glib:error-domain="gir-test-named-error-quark"> <member name="failed" c:identifier="GIR_TEST_NAMED_ERROR_FAILED" value="0"/> </enumeration> <class name="TypeTest" c:type="GirTestTypeTest" c:symbol-prefix="typetest" glib:type-name="GirTestTypeTest" glib:get-type="gir_test_typetest_get_type" glib:type-struct="TypeTestClass" glib:fundamental="1" glib:ref-func="gir_test_typetest_ref" glib:unref-func="gir_test_typetest_unref" glib:set-value-func="gir_test_value_set_typetest" glib:get-value-func="gir_test_value_get_typetest"> diff --git a/tests/girwriter/girtest.vala b/tests/girwriter/girtest.vala index 82d146ecc..b2b107385 100644 --- a/tests/girwriter/girtest.vala +++ b/tests/girwriter/girtest.vala @@ -111,6 +111,13 @@ namespace GirTest { FISHY = 23 } + [CCode (has_type_id = false)] + public errordomain PlainErrorTest { + FAILED, + SMELLY, + FISHY = 23 + } + [GIR (name = "RenamedError")] public errordomain NamedError { FAILED diff --git a/tests/girwriter/girtest.vapi-expected b/tests/girwriter/girtest.vapi-expected index 0350bd8e6..578d588dc 100644 --- a/tests/girwriter/girtest.vapi-expected +++ b/tests/girwriter/girtest.vapi-expected @@ -249,6 +249,12 @@ namespace GirTest { public errordomain NamedError { FAILED } + [CCode (cheader_filename = "girtest.h", has_type_id = false)] + public errordomain PlainErrorTest { + FAILED, + SMELLY, + FISHY + } [CCode (cheader_filename = "girtest.h")] public delegate bool DelegateErrorTest () throws GirTest.ErrorTest; [CCode (cheader_filename = "girtest.h")] diff --git a/tests/girwriter/girtest.vapigen-expected b/tests/girwriter/girtest.vapigen-expected index ad33e3c96..d559fbea0 100644 --- a/tests/girwriter/girtest.vapigen-expected +++ b/tests/girwriter/girtest.vapigen-expected @@ -251,13 +251,19 @@ namespace GirTest { public enum RenamedEnumeration { VALUE1 } - [CCode (cheader_filename = "girtest.h", cprefix = "GIR_TEST_ERROR_TEST_")] + [CCode (cheader_filename = "girtest.h", cprefix = "GIR_TEST_ERROR_TEST_", type_id = "gir_test_error_test_get_type ()")] public errordomain ErrorTest { FAILED, SMELLY, FISHY } - [CCode (cheader_filename = "girtest.h", cname = "GirTestNamedError", cprefix = "GIR_TEST_NAMED_ERROR_")] + [CCode (cheader_filename = "girtest.h", cprefix = "GIR_TEST_PLAIN_ERROR_TEST_", has_type_id = false)] + public errordomain PlainErrorTest { + FAILED, + SMELLY, + FISHY + } + [CCode (cheader_filename = "girtest.h", cname = "GirTestNamedError", cprefix = "GIR_TEST_NAMED_ERROR_", type_id = "gir_test_named_error_get_type ()")] public errordomain RenamedError { FAILED } diff --git a/tests/methods/bug781061.c-expected b/tests/methods/bug781061.c-expected index 91d787d5e..352fa1e2f 100644 --- a/tests/methods/bug781061.c-expected +++ b/tests/methods/bug781061.c-expected @@ -2,6 +2,7 @@ * generated from methods_bug781061.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #include <stdlib.h> #include <string.h> #include <stdarg.h> @@ -16,12 +17,15 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) + typedef enum { FOO_ERROR_FAILED } FooError; #define FOO_ERROR foo_error_quark () VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN void print_something_throws (gboolean ok, const gchar* format, GError** error, @@ -46,6 +50,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_FAILED, "FOO_ERROR_FAILED", "failed"}, {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; +} + void print_something_throws (gboolean ok, const gchar* format, diff --git a/tests/methods/parameter-out-free-on-error.c-expected b/tests/methods/parameter-out-free-on-error.c-expected index db888bd11..18e4fcc18 100644 --- a/tests/methods/parameter-out-free-on-error.c-expected +++ b/tests/methods/parameter-out-free-on-error.c-expected @@ -14,6 +14,8 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) + #define TYPE_MANAM (manam_get_type ()) #define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam)) #define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass)) @@ -39,6 +41,7 @@ typedef enum { FOO_ERROR_FAIL } FooError; #define FOO_ERROR foo_error_quark () + struct _Manam { GObject parent_instance; ManamPrivate * priv; @@ -51,6 +54,7 @@ struct _ManamClass { static gpointer manam_parent_class = NULL; VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref) VALA_EXTERN Manam* manam_new (void); @@ -70,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; +} + Manam* manam_construct (GType object_type) { diff --git a/tests/methods/params-array-with-throws.c-expected b/tests/methods/params-array-with-throws.c-expected index a456b3329..0d25797cc 100644 --- a/tests/methods/params-array-with-throws.c-expected +++ b/tests/methods/params-array-with-throws.c-expected @@ -2,9 +2,9 @@ * generated from methods_params_array_with_throws.vala, do not modify */ #include <glib.h> +#include <glib-object.h> #include <stdlib.h> #include <string.h> -#include <glib-object.h> #include <gobject/gvaluecollector.h> #if !defined(VALA_EXTERN) @@ -17,6 +17,8 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) + #define TYPE_FOO (foo_get_type ()) #define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo)) #define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass)) @@ -39,6 +41,7 @@ typedef enum { FOO_ERROR_WORSE } FooError; #define FOO_ERROR foo_error_quark () + struct _Foo { GTypeInstance parent_instance; volatile int ref_count; @@ -57,6 +60,7 @@ struct _ParamSpecFoo { static gpointer foo_parent_class = NULL; VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN void foo (GError** error, const gchar* _first_array, ...); @@ -113,6 +117,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"}, {FOO_ERROR_WORSE, "FOO_ERROR_WORSE", "worse"}, {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 _vala_array_add1 (const gchar** * array, gint* length, diff --git a/tests/methods/print-attribute.c-expected b/tests/methods/print-attribute.c-expected index bd627c809..d3b9ae59e 100644 --- a/tests/methods/print-attribute.c-expected +++ b/tests/methods/print-attribute.c-expected @@ -17,6 +17,8 @@ #endif #endif +#define TYPE_FOO_ERROR (foo_error_get_type ()) + #define TYPE_FOO (foo_get_type ()) #define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo)) #define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass)) @@ -39,6 +41,7 @@ typedef enum { FOO_ERROR_FAIL } FooError; #define FOO_ERROR foo_error_quark () + struct _Foo { GTypeInstance parent_instance; volatile int ref_count; @@ -57,6 +60,7 @@ struct _ParamSpecFoo { static gpointer foo_parent_class = NULL; VALA_EXTERN GQuark foo_error_quark (void); +GType foo_error_get_type (void) G_GNUC_CONST ; VALA_EXTERN gpointer foo_ref (gpointer instance); VALA_EXTERN void foo_unref (gpointer instance); VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name, @@ -88,6 +92,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; +} + void foo_foo (Foo* self, const gchar* s) 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) { |