]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Require and target GLib >= 2.56
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 28 Feb 2023 11:29:16 +0000 (12:29 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 28 Feb 2023 11:29:16 +0000 (12:29 +0100)
The next stable release of vala will happen over 5 years after the
release of GLib 2.56.0.

Fixes https://gitlab.gnome.org/GNOME/vala/issues/1415

13 files changed:
codegen/valagtypemodule.vala
configure.ac
tests/annotations/description.c-expected
tests/basic-types/gptrarray.c-expected
tests/basic-types/gptrarray.vala
tests/dbus/async-no-reply_client.c-expected
tests/dbus/no-reply_client.c-expected
tests/enums/bug614424.c-expected
tests/enums/bug763831.c-expected
tests/objects/plugin-module-init.c-expected
tests/parser/preprocessor-glib.vala
vala/valacodecontext.vala
vapi/glib-2.0.vapi

index 34c0773d4d3cdac35e8c5536c35b4f9eab164215..2ad38d650e1193be1c0809e7fd5a46f5ad2ebbc5 100644 (file)
@@ -2423,26 +2423,11 @@ public class Vala.GTypeModule : GErrorModule {
                bool is_flags = ((Enum) ((EnumValueType) ma.inner.value_type).type_symbol).is_flags;
 
                push_line (expr.source_reference);
-               if (context.require_glib_version (2, 54)) {
-                       var to_string = new CCodeFunctionCall (new CCodeIdentifier ((is_flags ? "g_flags_to_string" : "g_enum_to_string")));
-                       to_string.add_argument (new CCodeIdentifier (get_ccode_type_id (ma.inner.value_type)));
-                       to_string.add_argument ((CCodeExpression) get_ccodenode (((MemberAccess) expr.call).inner));
-                       expr.value_type.value_owned = true;
-                       set_cvalue (expr, to_string);
-               } else {
-                       var temp_var = get_temp_variable (new CType (is_flags ? "GFlagsValue*" : "GEnumValue*", "NULL"), false, expr, false);
-                       emit_temp_var (temp_var);
-
-                       var class_ref = new CCodeFunctionCall (new CCodeIdentifier ("g_type_class_ref"));
-                       class_ref.add_argument (new CCodeIdentifier (get_ccode_type_id (ma.inner.value_type)));
-                       var get_value = new CCodeFunctionCall (new CCodeIdentifier (is_flags ? "g_flags_get_first_value" : "g_enum_get_value"));
-                       get_value.add_argument (class_ref);
-                       get_value.add_argument ((CCodeExpression) get_ccodenode (((MemberAccess) expr.call).inner));
-
-                       ccode.add_assignment (get_variable_cexpression (temp_var.name), get_value);
-                       var is_null_value = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, get_variable_cexpression (temp_var.name), new CCodeConstant ("NULL"));
-                       set_cvalue (expr, new CCodeConditionalExpression (is_null_value, new CCodeMemberAccess.pointer (get_variable_cexpression (temp_var.name), "value_name"), new CCodeConstant ("NULL")));
-               }
+               var to_string = new CCodeFunctionCall (new CCodeIdentifier ((is_flags ? "g_flags_to_string" : "g_enum_to_string")));
+               to_string.add_argument (new CCodeIdentifier (get_ccode_type_id (ma.inner.value_type)));
+               to_string.add_argument ((CCodeExpression) get_ccodenode (((MemberAccess) expr.call).inner));
+               expr.value_type.value_owned = true;
+               set_cvalue (expr, to_string);
                pop_line ();
        }
 
index 7989f6ea4c73f870af58c76230e98a00f6971fcf..72647ba7da6004aa853ec609960990a9cbabd628 100644 (file)
@@ -180,7 +180,7 @@ fi
 AC_SUBST(TEST_CFLAGS)
 
 
-GLIB_REQUIRED=2.48.0
+GLIB_REQUIRED=2.56.0
 LIBGVC_REQUIRED=2.16
 
 PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED)
index e2d01d7a5d8ae2659ec7c0a1342cab0af006d3a1..b99ec456ecafe2708807d9ac210dbcfc7f52453b 100644 (file)
@@ -37,6 +37,7 @@ typedef enum  {
 } Bar;
 
 #define TYPE_BAR (bar_get_type ())
+#define _g_free0(var) (var = (g_free (var), NULL))
 #define _g_type_class_unref0(var) ((var == NULL) ? NULL : (var = (g_type_class_unref (var), NULL)))
 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
@@ -244,7 +245,7 @@ _vala_main (void)
        gint _tmp5__length1;
        GTypeClass* _tmp12_;
        GEnumClass* _tmp13_;
-       GEnumValue* _tmp14_;
+       gchar* _tmp14_;
        const gchar* _tmp15_;
        _tmp0_ = foo_new ();
        foo = _tmp0_;
@@ -287,9 +288,10 @@ _vala_main (void)
        }
        _tmp12_ = g_type_class_ref (TYPE_BAR);
        _tmp13_ = (GEnumClass*) _tmp12_;
-       _tmp14_ = g_enum_get_value (g_type_class_ref (TYPE_BAR), BAR_FOO);
-       _tmp15_ = (*g_enum_get_value_by_name (_tmp13_, (_tmp14_ != NULL) ? _tmp14_->value_name : NULL)).value_nick;
+       _tmp14_ = g_enum_to_string (TYPE_BAR, BAR_FOO);
+       _tmp15_ = (*g_enum_get_value_by_name (_tmp13_, _tmp14_)).value_nick;
        _vala_assert (g_strcmp0 (_tmp15_, "foo's nick") == 0, "((EnumClass) typeof (Bar).class_ref ()).get_value_by_name (Bar.FOO.to_string ()).value_nick == \"foo's nick\"");
+       _g_free0 (_tmp14_);
        _g_type_class_unref0 (_tmp13_);
        properties = (g_free (properties), NULL);
        _g_object_unref0 (foo);
index 88df05aeff551e71cf735ea8ceaea8b5a1bea5b6..bc641afa343f4cd350ab8051b5ccd1d1ef67690a 100644 (file)
@@ -342,16 +342,16 @@ _vala_main (void)
        Foo* _tmp3_;
        Foo* foo5 = NULL;
        Foo* _tmp4_;
-       Foo* _tmp76_;
-       Foo* _tmp77_;
-       Foo* _tmp78_;
-       Foo* _tmp79_;
-       Foo* _tmp80_;
-       Foo* _tmp147_;
-       Foo* _tmp148_;
-       Foo* _tmp149_;
-       Foo* _tmp150_;
-       Foo* _tmp151_;
+       Foo* _tmp84_;
+       Foo* _tmp85_;
+       Foo* _tmp86_;
+       Foo* _tmp87_;
+       Foo* _tmp88_;
+       Foo* _tmp163_;
+       Foo* _tmp164_;
+       Foo* _tmp165_;
+       Foo* _tmp166_;
+       Foo* _tmp167_;
        _tmp0_ = foo_new (5);
        foo1 = _tmp0_;
        _tmp1_ = foo_new (4);
@@ -410,15 +410,24 @@ _vala_main (void)
                GPtrArray* _tmp64_;
                gint _tmp65_;
                gint _tmp66_;
+               guint index = 0U;
                GPtrArray* _tmp67_;
-               GPtrArray* _tmp68_;
-               GPtrArray* _tmp69_;
-               gint _tmp70_;
-               gint _tmp71_;
+               Foo* _tmp68_;
+               guint _tmp69_ = 0U;
+               gboolean _tmp70_;
+               Foo* _tmp71_;
                GPtrArray* _tmp72_;
-               GPtrArray* _tmp73_;
+               gint _tmp73_;
                gint _tmp74_;
-               gint _tmp75_;
+               GPtrArray* _tmp75_;
+               GPtrArray* _tmp76_;
+               GPtrArray* _tmp77_;
+               gint _tmp78_;
+               gint _tmp79_;
+               GPtrArray* _tmp80_;
+               GPtrArray* _tmp81_;
+               gint _tmp82_;
+               gint _tmp83_;
                _tmp5_ = g_ptr_array_new_full ((guint) 8, _g_object_unref0_);
                array = _tmp5_;
                _tmp6_ = array;
@@ -588,146 +597,167 @@ _vala_main (void)
                _tmp66_ = _tmp65_;
                _vala_assert (_tmp66_ == 3, "array.length == 3");
                _tmp67_ = array;
-               vala_g_ptr_array_sort (_tmp67_, _compare_foo_gcompare_func);
-               _tmp68_ = array;
-               vala_g_ptr_array_sort_with_data (_tmp68_, _compare_foo_gcompare_data_func, NULL);
-               _tmp69_ = array;
-               _tmp70_ = vala_g_ptr_array_get_length (_tmp69_);
-               _tmp71_ = _tmp70_;
-               _vala_assert (_tmp71_ == 3, "array.length == 3");
+               _tmp68_ = foo5;
+               _tmp70_ = g_ptr_array_find (_tmp67_, _tmp68_, &_tmp69_);
+               index = _tmp69_;
+               _vala_assert (_tmp70_, "array.find (foo5, out index)");
+               _tmp71_ = foo5;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp71_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), "foo5.ref_count == 2");
+               _vala_assert (index == ((guint) 1), "index == 1");
                _tmp72_ = array;
-               g_ptr_array_set_size (_tmp72_, 0);
-               _tmp73_ = array;
-               _tmp74_ = vala_g_ptr_array_get_length (_tmp73_);
-               _tmp75_ = _tmp74_;
-               _vala_assert (_tmp75_ == 0, "array.length == 0");
+               _tmp73_ = vala_g_ptr_array_get_length (_tmp72_);
+               _tmp74_ = _tmp73_;
+               _vala_assert (_tmp74_ == 3, "array.length == 3");
+               _tmp75_ = array;
+               vala_g_ptr_array_sort (_tmp75_, _compare_foo_gcompare_func);
+               _tmp76_ = array;
+               vala_g_ptr_array_sort_with_data (_tmp76_, _compare_foo_gcompare_data_func, NULL);
+               _tmp77_ = array;
+               _tmp78_ = vala_g_ptr_array_get_length (_tmp77_);
+               _tmp79_ = _tmp78_;
+               _vala_assert (_tmp79_ == 3, "array.length == 3");
+               _tmp80_ = array;
+               g_ptr_array_set_size (_tmp80_, 0);
+               _tmp81_ = array;
+               _tmp82_ = vala_g_ptr_array_get_length (_tmp81_);
+               _tmp83_ = _tmp82_;
+               _vala_assert (_tmp83_ == 0, "array.length == 0");
                _g_ptr_array_unref0 (array);
        }
-       _tmp76_ = foo1;
-       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp76_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo1.ref_count == 1");
-       _tmp77_ = foo2;
-       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp77_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1");
-       _tmp78_ = foo3;
-       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp78_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo3.ref_count == 1");
-       _tmp79_ = foo4;
-       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp79_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1");
-       _tmp80_ = foo5;
-       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp80_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1");
+       _tmp84_ = foo1;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp84_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo1.ref_count == 1");
+       _tmp85_ = foo2;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp85_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1");
+       _tmp86_ = foo3;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp86_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo3.ref_count == 1");
+       _tmp87_ = foo4;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp87_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1");
+       _tmp88_ = foo5;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp88_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1");
        {
                GPtrArray* array = NULL;
-               GPtrArray* _tmp81_;
-               GPtrArray* _tmp82_;
-               Foo* _tmp83_;
-               Foo* _tmp84_;
-               GPtrArray* _tmp85_;
-               Foo* _tmp86_;
-               Foo* _tmp87_;
-               GPtrArray* _tmp88_;
-               Foo* _tmp89_;
-               Foo* _tmp90_;
-               GPtrArray* _tmp91_;
-               gint _tmp92_;
-               gint _tmp93_;
+               GPtrArray* _tmp89_;
+               GPtrArray* _tmp90_;
+               Foo* _tmp91_;
+               Foo* _tmp92_;
+               GPtrArray* _tmp93_;
+               Foo* _tmp94_;
+               Foo* _tmp95_;
+               GPtrArray* _tmp96_;
+               Foo* _tmp97_;
+               Foo* _tmp98_;
+               GPtrArray* _tmp99_;
+               gint _tmp100_;
+               gint _tmp101_;
                gint loop_size = 0;
-               GPtrArray* _tmp94_;
-               GPtrArray* _tmp103_;
-               Foo* _tmp113_;
-               GPtrArray* _tmp114_;
-               gconstpointer _tmp115_;
-               GPtrArray* _tmp116_;
-               Foo* _tmp117_;
-               Foo* _tmp118_;
-               GPtrArray* _tmp119_;
-               gconstpointer _tmp120_;
+               GPtrArray* _tmp102_;
+               GPtrArray* _tmp111_;
                Foo* _tmp121_;
-               Foo* _tmp122_;
-               GPtrArray* _tmp123_;
-               gint _tmp124_;
-               gint _tmp125_;
-               GPtrArray* _tmp126_;
-               Foo* _tmp127_;
-               Foo* _tmp128_;
-               GPtrArray* _tmp129_;
-               gint _tmp130_;
-               gint _tmp131_;
-               GPtrArray* _tmp132_;
-               Foo* _tmp133_;
-               Foo* _tmp134_;
-               GPtrArray* _tmp135_;
-               gint _tmp136_;
-               gint _tmp137_;
-               GPtrArray* _tmp138_;
-               GPtrArray* _tmp139_;
+               GPtrArray* _tmp122_;
+               gconstpointer _tmp123_;
+               GPtrArray* _tmp124_;
+               Foo* _tmp125_;
+               Foo* _tmp126_;
+               GPtrArray* _tmp127_;
+               gconstpointer _tmp128_;
+               Foo* _tmp129_;
+               Foo* _tmp130_;
+               GPtrArray* _tmp131_;
+               gint _tmp132_;
+               gint _tmp133_;
+               GPtrArray* _tmp134_;
+               Foo* _tmp135_;
+               Foo* _tmp136_;
+               GPtrArray* _tmp137_;
+               gint _tmp138_;
+               gint _tmp139_;
                GPtrArray* _tmp140_;
-               gint _tmp141_;
-               gint _tmp142_;
+               Foo* _tmp141_;
+               Foo* _tmp142_;
                GPtrArray* _tmp143_;
-               GPtrArray* _tmp144_;
+               gint _tmp144_;
                gint _tmp145_;
-               gint _tmp146_;
-               _tmp81_ = g_ptr_array_new_full ((guint) 8, NULL);
-               array = _tmp81_;
-               _tmp82_ = array;
-               _tmp83_ = foo1;
-               g_ptr_array_add (_tmp82_, _tmp83_);
-               _tmp84_ = foo1;
-               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp84_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo1.ref_count == 1");
-               _tmp85_ = array;
-               _tmp86_ = foo2;
-               g_ptr_array_add (_tmp85_, _tmp86_);
-               _tmp87_ = foo2;
-               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp87_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1");
-               _tmp88_ = array;
-               _tmp89_ = foo3;
-               g_ptr_array_add (_tmp88_, _tmp89_);
-               _tmp90_ = foo3;
-               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp90_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo3.ref_count == 1");
-               _tmp91_ = array;
-               _tmp92_ = vala_g_ptr_array_get_length (_tmp91_);
-               _tmp93_ = _tmp92_;
-               _vala_assert (_tmp93_ == 3, "array.length == 3");
+               guint index = 0U;
+               GPtrArray* _tmp146_;
+               Foo* _tmp147_;
+               guint _tmp148_ = 0U;
+               gboolean _tmp149_;
+               Foo* _tmp150_;
+               GPtrArray* _tmp151_;
+               gint _tmp152_;
+               gint _tmp153_;
+               GPtrArray* _tmp154_;
+               GPtrArray* _tmp155_;
+               GPtrArray* _tmp156_;
+               gint _tmp157_;
+               gint _tmp158_;
+               GPtrArray* _tmp159_;
+               GPtrArray* _tmp160_;
+               gint _tmp161_;
+               gint _tmp162_;
+               _tmp89_ = g_ptr_array_new_full ((guint) 8, NULL);
+               array = _tmp89_;
+               _tmp90_ = array;
+               _tmp91_ = foo1;
+               g_ptr_array_add (_tmp90_, _tmp91_);
+               _tmp92_ = foo1;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp92_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo1.ref_count == 1");
+               _tmp93_ = array;
+               _tmp94_ = foo2;
+               g_ptr_array_add (_tmp93_, _tmp94_);
+               _tmp95_ = foo2;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp95_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1");
+               _tmp96_ = array;
+               _tmp97_ = foo3;
+               g_ptr_array_add (_tmp96_, _tmp97_);
+               _tmp98_ = foo3;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp98_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo3.ref_count == 1");
+               _tmp99_ = array;
+               _tmp100_ = vala_g_ptr_array_get_length (_tmp99_);
+               _tmp101_ = _tmp100_;
+               _vala_assert (_tmp101_ == 3, "array.length == 3");
                loop_size = 0;
-               _tmp94_ = array;
+               _tmp102_ = array;
                {
                        GPtrArray* element_collection = NULL;
                        guint element_index = 0U;
-                       element_collection = _tmp94_;
+                       element_collection = _tmp102_;
                        for (element_index = 0; element_index < element_collection->len; element_index = element_index + 1) {
                                Foo* element = NULL;
                                element = g_ptr_array_index (element_collection, element_index);
                                {
-                                       gint _tmp95_;
-                                       Foo* _tmp96_;
-                                       _tmp95_ = loop_size;
-                                       loop_size = _tmp95_ + 1;
-                                       _tmp96_ = element;
-                                       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp96_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "element.ref_count == 1");
+                                       gint _tmp103_;
+                                       Foo* _tmp104_;
+                                       _tmp103_ = loop_size;
+                                       loop_size = _tmp103_ + 1;
+                                       _tmp104_ = element;
+                                       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp104_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "element.ref_count == 1");
                                        switch (loop_size) {
                                                case 1:
                                                {
-                                                       Foo* _tmp97_;
-                                                       Foo* _tmp98_;
-                                                       _tmp97_ = element;
-                                                       _tmp98_ = foo1;
-                                                       _vala_assert (_tmp97_ == _tmp98_, "element == foo1");
+                                                       Foo* _tmp105_;
+                                                       Foo* _tmp106_;
+                                                       _tmp105_ = element;
+                                                       _tmp106_ = foo1;
+                                                       _vala_assert (_tmp105_ == _tmp106_, "element == foo1");
                                                        break;
                                                }
                                                case 2:
                                                {
-                                                       Foo* _tmp99_;
-                                                       Foo* _tmp100_;
-                                                       _tmp99_ = element;
-                                                       _tmp100_ = foo2;
-                                                       _vala_assert (_tmp99_ == _tmp100_, "element == foo2");
+                                                       Foo* _tmp107_;
+                                                       Foo* _tmp108_;
+                                                       _tmp107_ = element;
+                                                       _tmp108_ = foo2;
+                                                       _vala_assert (_tmp107_ == _tmp108_, "element == foo2");
                                                        break;
                                                }
                                                case 3:
                                                {
-                                                       Foo* _tmp101_;
-                                                       Foo* _tmp102_;
-                                                       _tmp101_ = element;
-                                                       _tmp102_ = foo3;
-                                                       _vala_assert (_tmp101_ == _tmp102_, "element == foo3");
+                                                       Foo* _tmp109_;
+                                                       Foo* _tmp110_;
+                                                       _tmp109_ = element;
+                                                       _tmp110_ = foo3;
+                                                       _vala_assert (_tmp109_ == _tmp110_, "element == foo3");
                                                        break;
                                                }
                                                default:
@@ -738,49 +768,49 @@ _vala_main (void)
                }
                _vala_assert (loop_size == 3, "loop_size == 3");
                loop_size = 0;
-               _tmp103_ = array;
+               _tmp111_ = array;
                {
                        GPtrArray* element_collection = NULL;
                        guint element_index = 0U;
-                       element_collection = _tmp103_;
+                       element_collection = _tmp111_;
                        for (element_index = 0; element_index < element_collection->len; element_index = element_index + 1) {
-                               Foo* _tmp104_;
+                               Foo* _tmp112_;
                                Foo* element = NULL;
-                               _tmp104_ = _g_object_ref0 (g_ptr_array_index (element_collection, element_index));
-                               element = _tmp104_;
+                               _tmp112_ = _g_object_ref0 (g_ptr_array_index (element_collection, element_index));
+                               element = _tmp112_;
                                {
-                                       gint _tmp105_;
-                                       Foo* _tmp106_;
-                                       _tmp105_ = loop_size;
-                                       loop_size = _tmp105_ + 1;
-                                       _tmp106_ = element;
-                                       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp106_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), "element.ref_count == 2");
+                                       gint _tmp113_;
+                                       Foo* _tmp114_;
+                                       _tmp113_ = loop_size;
+                                       loop_size = _tmp113_ + 1;
+                                       _tmp114_ = element;
+                                       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp114_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), "element.ref_count == 2");
                                        switch (loop_size) {
                                                case 1:
                                                {
-                                                       Foo* _tmp107_;
-                                                       Foo* _tmp108_;
-                                                       _tmp107_ = element;
-                                                       _tmp108_ = foo1;
-                                                       _vala_assert (_tmp107_ == _tmp108_, "element == foo1");
+                                                       Foo* _tmp115_;
+                                                       Foo* _tmp116_;
+                                                       _tmp115_ = element;
+                                                       _tmp116_ = foo1;
+                                                       _vala_assert (_tmp115_ == _tmp116_, "element == foo1");
                                                        break;
                                                }
                                                case 2:
                                                {
-                                                       Foo* _tmp109_;
-                                                       Foo* _tmp110_;
-                                                       _tmp109_ = element;
-                                                       _tmp110_ = foo2;
-                                                       _vala_assert (_tmp109_ == _tmp110_, "element == foo2");
+                                                       Foo* _tmp117_;
+                                                       Foo* _tmp118_;
+                                                       _tmp117_ = element;
+                                                       _tmp118_ = foo2;
+                                                       _vala_assert (_tmp117_ == _tmp118_, "element == foo2");
                                                        break;
                                                }
                                                case 3:
                                                {
-                                                       Foo* _tmp111_;
-                                                       Foo* _tmp112_;
-                                                       _tmp111_ = element;
-                                                       _tmp112_ = foo3;
-                                                       _vala_assert (_tmp111_ == _tmp112_, "element == foo3");
+                                                       Foo* _tmp119_;
+                                                       Foo* _tmp120_;
+                                                       _tmp119_ = element;
+                                                       _tmp120_ = foo3;
+                                                       _vala_assert (_tmp119_ == _tmp120_, "element == foo3");
                                                        break;
                                                }
                                                default:
@@ -791,69 +821,81 @@ _vala_main (void)
                        }
                }
                _vala_assert (loop_size == 3, "loop_size == 3");
-               _tmp113_ = foo2;
-               _tmp114_ = array;
-               _tmp115_ = g_ptr_array_index (_tmp114_, (guint) 1);
-               _vala_assert (_tmp113_ == ((Foo*) _tmp115_), "foo2 == array.get (1)");
-               _tmp116_ = array;
-               _tmp117_ = foo4;
-               g_ptr_array_set (_tmp116_, (guint) 1, _tmp117_);
-               _tmp118_ = foo4;
-               _tmp119_ = array;
-               _tmp120_ = g_ptr_array_index (_tmp119_, (guint) 1);
-               _vala_assert (_tmp118_ == ((Foo*) _tmp120_), "foo4 == array.get (1)");
                _tmp121_ = foo2;
-               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp121_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1");
-               _tmp122_ = foo4;
-               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp122_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1");
-               _tmp123_ = array;
-               _tmp124_ = vala_g_ptr_array_get_length (_tmp123_);
-               _tmp125_ = _tmp124_;
-               _vala_assert (_tmp125_ == 3, "array.length == 3");
-               _tmp126_ = array;
-               _tmp127_ = foo5;
-               g_ptr_array_insert (_tmp126_, 2, _tmp127_);
-               _tmp128_ = foo5;
-               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp128_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1");
-               _tmp129_ = array;
-               _tmp130_ = vala_g_ptr_array_get_length (_tmp129_);
-               _tmp131_ = _tmp130_;
-               _vala_assert (_tmp131_ == 4, "array.length == 4");
-               _tmp132_ = array;
-               _tmp133_ = foo4;
-               _vala_assert (g_ptr_array_remove (_tmp132_, _tmp133_), "array.remove (foo4)");
-               _tmp134_ = foo4;
-               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp134_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1");
-               _tmp135_ = array;
-               _tmp136_ = vala_g_ptr_array_get_length (_tmp135_);
-               _tmp137_ = _tmp136_;
-               _vala_assert (_tmp137_ == 3, "array.length == 3");
-               _tmp138_ = array;
-               vala_g_ptr_array_sort (_tmp138_, _compare_foo_gcompare_func);
-               _tmp139_ = array;
-               vala_g_ptr_array_sort_with_data (_tmp139_, _compare_foo_gcompare_data_func, NULL);
+               _tmp122_ = array;
+               _tmp123_ = g_ptr_array_index (_tmp122_, (guint) 1);
+               _vala_assert (_tmp121_ == ((Foo*) _tmp123_), "foo2 == array.get (1)");
+               _tmp124_ = array;
+               _tmp125_ = foo4;
+               g_ptr_array_set (_tmp124_, (guint) 1, _tmp125_);
+               _tmp126_ = foo4;
+               _tmp127_ = array;
+               _tmp128_ = g_ptr_array_index (_tmp127_, (guint) 1);
+               _vala_assert (_tmp126_ == ((Foo*) _tmp128_), "foo4 == array.get (1)");
+               _tmp129_ = foo2;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp129_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1");
+               _tmp130_ = foo4;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp130_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1");
+               _tmp131_ = array;
+               _tmp132_ = vala_g_ptr_array_get_length (_tmp131_);
+               _tmp133_ = _tmp132_;
+               _vala_assert (_tmp133_ == 3, "array.length == 3");
+               _tmp134_ = array;
+               _tmp135_ = foo5;
+               g_ptr_array_insert (_tmp134_, 2, _tmp135_);
+               _tmp136_ = foo5;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp136_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1");
+               _tmp137_ = array;
+               _tmp138_ = vala_g_ptr_array_get_length (_tmp137_);
+               _tmp139_ = _tmp138_;
+               _vala_assert (_tmp139_ == 4, "array.length == 4");
                _tmp140_ = array;
-               _tmp141_ = vala_g_ptr_array_get_length (_tmp140_);
-               _tmp142_ = _tmp141_;
-               _vala_assert (_tmp142_ == 3, "array.length == 3");
+               _tmp141_ = foo4;
+               _vala_assert (g_ptr_array_remove (_tmp140_, _tmp141_), "array.remove (foo4)");
+               _tmp142_ = foo4;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp142_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1");
                _tmp143_ = array;
-               g_ptr_array_set_size (_tmp143_, 0);
-               _tmp144_ = array;
-               _tmp145_ = vala_g_ptr_array_get_length (_tmp144_);
-               _tmp146_ = _tmp145_;
-               _vala_assert (_tmp146_ == 0, "array.length == 0");
+               _tmp144_ = vala_g_ptr_array_get_length (_tmp143_);
+               _tmp145_ = _tmp144_;
+               _vala_assert (_tmp145_ == 3, "array.length == 3");
+               _tmp146_ = array;
+               _tmp147_ = foo5;
+               _tmp149_ = g_ptr_array_find (_tmp146_, _tmp147_, &_tmp148_);
+               index = _tmp148_;
+               _vala_assert (_tmp149_, "array.find (foo5, out index)");
+               _tmp150_ = foo5;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp150_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1");
+               _vala_assert (index == ((guint) 1), "index == 1");
+               _tmp151_ = array;
+               _tmp152_ = vala_g_ptr_array_get_length (_tmp151_);
+               _tmp153_ = _tmp152_;
+               _vala_assert (_tmp153_ == 3, "array.length == 3");
+               _tmp154_ = array;
+               vala_g_ptr_array_sort (_tmp154_, _compare_foo_gcompare_func);
+               _tmp155_ = array;
+               vala_g_ptr_array_sort_with_data (_tmp155_, _compare_foo_gcompare_data_func, NULL);
+               _tmp156_ = array;
+               _tmp157_ = vala_g_ptr_array_get_length (_tmp156_);
+               _tmp158_ = _tmp157_;
+               _vala_assert (_tmp158_ == 3, "array.length == 3");
+               _tmp159_ = array;
+               g_ptr_array_set_size (_tmp159_, 0);
+               _tmp160_ = array;
+               _tmp161_ = vala_g_ptr_array_get_length (_tmp160_);
+               _tmp162_ = _tmp161_;
+               _vala_assert (_tmp162_ == 0, "array.length == 0");
                _g_ptr_array_unref0 (array);
        }
-       _tmp147_ = foo1;
-       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp147_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo1.ref_count == 1");
-       _tmp148_ = foo2;
-       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp148_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1");
-       _tmp149_ = foo3;
-       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp149_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo3.ref_count == 1");
-       _tmp150_ = foo4;
-       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp150_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1");
-       _tmp151_ = foo5;
-       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp151_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1");
+       _tmp163_ = foo1;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp163_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo1.ref_count == 1");
+       _tmp164_ = foo2;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp164_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo2.ref_count == 1");
+       _tmp165_ = foo3;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp165_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo3.ref_count == 1");
+       _tmp166_ = foo4;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp166_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo4.ref_count == 1");
+       _tmp167_ = foo5;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp167_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo5.ref_count == 1");
        _g_object_unref0 (foo5);
        _g_object_unref0 (foo4);
        _g_object_unref0 (foo3);
index 1b5d6c6223e1c275eca94b0cdbb41ceb1b643f93..45105db35012ef329ac9c35a7707ca1241bbae19 100644 (file)
@@ -65,13 +65,11 @@ void main () {
                assert (foo4.ref_count == 1);
                assert (array.length == 3);
 
-#if GLIB_2_54
                uint index;
                assert (array.find (foo5, out index));
                assert (foo5.ref_count == 2);
                assert (index == 1);
                assert (array.length == 3);
-#endif
 
                array.sort (compare_foo);
                array.sort_with_data (compare_foo);
@@ -136,13 +134,11 @@ void main () {
                assert (foo4.ref_count == 1);
                assert (array.length == 3);
 
-#if GLIB_2_54
                uint index;
                assert (array.find (foo5, out index));
                assert (foo5.ref_count == 1);
                assert (index == 1);
                assert (array.length == 3);
-#endif
 
                array.sort (compare_foo);
                array.sort_with_data (compare_foo);
index d865c34a2c18a786c87ac8697aa7cd726e5a1fdc..f32f69dda1ccd7510741164acbaa67a171619c28 100644 (file)
@@ -753,7 +753,7 @@ __lambda4_ (Block1Data* _data1_,
 {
        gboolean _tmp0_ = FALSE;
        const gchar* _tmp1_;
-       GDBusMessage* _tmp6_;
+       GDBusMessage* _tmp4_;
        GDBusMessage* result;
        g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (conn, g_dbus_connection_get_type ()), NULL);
        g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (message, g_dbus_message_get_type ()), NULL);
@@ -770,12 +770,8 @@ __lambda4_ (Block1Data* _data1_,
                        case G_DBUS_MESSAGE_TYPE_METHOD_CALL:
                        {
                                GAsyncQueue* _tmp3_;
-                               GFlagsValue* _tmp4_;
-                               gchar* _tmp5_;
                                _tmp3_ = _data1_->events;
-                               _tmp4_ = g_flags_get_first_value (g_type_class_ref (g_dbus_message_flags_get_type ()), g_dbus_message_get_flags (message));
-                               _tmp5_ = g_strdup ((_tmp4_ != NULL) ? _tmp4_->value_name : NULL);
-                               g_async_queue_push (_tmp3_, _tmp5_);
+                               g_async_queue_push (_tmp3_, g_flags_to_string (g_dbus_message_flags_get_type (), g_dbus_message_get_flags (message)));
                                break;
                        }
                        default:
@@ -784,8 +780,8 @@ __lambda4_ (Block1Data* _data1_,
                        }
                }
        }
-       _tmp6_ = _g_object_ref0 (message);
-       result = _tmp6_;
+       _tmp4_ = _g_object_ref0 (message);
+       result = _tmp4_;
        _g_object_unref0 (message);
        return result;
 }
index 01406da99e99186d7c0934e204071a8cd27885cf..1e580057821b56dea3c731f304525439da674fde 100644 (file)
@@ -681,7 +681,7 @@ __lambda4_ (Block1Data* _data1_,
 {
        gboolean _tmp0_ = FALSE;
        const gchar* _tmp1_;
-       GDBusMessage* _tmp6_;
+       GDBusMessage* _tmp4_;
        GDBusMessage* result;
        g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (conn, g_dbus_connection_get_type ()), NULL);
        g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (message, g_dbus_message_get_type ()), NULL);
@@ -698,12 +698,8 @@ __lambda4_ (Block1Data* _data1_,
                        case G_DBUS_MESSAGE_TYPE_METHOD_CALL:
                        {
                                GAsyncQueue* _tmp3_;
-                               GFlagsValue* _tmp4_;
-                               gchar* _tmp5_;
                                _tmp3_ = _data1_->events;
-                               _tmp4_ = g_flags_get_first_value (g_type_class_ref (g_dbus_message_flags_get_type ()), g_dbus_message_get_flags (message));
-                               _tmp5_ = g_strdup ((_tmp4_ != NULL) ? _tmp4_->value_name : NULL);
-                               g_async_queue_push (_tmp3_, _tmp5_);
+                               g_async_queue_push (_tmp3_, g_flags_to_string (g_dbus_message_flags_get_type (), g_dbus_message_get_flags (message)));
                                break;
                        }
                        default:
@@ -712,8 +708,8 @@ __lambda4_ (Block1Data* _data1_,
                        }
                }
        }
-       _tmp6_ = _g_object_ref0 (message);
-       result = _tmp6_;
+       _tmp4_ = _g_object_ref0 (message);
+       result = _tmp4_;
        _g_object_unref0 (message);
        return result;
 }
index c38fd5949a633f4773be3d04a60d821a93e4e8ce..af50a5a1c22bf9805d821a5bec448b09a21135c8 100644 (file)
@@ -34,12 +34,8 @@ static void _vala_main (void);
 gchar*
 foo_bar (Foo self)
 {
-       GEnumValue* _tmp0_;
-       gchar* _tmp1_;
        gchar* result;
-       _tmp0_ = g_enum_get_value (g_type_class_ref (TYPE_FOO), self);
-       _tmp1_ = g_strdup ((_tmp0_ != NULL) ? _tmp0_->value_name : NULL);
-       result = _tmp1_;
+       result = g_enum_to_string (TYPE_FOO, self);
        return result;
 }
 
index 318d49a94a664d79ad775a8035b0585f80f8f4de..15c837674b013cdc9a8fe8295dd81b7e3b3762f7 100644 (file)
@@ -2,6 +2,9 @@
  * generated from enums_bug763831.vala, do not modify */
 
 #include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
 
 #if !defined(VALA_EXTERN)
 #if defined(_WIN32) || defined(__CYGWIN__)
@@ -23,6 +26,7 @@ typedef enum  {
 } Bar;
 
 #define TYPE_BAR (bar_get_type ())
+#define _g_free0(var) (var = (g_free (var), NULL))
 
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
@@ -73,10 +77,12 @@ bar_get_type (void)
 static void
 _vala_main (void)
 {
-       GFlagsValue* _tmp0_;
-       GEnumValue* _tmp1_;
-       _tmp0_ = g_flags_get_first_value (g_type_class_ref (TYPE_FOO), FOO_TEST);
-       _tmp1_ = g_enum_get_value (g_type_class_ref (TYPE_BAR), BAR_TEST);
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = g_flags_to_string (TYPE_FOO, FOO_TEST);
+       _g_free0 (_tmp0_);
+       _tmp1_ = g_enum_to_string (TYPE_BAR, BAR_TEST);
+       _g_free0 (_tmp1_);
 }
 
 int
index de299de94c3cf558533219898ce3fcf2a0257eb6..5788a541d0f6c604d35e18bf93d65b9d00ced6e9 100644 (file)
@@ -29,6 +29,11 @@ enum  {
        MODULE_NUM_PROPERTIES
 };
 static GParamSpec* module_properties[MODULE_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (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);
 
 struct _Module {
        GTypeModule parent_instance;
@@ -129,6 +134,15 @@ init_plugin (GTypeModule* m)
 static void
 _vala_main (void)
 {
+       GObject* o = NULL;
+       GObject* _tmp0_;
+       GObject* _tmp1_;
+       _tmp0_ = g_object_new (init_plugin (NULL), NULL);
+       _tmp1_ = G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_;
+       o = _tmp1_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (o, g_type_module_get_type ()), "o is TypeModule");
+       _vala_assert (IS_MODULE (o), "o is Module");
+       _g_object_unref0 (o);
 }
 
 int
index effc2ecd2c5f634502612d1fa49cf10c35539689..4252547d57826da50f6597f5436ffd400880674f 100644 (file)
@@ -35,6 +35,14 @@ void main () {
        assert_not_reached ();
 #elif !GLIB_2_48
        assert_not_reached ();
+#elif !GLIB_2_50
+       assert_not_reached ();
+#elif !GLIB_2_52
+       assert_not_reached ();
+#elif !GLIB_2_54
+       assert_not_reached ();
+#elif !GLIB_2_56
+       assert_not_reached ();
 #else
        assert (true);
 #endif
index 0ac4bbdf8162abfc1e9b6a56fe5cbe969f8e28fe..63dacd1a3007b760b68fafec6979139ade917c46 100644 (file)
@@ -582,7 +582,7 @@ public class Vala.CodeContext {
                }
 
                target_glib_major = 2;
-               target_glib_minor = 48;
+               target_glib_minor = 56;
 
                for (int i = 16; i <= target_glib_minor; i += 2) {
                        defines.add ("GLIB_2_%d".printf (i));
index 4e7239fc6f2a9149767bc7fa45f7a07dca08d802..c67fc3b990ba4ca581fd06f79262f1b090109fa1 100644 (file)
@@ -2055,10 +2055,8 @@ namespace GLib {
                [Version (since = "2.50")]
                public const string FORMAT;
 
-#if GLIB_2_50
                [CCode (cname = "g_strdup_printf", instance_pos = -1)]
                public string to_string (string format = "%" + FORMAT);
-#endif
        }
 
        public delegate void ChildWatchFunc (Pid pid, int wait_status);
@@ -3877,11 +3875,7 @@ namespace GLib {
                public static bool if_continued (int status);
 
                [NoReturn]
-#if GLIB_2_50
                [Version (since = "2.50")]
-#else
-               [CCode (cname = "abort", cheader_filename = "stdlib.h")]
-#endif
                public void abort ();
                [NoReturn]
                [CCode (cname = "exit", cheader_filename = "stdlib.h")]