shithub: mc

Download patch

ref: 8e8d3f3d6f01046782529f853032daca2ab1976e
parent: 35c02af69dcc70507e639209eeea181e8e088366
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Sep 27 06:11:39 EDT 2015

Bump ABI version. Also, improve errors about it.

    We now say which version we got, which version we expected,
    and only warn in mbld. This means that we can probably build
    newer usefiles with older mblds.

--- a/6/simp.c
+++ b/6/simp.c
@@ -1322,7 +1322,7 @@
 
 static Node *capture(Simp *s, Node *n, Node *dst)
 {
-    Node *fn, *t, *f, *e, *val, *dcl, *fp;
+    Node *fn, *t, *f, *e, *val, *dcl, *fp, *envsz;
     size_t nenv, nenvt, off, i;
     Type **envt;
     Node **env;
@@ -1365,6 +1365,9 @@
             off += size(env[i]);
         }
         free(env);
+        envsz = mkintlit(n->loc, off);
+        envsz->expr.type = tyintptr;
+        assignat(s, e, 0, envsz);
         assignat(s, fp, 0, e);
     }
     assignat(s, fp, Ptrsz, f);
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -14,7 +14,8 @@
 	var usepat	: regex.regex#
 ;;
 
-const Abiversion = 6
+const Abiversion = 7
+
 var usepat	: regex.regex#
 
 type dep = union
@@ -238,9 +239,9 @@
 	| `std.Some Abiversion:	/* nothing: version matches. */
 	| `std.Some v:	
 		if v < Abiversion
-			std.fput(1, "library {}: warning: old abi version\n", lib)
+			std.fput(1, "library {}: warning: old abi version {}\n", lib, v)
 		else
-			std.fatal("library {}: usefile version unknown\n", lib)
+			std.fput(1, "library {}: usefile version {} unknown\n", lib, v)
 		;;
 	| `std.None:	std.fatal("library {}: corrutpt or invalid usefile\n", lib)
 	;;
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -4,7 +4,7 @@
 #	define FATAL
 #endif
 
-#define Abiversion 6
+#define Abiversion 7
 
 typedef uint8_t         byte;
 typedef unsigned int    uint;
--- a/parse/use.c
+++ b/parse/use.c
@@ -802,6 +802,7 @@
 {
     intptr_t tid;
     size_t i;
+    int v;
     char *pkg;
     Node *dcl, *impl, *init;
     Stab *s;
@@ -815,8 +816,9 @@
         tydedup = mkht(tyhash, tyeq);
     if (fgetc(f) != 'U')
         return 0;
-    if (rdint(f) != Abiversion) {
-        fprintf(stderr, "%s: abi version mismatch\n", path);
+    v = rdint(f);
+    if (v != Abiversion) {
+        fprintf(stderr, "%s: abi version %d, expected %d\n", path, v, Abiversion);
         return 0;
     }
     pkg = rdstr(f);