]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Perform runtime version check of libvala
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 8 Jul 2020 09:42:02 +0000 (11:42 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 5 Nov 2020 18:38:32 +0000 (19:38 +0100)
Fixes https://gitlab.gnome.org/GNOME/vala/issues/88

codegen/valaccodebasemodule.vala
compiler/valacompiler.vala
valadoc/valadoc.vala
vapigen/valavapigen.vala

index ad292a77792b777a83df24ebe7701594e0574dcb..9a801e36986d26fe98ccff3d133d6a0643a548de 100644 (file)
@@ -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");
index e5a6a21d11c5d5aaa87a8d1438d6044b1b84ac27..4cc7b2967a136b929b0fbe51f5a9e7cbeb360ffb 100644 (file)
@@ -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);
                }
index 175bbdd9d7cd7f45d9a67100c72205355a7f5133..68d8b8fa4ace1ff9beed13c9c0773bad55d76842 100644 (file)
@@ -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);
index 7eb4fc0444d40962b1bdca67dd37cb61dbfd18fa..7bd37be85f09480017b19d62c19752dff1da0b80 100644 (file)
@@ -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);