summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-05-16 01:24:34 -0700
committerOri Bernstein <ori@eigenstate.org>2015-05-16 01:24:34 -0700
commit9fa7e376e33410e78fda13897bf8e0914f201ddf (patch)
treec3e1e6f004c5ee96712770153a6a267592ecf223 /mbld
parent99bd0e314a7050f7ac4ae2c33207be08aa5c4507 (diff)
downloadmc-9fa7e376e33410e78fda13897bf8e0914f201ddf.tar.gz
Remove status arg from fatal.
We never set it to anything other than '1' anyways. There's no standardized error codes, so the exit status isn't really useful in any case.
Diffstat (limited to 'mbld')
-rw-r--r--mbld/build.myr18
-rw-r--r--mbld/deps.myr18
-rw-r--r--mbld/fsel.myr10
-rw-r--r--mbld/install.myr6
-rw-r--r--mbld/main.myr4
-rw-r--r--mbld/opts.myr4
-rw-r--r--mbld/parse.myr14
-rw-r--r--mbld/test.myr2
-rw-r--r--mbld/util.myr16
9 files changed, 46 insertions, 46 deletions
diff --git a/mbld/build.myr b/mbld/build.myr
index b7dfb0f..c154129 100644
--- a/mbld/build.myr
+++ b/mbld/build.myr
@@ -52,7 +52,7 @@ const build = {b, targ
| `std.Some (`Gen gt): runin(b, gt.cmd, gt.dir)
| `std.Some (`Cmd ct): runin(b, ct.cmd, ct.dir)
| `std.Some (`Man mt): /* nothing needed */
- | `std.None: std.fatal(1, "invalid target %s\n", targ)
+ | `std.None: std.fatal("invalid target %s\n", targ)
;;
-> true
}
@@ -70,7 +70,7 @@ const buildbin = {b, targ, addsrc
std.put("%s...\n", targ.name)
dg = myrdeps(b, targ, false, addsrc)
if !std.hthas(dg.deps, targ.name)
- std.fatal(1, "no input files for %s\n", targ.name)
+ std.fatal("no input files for %s\n", targ.name)
;;
if builddep(b, dg, targ.name, targ.incpath) || !freshlibs(targ, dg.libs)
src = std.htkeys(dg.sources)
@@ -92,7 +92,7 @@ const buildlib = {b, targ
archive = std.fmt("lib%s.a", lib)
dg = myrdeps(b, targ, false, false)
if !std.hthas(dg.deps, lib)
- std.fatal(1, "no target declared for %s\n", lib)
+ std.fatal("no target declared for %s\n", lib)
;;
u = builddep(b, dg, targ.name, targ.incpath)
l = builddep(b, dg, archive, targ.incpath)
@@ -155,7 +155,7 @@ const builddep = {b, dg, out, incs
;;
| `std.None:
if !std.fexists(d)
- std.fatal(1, "no input file %s\n", d)
+ std.fatal("no input file %s\n", d)
;;
;;
if !isfresh(d, out)
@@ -204,7 +204,7 @@ const compile = {src, incs
run(cmd)
std.slfree(o)
else
- std.fatal(1, "Unknown file type for %s\n", src)
+ std.fatal("Unknown file type for %s\n", src)
;;
}
@@ -277,7 +277,7 @@ const mergeuse = {dg, lib, files, incs
if std.hassuffix(f, ".myr")
cmd = std.slpush(cmd, srcswapsuffix(f, ".use"))
elif !std.hassuffix(f, ".s")
- std.fatal(1, "unknown file type for %s\n", f)
+ std.fatal("unknown file type for %s\n", f)
;;
;;
run(cmd)
@@ -311,7 +311,7 @@ const addlibs = {cmd, libgraph, incs
const visit = {cmd, head, g, lib, looped, marked, incs
if std.hthas(looped, lib)
- std.fatal(1, "cycle in library graph involving \"%s\"\n", lib)
+ std.fatal("cycle in library graph involving \"%s\"\n", lib)
elif std.hthas(marked, lib)
-> cmd
;;
@@ -331,7 +331,7 @@ const putlib = {cmd, head, lib, incs
else
match findlib(lib, incs)
| `std.None:
- std.fatal(1, "could not find library lib%s.a\n", lib)
+ std.fatal("could not find library lib%s.a\n", lib)
| `std.Some p:
-> std.slput(cmd, head, p)
;;
@@ -401,7 +401,7 @@ const isfresh = {src, dst
*/
match std.fmtime(src)
| `std.Some mt: srcmt = mt
- | `std.None: std.fatal(1, "could not stat %s\n", src)
+ | `std.None: std.fatal("could not stat %s\n", src)
;;
match std.fmtime(dst)
| `std.Some mt: dstmt = mt
diff --git a/mbld/deps.myr b/mbld/deps.myr
index d714d40..4321f2b 100644
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -144,7 +144,7 @@ const srcdeps = {b, ds, g, path, obj, usefile
;;
| `Local (l, lnum):
if !std.hassuffix(l, ".use")
- std.fatal(1, "%s:%s: local dependency \"%s\" should end with .use\n", path, lnum, l)
+ std.fatal("%s:%s: local dependency \"%s\" should end with .use\n", path, lnum, l)
;;
if obj.len != 0
pushdep(g, l, obj)
@@ -177,7 +177,7 @@ const addusedep = {b, ds, g, f, usefile, line
if ds.addsrc
std.htput(g.sources, src, true)
elif !std.hthas(g.input, usefile)
- std.fatal(1, "%s:%i: source file %s not listed in bldfile\n", f, line, src)
+ std.fatal("%s:%i: source file %s not listed in bldfile\n", f, line, src)
;;
;;
pushdep(g, src, usefile)
@@ -194,12 +194,12 @@ const getdeps = {b, ds, path
if !std.fexists(path)
match std.htget(b.gensrc, path)
| `std.Some gt: run(gt.cmd)
- | `std.None: std.fatal(1, "no input file %s\n", path)
+ | `std.None: std.fatal("no input file %s\n", path)
;;
;;
match bio.open(path, bio.Rd)
| `std.Some fd: f = fd
- | `std.None: std.fatal(1, "could not open %s\n", path)
+ | `std.None: std.fatal("could not open %s\n", path)
;;
lnum = 0
@@ -230,14 +230,14 @@ const scrapelibs = {dg, lib, incs
f = openlib(lib, incs)
match bio.getc(f)
| `std.Some 'U': /* nothing */
- | `std.Some _: std.fatal(1, "library %s: corrupt or invalid usefile\n", lib)
- | `std.None: std.fatal(1, "library %s: could not read usefile\n", lib)
+ | `std.Some _: std.fatal("library %s: corrupt or invalid usefile\n", lib)
+ | `std.None: std.fatal("library %s: could not read usefile\n", lib)
;;
match bio.getbe32(f)
| `std.Some 1: /* nothing: version matches. */
| `std.Some 0: std.fput(1, "library %s: warning: old usefile version\n", lib)
- | `std.Some _: std.fatal(1, "library %s: usefile version unknown\n", lib)
- | `std.None: std.fatal(1, "library %s: corrutpt or invalid usefile\n", lib)
+ | `std.Some _: std.fatal("library %s: usefile version unknown\n", lib)
+ | `std.None: std.fatal("library %s: corrutpt or invalid usefile\n", lib)
;;
std.slfree(rdstr(f))
done = false
@@ -276,7 +276,7 @@ const openlib = {lib, incs
| `std.None:
/* nothing */
;;
- std.fatal(1, "could not find library %s.\n", lib)
+ std.fatal("could not find library %s.\n", lib)
}
const depname = {deps, ln, lnum
diff --git a/mbld/fsel.myr b/mbld/fsel.myr
index bdd0103..e40d16c 100644
--- a/mbld/fsel.myr
+++ b/mbld/fsel.myr
@@ -35,11 +35,11 @@ const fseladd = {fsel, f
basename = f[:i]
match std.strrfind(f[i+1:], ".")
| `std.Some j: attrs = f[i+1:][:j]
- | `std.None: std.fatal(1, "unrecognized type for file %s\n", f)
+ | `std.None: std.fatal("unrecognized type for file %s\n", f)
;;
| `std.None:
match std.strrfind(f, ".")
- | `std.None: std.fatal(1, "unrecognized type for file %s\n", f)
+ | `std.None: std.fatal("unrecognized type for file %s\n", f)
| `std.Some i:
basename = f[:i]
attrs = ""
@@ -72,7 +72,7 @@ const fselfin = {fsel
for k in keys
nmatch = std.htgetv(fsel._match, k, -1)
if nmatch == -1
- std.fatal(1, "no applicable file for '%s'\n", k)
+ std.fatal("no applicable file for '%s'\n", k)
;;
ret = std.slpush(ret, std.htgetv(fsel._best, k, ""))
;;
@@ -89,7 +89,7 @@ const addsysattrs = {sa
| "osx": attrs = ["osx", "posixy"][:]
| "linux": attrs = ["linux", "posixy"][:]
| "plan9": attrs = ["plan9"][:]
- | unknown: std.fatal(1, "unknown system \"%s\"\n", unknown)
+ | unknown: std.fatal("unknown system \"%s\"\n", unknown)
;;
for a in attrs
std.htput(sa, a, true)
@@ -97,7 +97,7 @@ const addsysattrs = {sa
match opt_arch
| "x64": attrs = ["x64"][:]
- | unknown: std.fatal(1, "unknown arch %s\n", unknown)
+ | unknown: std.fatal("unknown arch %s\n", unknown)
;;
for a in attrs
std.htput(sa, a, true)
diff --git a/mbld/install.myr b/mbld/install.myr
index 0cf6d1f..8d6fbeb 100644
--- a/mbld/install.myr
+++ b/mbld/install.myr
@@ -68,7 +68,7 @@ const movefile = {b, rm, dir, file, prefix, perm
std.put("\t%s => %s\n", file, path)
std.remove(path)
match std.slurp(file)
- | `std.Fail m: std.fatal(1, "Could not open %s for reading\n", file)
+ | `std.Fail m: std.fatal("Could not open %s for reading\n", file)
| `std.Ok buf:
if !std.blat(path, buf, perm)
std.put("Could not write %s\n", file)
@@ -84,11 +84,11 @@ const moveman = {b, rm, dir, man
match std.strrfind(man, ".")
| `std.None:
- std.fatal(1, "manpage %s has no section\n", man)
+ std.fatal("manpage %s has no section\n", man)
| `std.Some s:
sect = s + 1
if s + 1 == man.len
- std.fatal(1, "manpage %s missing suffix\n", man)
+ std.fatal("manpage %s missing suffix\n", man)
;;
;;
diff --git a/mbld/main.myr b/mbld/main.myr
index 7fbf996..af1517a 100644
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -75,7 +75,7 @@ const main = {args : byte[:][:]
match regex.compile("^\\s*use\\s+((\\<\\S+\\>)|(\"(\\S+)\")).*")
| `std.Ok re: bld.usepat = re
- | `std.Fail f: std.fatal(1, "Failed to compile use pattern regex\n")
+ | `std.Fail f: std.fatal("Failed to compile use pattern regex\n")
;;
b = mkbuild()
@@ -133,7 +133,7 @@ const mkbuild = {
const findproj = {b, bldfile
if !findbase(b, bldfile) || !std.chdir(b.basedir)
- std.fatal(1, "could not find %s\n", bldfile)
+ std.fatal("could not find %s\n", bldfile)
;;
bld.setdir(b, "")
}
diff --git a/mbld/opts.myr b/mbld/opts.myr
index bef9aca..7c4f0f2 100644
--- a/mbld/opts.myr
+++ b/mbld/opts.myr
@@ -56,13 +56,13 @@ const initopts = {
| "Darwin": opt_sys = "osx"
| "FreeBSD": opt_sys = "freebsd"
| "Plan9": opt_sys = "plan9"
- | unknown: std.fatal(1, "unknown system \"%s\"\n", unknown)
+ | unknown: std.fatal("unknown system \"%s\"\n", unknown)
;;
match si.arch
| "x86_64": opt_arch = "x64"
| "amd64": opt_arch = "x64"
- | unknown: std.fatal(1, "unknown architecture \"%s\"\n", unknown)
+ | unknown: std.fatal("unknown architecture \"%s\"\n", unknown)
;;
opt_incpaths = [][:]
diff --git a/mbld/parse.myr b/mbld/parse.myr
index 7bd10d7..e572cd3 100644
--- a/mbld/parse.myr
+++ b/mbld/parse.myr
@@ -59,7 +59,7 @@ const loadall = {b, path, dir
loadall(b, subproj, subpath)
b.basedir = curbase
else
- std.fatal(1, "could not open %s or %s \n", subbld, subproj)
+ std.fatal("could not open %s or %s \n", subbld, subproj)
;;
std.slfree(subbld)
std.slfree(subproj)
@@ -91,7 +91,7 @@ const sortdeps = {b
const visit = {all, b, targ, looped, marked
if std.hthas(looped, targ)
- std.fatal(1, "cycle in build depgraph involving %s\n", targ)
+ std.fatal("cycle in build depgraph involving %s\n", targ)
elif std.hthas(marked, targ)
-> all
;;
@@ -109,7 +109,7 @@ const getdeps = {targ
match targ
| `Bin t: -> t.libdeps
| `Lib t: -> t.libdeps
- | _: std.fatal(1, "depending on non-library target")
+ | _: std.fatal("depending on non-library target")
;;
}
@@ -123,7 +123,7 @@ const mkparser = {path, dir, basedir
p.basedir = std.sldup(basedir)
match std.slurp(path)
| `std.Ok d: p.data = d
- | `std.Fail _: std.fatal(1, "could not open '%s'\n", path)
+ | `std.Fail _: std.fatal("could not open '%s'\n", path)
;;
p.rest = p.data
-> p
@@ -353,7 +353,7 @@ const myrtarget = {p, targ
| ("noinst", ""): inst = false
| ("sys", tags): systags = std.slpush(systags, tags)
| (invalid, _):
- std.fatal(1, "%s: got invalid attr '%s'\n", targ, invalid)
+ std.fatal("%s: got invalid attr '%s'\n", targ, invalid)
;;
;;
for inc in bld.opt_incpaths
@@ -614,7 +614,7 @@ const libpath = {p, libpath
targ = std.fmt("%s:%s", p.fdir, lib)
| `std.Some idx:
if idx == libpath.len
- std.fatal(1, "libdep %s missing library after ':'\n")
+ std.fatal("libdep %s missing library after ':'\n")
;;
/* absolute path */
if std.hasprefix(libpath, "@/") || std.hasprefix(libpath, "@:")
@@ -627,7 +627,7 @@ const libpath = {p, libpath
lib = std.sldup(libpath[idx+1:])
targ = std.pathcat(p.fdir, libpath)
if std.hasprefix(targ, "../")
- std.fatal(1, "library %s outside of project\n", libpath)
+ std.fatal("library %s outside of project\n", libpath)
;;
;;
;;
diff --git a/mbld/test.myr b/mbld/test.myr
index aebf27e..ae603a0 100644
--- a/mbld/test.myr
+++ b/mbld/test.myr
@@ -125,7 +125,7 @@ const runtest = {bin
log = std.strcat(bin, ".log")
match std.spork([bin][:])
| `std.Fail m:
- std.fatal(1, "unable to run test: %s\n", m)
+ std.fatal("unable to run test: %s\n", m)
| `std.Ok (pid, infd, outfd):
match std.fslurp(outfd)
| `std.Ok "": /* empty output; nothing to log */
diff --git a/mbld/util.myr b/mbld/util.myr
index 29e325c..9e11a35 100644
--- a/mbld/util.myr
+++ b/mbld/util.myr
@@ -20,17 +20,17 @@ const run = {cmd
printcmd(cmd)
pid = std.fork()
if pid == -1
- std.fatal(1, "could not fork command\n")
+ std.fatal("could not fork command\n")
elif pid == 0
if std.execvp(cmd[0], cmd) < 0
- std.fatal(1, "failed to exec %s\n", cmd[0])
+ std.fatal("failed to exec %s\n", cmd[0])
;;
else
match std.wait(pid)
| `std.Wsuccess: /* nothing */
- | `std.Wfailure: std.fatal(1, "FAIL: \"%s\"\n", std.strjoin(cmd, " "))
- | `std.Wsignalled: std.fatal(1, "CRASH: \"%s\"\n", std.strjoin(cmd, " "))
- | `std.Waiterror: std.fatal(1, "WAT: \"%s\"\n", std.strjoin(cmd, " "))
+ | `std.Wfailure: std.fatal("FAIL: \"%s\"\n", std.strjoin(cmd, " "))
+ | `std.Wsignalled: std.fatal("CRASH: \"%s\"\n", std.strjoin(cmd, " "))
+ | `std.Waiterror: std.fatal("WAT: \"%s\"\n", std.strjoin(cmd, " "))
;;
;;
}
@@ -85,7 +85,7 @@ const srcswapsuffix = {src, new
elif std.sleq(suff, ".s")
-> std.strcat(base, new)
else
- std.fatal(1, "unrecognized source %s\n", src)
+ std.fatal("unrecognized source %s\n", src)
;;
}
@@ -98,7 +98,7 @@ const strlistfree = {sl
const gettarg = {tab, n
match std.htget(tab, n)
- | `std.None: std.fatal(1, "internal: nonexistent %s\n", n)
+ | `std.None: std.fatal("internal: nonexistent %s\n", n)
| `std.Some t: -> t
;;
}
@@ -114,7 +114,7 @@ const setdir = {b, dir
std.put("Entering directory '%s'\n", dir)
if !std.chdir(p)
- std.fatal(1, "could not cd into %s\n", p)
+ std.fatal("could not cd into %s\n", p)
;;
b.curdir = dir
std.slfree(p)