summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2020-07-08 11:42:02 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2020-11-05 19:38:32 +0100
commitdbe3e730690176d96078abf0ca1e9756c8d903b2 (patch)
tree797220b39c82d6d3c8a26d638ed8347fcc23c172
parent3c9f1cb62c48623c10543dad1325f797385366b7 (diff)
downloadvala-dbe3e730690176d96078abf0ca1e9756c8d903b2.tar.gz
Perform runtime version check of libvala
Fixes https://gitlab.gnome.org/GNOME/vala/issues/88
-rw-r--r--codegen/valaccodebasemodule.vala4
-rw-r--r--compiler/valacompiler.vala5
-rw-r--r--valadoc/valadoc.vala5
-rw-r--r--vapigen/valavapigen.vala6
4 files changed, 20 insertions, 0 deletions
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index ad292a777..9a801e369 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -373,6 +373,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
public static int ccode_attribute_cache_index = CodeNode.get_attribute_cache_index ();
protected CCodeBaseModule () {
+ if (Vala.get_build_version () != Vala.BUILD_VERSION) {
+ Report.error (null, "Integrity check failed (libvala %s doesn't match ccodegen %s)".printf (Vala.get_build_version (), Vala.BUILD_VERSION));
+ }
+
predefined_marshal_set = new HashSet<string> (str_hash, str_equal);
predefined_marshal_set.add ("VOID:VOID");
predefined_marshal_set.add ("VOID:BOOLEAN");
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index e5a6a21d1..4cc7b2967 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -622,6 +622,11 @@ class Vala.Compiler {
// initialize locale
Intl.setlocale (LocaleCategory.ALL, "");
+ if (Vala.get_build_version () != Vala.BUILD_VERSION) {
+ stderr.printf ("Integrity check failed (libvala %s doesn't match valac %s)\n", Vala.get_build_version (), Vala.BUILD_VERSION);
+ return 1;
+ }
+
if (Path.get_basename (args[0]) == "vala" || Path.get_basename (args[0]) == "vala" + Config.PACKAGE_SUFFIX) {
return run_source (args);
}
diff --git a/valadoc/valadoc.vala b/valadoc/valadoc.vala
index 175bbdd9d..68d8b8fa4 100644
--- a/valadoc/valadoc.vala
+++ b/valadoc/valadoc.vala
@@ -398,6 +398,11 @@ public class ValaDoc : Object {
static int main (string[] args) {
Intl.setlocale (LocaleCategory.ALL, "");
+ if (Vala.get_build_version () != Vala.BUILD_VERSION) {
+ stderr.printf ("Integrity check failed (libvala %s doesn't match valadoc %s)\n", Vala.get_build_version (), Vala.BUILD_VERSION);
+ return 1;
+ }
+
try {
var opt_context = new OptionContext ("- Vala Documentation Tool");
opt_context.set_help_enabled (true);
diff --git a/vapigen/valavapigen.vala b/vapigen/valavapigen.vala
index 7eb4fc044..7bd37be85 100644
--- a/vapigen/valavapigen.vala
+++ b/vapigen/valavapigen.vala
@@ -211,6 +211,12 @@ class Vala.VAPIGen {
static int main (string[] args) {
Intl.setlocale (LocaleCategory.ALL, "");
+
+ if (Vala.get_build_version () != Vala.BUILD_VERSION) {
+ stderr.printf ("Integrity check failed (libvala %s doesn't match vapigen %s)\n", Vala.get_build_version (), Vala.BUILD_VERSION);
+ return 1;
+ }
+
try {
var opt_context = new OptionContext ("- Vala API Generator");
opt_context.set_help_enabled (true);