[vala/wip/glib-2.32] Require and target GLib >= 2.32
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/glib-2.32] Require and target GLib >= 2.32
- Date: Thu, 4 Feb 2016 20:39:55 +0000 (UTC)
commit 19bfc01f32dd84289c3aeacffbdac5243d838238
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Feb 4 20:12:50 2016 +0100
Require and target GLib >= 2.32
The next stable release of vala will happen four years after the
release of GLib 2.32.0.
codegen/valaccodeattribute.vala | 8 +----
codegen/valaccodebasemodule.vala | 42 ++++------------------------
codegen/valagsignalmodule.vala | 2 +-
compiler/valacompiler.vala | 2 +-
configure.ac | 2 +-
vapi/glib-2.0.vapi | 57 --------------------------------------
6 files changed, 11 insertions(+), 102 deletions(-)
---
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index 6ef37aa..38d2ebf 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -837,7 +837,7 @@ public class Vala.CCodeAttribute : AttributeCache {
if (sym != null) {
if (sym is Class && !((Class) sym).is_compact || sym is Interface) {
return CCodeBaseModule.get_ccode_upper_case_name (sym, "TYPE_");
- } else if (sym is ErrorType && sym.source_reference != null &&
sym.source_reference.file.context.require_glib_version (2, 26)) {
+ } else if (sym is ErrorType) {
return "G_TYPE_ERROR";
} else if (sym is Struct) {
var st = (Struct) sym;
@@ -867,11 +867,7 @@ public class Vala.CCodeAttribute : AttributeCache {
} else if (node is PointerType || node is DelegateType) {
return "G_TYPE_POINTER";
} else if (node is ErrorType) {
- if (node.source_reference != null &&
node.source_reference.file.context.require_glib_version (2, 26)) {
- return "G_TYPE_ERROR";
- } else {
- return "G_TYPE_POINTER";
- }
+ return "G_TYPE_ERROR";
} else if (node is VoidType) {
return "G_TYPE_NONE";
} else {
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 0f79235..f57b9fd 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -331,7 +331,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
public bool requires_array_free;
public bool requires_array_move;
public bool requires_array_length;
- public bool requires_clear_mutex;
public Set<string> wrappers;
Set<Symbol> generated_external_symbols;
@@ -464,16 +463,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
gvariant_type = (Class) glib_ns.scope.lookup ("Variant");
gsource_type = (Class) glib_ns.scope.lookup ("Source");
- if (context.require_glib_version (2, 32)) {
- gmutex_type = (Struct) glib_ns.scope.lookup ("Mutex");
- grecmutex_type = (Struct) glib_ns.scope.lookup ("RecMutex");
- grwlock_type = (Struct) glib_ns.scope.lookup ("RWLock");
- gcond_type = (Struct) glib_ns.scope.lookup ("Cond");
+ gmutex_type = (Struct) glib_ns.scope.lookup ("Mutex");
+ grecmutex_type = (Struct) glib_ns.scope.lookup ("RecMutex");
+ grwlock_type = (Struct) glib_ns.scope.lookup ("RWLock");
+ gcond_type = (Struct) glib_ns.scope.lookup ("Cond");
- mutex_type = grecmutex_type;
- } else {
- mutex_type = (Struct) glib_ns.scope.lookup ("StaticRecMutex");
- }
+ mutex_type = grecmutex_type;
type_module_type = (TypeSymbol) glib_ns.scope.lookup ("TypeModule");
@@ -716,7 +711,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
requires_array_free = false;
requires_array_move = false;
requires_array_length = false;
- requires_clear_mutex = false;
wrappers = new HashSet<string> (str_hash, str_equal);
generated_external_symbols = new HashSet<Symbol> ();
@@ -755,13 +749,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
if (requires_array_length) {
append_vala_array_length ();
}
- if (requires_clear_mutex) {
- append_vala_clear_mutex ("GMutex", "g_mutex");
- append_vala_clear_mutex ("GRecMutex", "g_rec_mutex");
- append_vala_clear_mutex ("GRWLock", "g_rw_lock");
- append_vala_clear_mutex ("GCond", "g_cond");
- }
-
if (gvaluecollector_h_needed) {
cfile.add_include ("gobject/gvaluecollector.h");
}
@@ -885,15 +872,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
pop_context ();
if (finalize_context != null) {
- string mutex_clear;
- if (context.require_glib_version (2, 32)) {
- mutex_clear = "g_rec_mutex_clear";
- } else {
- mutex_clear = "g_static_rec_mutex_free";
- }
-
push_context (finalize_context);
- var fc = new CCodeFunctionCall (new CCodeIdentifier (mutex_clear));
+ var fc = new CCodeFunctionCall (new CCodeIdentifier ("g_rec_mutex_clear"));
fc.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, l));
ccode.add_expression (fc);
pop_context ();
@@ -3314,16 +3294,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
ccomma.append_expression (new CCodeConstant ("NULL"));
return new CCodeConditionalExpression (cisvalid, ccomma, new CCodeConstant
("NULL"));
- } else if (context.require_glib_version (2, 32) &&
- (type.data_type == gmutex_type ||
- type.data_type == grecmutex_type ||
- type.data_type == grwlock_type ||
- type.data_type == gcond_type)) {
- // g_mutex_clear must not be called for uninitialized mutex
- // also, g_mutex_clear does not clear the struct
- requires_clear_mutex = true;
- ccall.call = new CCodeIdentifier ("_vala_clear_" + get_ccode_name
(type.data_type));
- return ccall;
} else {
return ccall;
}
diff --git a/codegen/valagsignalmodule.vala b/codegen/valagsignalmodule.vala
index eff6781..d9f7d51 100644
--- a/codegen/valagsignalmodule.vala
+++ b/codegen/valagsignalmodule.vala
@@ -333,7 +333,7 @@ public class Vala.GSignalModule : GObjectModule {
flags += "G_SIGNAL_NO_HOOKS";
}
- if (sig.get_attribute ("Deprecated") != null && CodeContext.get ().require_glib_version (2,
31)) {
+ if (sig.get_attribute ("Deprecated") != null) {
flags += "G_SIGNAL_DEPRECATED";
}
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index 9686898..b19d5c5 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -273,7 +273,7 @@ class Vala.Compiler {
}
int glib_major = 2;
- int glib_minor = 24;
+ int glib_minor = 32;
if (target_glib != null && target_glib.scanf ("%d.%d", out glib_major, out glib_minor) != 2) {
Report.error (null, "Invalid format for --target-glib");
}
diff --git a/configure.ac b/configure.ac
index d1da12d..5694610 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,7 +65,7 @@ AC_SUBST(COVERAGE_VALAFLAGS)
AC_SUBST(COVERAGE_CFLAGS)
AC_SUBST(COVERAGE_LIBS)
-GLIB_REQUIRED=2.24.0
+GLIB_REQUIRED=2.32.0
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED)
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index 4d664eb..befaa27 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -1601,12 +1601,8 @@ namespace GLib {
namespace AtomicInt {
public static int get ([CCode (type = "volatile gint *")] ref int atomic);
public static void set ([CCode (type = "volatile gint *")] ref int atomic, int newval);
-#if GLIB_2_30
[Version (since = "2.30")]
public static int add ([CCode (type = "volatile gint *")] ref int atomic, int val);
-#else
- public static void add ([CCode (type = "volatile gint *")] ref int atomic, int val);
-#endif
[Version (deprecated_since = "2.30", replacement = "add")]
public static int exchange_and_add ([CCode (type = "volatile gint *")] ref int atomic, int
val);
public static bool compare_and_exchange ([CCode (type = "volatile gint *")] ref int atomic,
int oldval, int newval);
@@ -1787,14 +1783,12 @@ namespace GLib {
public static bool remove (uint id);
public static bool remove_by_funcs_user_data (void* user_data);
public static bool remove_by_user_data (void* user_data);
-#if GLIB_2_32
[Version (since = "2.32")]
[CCode (cname = "G_SOURCE_CONTINUE")]
public static const bool CONTINUE;
[Version (since = "2.32")]
[CCode (cname = "G_SOURCE_REMOVE")]
public static const bool REMOVE;
-#endif
protected abstract bool prepare (out int timeout_);
protected abstract bool check ();
@@ -1858,18 +1852,14 @@ namespace GLib {
}
[Compact]
-#if GLIB_2_32
[Version (since = "2.32")]
[CCode (ref_function = "g_thread_ref", unref_function = "g_thread_unref")]
-#endif
public class Thread<T> {
-#if GLIB_2_32
[Version (since = "2.32")]
public Thread (string? name, owned ThreadFunc<T> func);
[Version (since = "2.32")]
[CCode (cname = "g_thread_try_new")]
public Thread.try (string? name, owned ThreadFunc<T> func) throws GLib.Error;
-#endif
public static bool supported ();
[Version (deprecated_since = "2.32", replacement = "new Thread<T> ()")]
[CCode (simple_generics = true)]
@@ -1892,16 +1882,9 @@ namespace GLib {
public static void usleep (ulong microseconds);
}
-#if GLIB_2_32
[Version (since = "2.32")]
[CCode (destroy_function = "g_mutex_clear", lvalue_access = false)]
public struct Mutex {
-#else
- [Compact]
- [Version (deprecated_since = "glib-2.32", replacement = "Mutex (with --target-glib=2.32)")]
- [CCode (free_function = "g_mutex_free")]
- public class Mutex {
-#endif
public Mutex ();
public void @lock ();
public bool trylock ();
@@ -1978,16 +1961,9 @@ namespace GLib {
public void set (void* data, DestroyNotify? destroy_func);
}
-#if GLIB_2_32
[Version (since = "2.32")]
[CCode (destroy_function = "g_cond_clear", lvalue_access = false)]
public struct Cond {
-#else
- [Compact]
- [CCode (free_function = "g_cond_free")]
- [Version (deprecated_since = "glib-2.32", replacement = "Cond (with --target-glib=2.32)")]
- public class Cond {
-#endif
public Cond ();
public void @signal ();
public void broadcast ();
@@ -3778,13 +3754,8 @@ namespace GLib {
public delegate bool RegexEvalCallback (MatchInfo match_info, StringBuilder result);
[Compact]
-#if GLIB_2_30
[Version (since = "2.30")]
[CCode (ref_function = "g_match_info_ref", unref_function = "g_match_info_unref", type_id =
"G_TYPE_MATCH_INFO")]
-#else
- [Version (since = "2.14")]
- [CCode (free_function = "g_match_info_free")]
-#endif
public class MatchInfo {
public unowned Regex get_regex ();
public unowned string get_string ();
@@ -3902,13 +3873,8 @@ namespace GLib {
}
[Compact]
-#if GLIB_2_32
[Version (since = "2.32")]
[CCode (ref_function = "g_key_file_ref", unref_function = "g_key_file_unref", type_id =
"G_TYPE_KEY_FILE")]
-#else
- [Version (since = "2.6")]
- [CCode (free_function = "g_key_file_free")]
-#endif
public class KeyFile {
public KeyFile ();
public void set_list_separator (char separator);
@@ -4097,11 +4063,7 @@ namespace GLib {
[Version (since = "2.16")]
public static int run ();
[Version (since = "2.16")]
-#if GLIB_2_26
public static void add_func (string testpath, TestFunc test_funcvoid);
-#else
- public static void add_func (string testpath, Callback test_funcvoid);
-#endif
[Version (since = "2.16")]
public static void add_data_func (string testpath, [CCode (delegate_target_pos = 1.9)]
TestDataFunc test_funcvoid);
public static string build_filename (GLib.Test.FileType file_type, params string[]
path_segments);
@@ -4167,11 +4129,7 @@ namespace GLib {
public class TestCase {
[Version (since = "2.16")]
[CCode (cname = "g_test_create_case")]
-#if GLIB_2_26
public TestCase (string test_name, [CCode (delegate_target_pos = 1.9)] TestFixtureFunc
data_setup, [CCode (delegate_target_pos = 1.9)] TestFixtureFunc data_func, [CCode (delegate_target_pos =
1.9)] TestFixtureFunc data_teardown, [CCode (pos = 1.8)] size_t data_size = 0);
-#else
- public TestCase (string test_name, [CCode (delegate_target_pos = 1.9, type = "void (*)
(void)")] TestFunc data_setup, [CCode (delegate_target_pos = 1.9, type = "void (*) (void)")] TestFunc
data_func, [CCode (delegate_target_pos = 1.9, type = "void (*) (void)")] TestFunc data_teardown, [CCode (pos
= 1.8)] size_t data_size = 0);
-#endif
}
[Compact]
@@ -4191,7 +4149,6 @@ namespace GLib {
public void add_suite (TestSuite test_suite);
}
-#if GLIB_2_26
[Version (since = "2.26")]
[CCode (has_target = false)]
public delegate void TestFunc ();
@@ -4199,12 +4156,6 @@ namespace GLib {
public delegate void TestDataFunc ();
[Version (since = "2.26")]
public delegate void TestFixtureFunc (void* fixture);
-#else
- [Version (deprecated_since = "2.26", replacement = "--target-glib 2.26")]
- public delegate void TestFunc (void* fixture);
- [Version (deprecated_since = "2.26", replacement = "--target-glib 2.26")]
- public delegate void TestDataFunc ();
-#endif
[CCode (cprefix = "G_TEST_SUBPROCESS_INHERIT_", has_type_id = false)]
[Flags]
@@ -4738,15 +4689,9 @@ namespace GLib {
[CCode (cname = "GPtrArray", cprefix = "g_ptr_array_", ref_function = "g_ptr_array_ref",
unref_function = "g_ptr_array_unref", type_id = "G_TYPE_PTR_ARRAY")]
[GIR (name = "PtrArray")]
public class GenericArray<G> {
-#if GLIB_2_30
[Version (since = "2.30")]
[CCode (cname = "g_ptr_array_new_full", simple_generics = true)]
public GenericArray (uint reserved_size = 0);
-#else
- [Version (since = "2.22")]
- [CCode (cname = "g_ptr_array_new_with_free_func", simple_generics = true)]
- public GenericArray ();
-#endif
public void add (owned G data);
public void foreach (GLib.Func<G> func);
[CCode (cname = "g_ptr_array_index")]
@@ -5345,7 +5290,6 @@ namespace GLib {
[CCode (array_length_type = "size_t")]
public string[] dup_bytestring_array ();
-#if GLIB_2_30
[Version (since = "2.30")]
public Variant.objv (string[] value);
[Version (since = "2.30")]
@@ -5358,7 +5302,6 @@ namespace GLib {
[Version (since = "2.30")]
[CCode (array_length_type = "size_t")]
public string[] dup_objv ();
-#endif
public Variant (string format, ...);
// note: the function changes its behaviour when end_ptr is null, so 'out char *' is wrong
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]