diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-10-18 12:23:21 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-10-18 12:23:21 +0200 |
commit | f2570bb788deaa35de10d23bfa8faed137726dbe (patch) | |
tree | ec1a0cb032fe0a40b0032527ce0f5db1f4afed03 /tests | |
parent | 9e336f272c62c1603945839c810c39a74c2e2a8b (diff) | |
download | vala-f2570bb788deaa35de10d23bfa8faed137726dbe.tar.gz |
tests: Add missing tests/enums/bug614424.c-expected
Diffstat (limited to 'tests')
-rw-r--r-- | tests/enums/bug614424.c-expected | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/tests/enums/bug614424.c-expected b/tests/enums/bug614424.c-expected new file mode 100644 index 000000000..d769d657d --- /dev/null +++ b/tests/enums/bug614424.c-expected @@ -0,0 +1,85 @@ +/* enums_bug614424.c generated by valac, the Vala compiler + * generated from enums_bug614424.vala, do not modify */ + +#include <glib-object.h> +#include <stdlib.h> +#include <string.h> +#include <glib.h> + +#if !defined(VALA_EXTERN) +#if defined(_MSC_VER) +#define VALA_EXTERN __declspec(dllexport) extern +#elif __GNUC__ >= 4 +#define VALA_EXTERN __attribute__((visibility("default"))) extern +#else +#define VALA_EXTERN extern +#endif +#endif + +typedef enum { + FOO_BAR +} Foo; + +#define TYPE_FOO (foo_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; } +#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; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ; +VALA_EXTERN gchar* foo_bar (Foo self); +static void _vala_main (void); + +gchar* +foo_bar (Foo self) +{ + GEnumValue* _tmp0_; + gchar* _tmp1_; + gchar* result = NULL; + _tmp0_ = g_enum_get_value (g_type_class_ref (TYPE_FOO), self); + _tmp1_ = g_strdup ((_tmp0_ != NULL) ? _tmp0_->value_name : NULL); + result = _tmp1_; + return result; +} + +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__volatile = 0; + if (g_once_init_enter (&foo_type_id__volatile)) { + GType foo_type_id; + foo_type_id = foo_get_type_once (); + g_once_init_leave (&foo_type_id__volatile, foo_type_id); + } + return foo_type_id__volatile; +} + +static void +_vala_main (void) +{ + gchar* _tmp0_; + gchar* _tmp1_; + _tmp0_ = foo_bar (FOO_BAR); + _tmp1_ = _tmp0_; + _vala_assert (g_strcmp0 (_tmp1_, "FOO_BAR") == 0, "Foo.BAR.bar () == \"FOO_BAR\""); + _g_free0 (_tmp1_); +} + +int +main (int argc, + char ** argv) +{ + _vala_main (); + return 0; +} + |