shithub: mc

Download patch

ref: af33941e4a225c62914d5929983fb2c93176f14c
parent: 3d69958a6f62b635c39a6cd958bcbf8877fe6e8f
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Sep 24 07:35:27 EDT 2014

Silence debug logs.

--- a/config.myr
+++ b/config.myr
@@ -1,4 +1,4 @@
 pkg config = 
-const Instroot = "/usr/local/google/home/orib/bin"
-const Sys = "Linux"
+const Instroot = "/Users/orib/bin"
+const Sys = "OSX"
 ;;
--- a/deps.myr
+++ b/deps.myr
@@ -63,6 +63,9 @@
 const dumpgraph = {dg
 	var keys
 
+	if !opt_debug
+		->
+	;;
 	keys = std.htkeys(dg.deps)
 	std.put("digraph dg {\n")
 	for k in keys
@@ -77,10 +80,10 @@
 	var deps
 
 	if std.hthas(done, path)
-		std.put("already know about %s\n", path)
 		->
 	elif std.htgetv(seen, path, false)
-		std.fatal(1, "dependency loop involving %s\n", path)
+		std.fput(1, "dependency loop involving %s\n", path)
+		std.exit(1)
 	;;
 	deps = getdeps(path)
 	std.htput(seen, path, true)
@@ -104,10 +107,11 @@
 	var src
 
 	if std.hthas(done, usefile)
-		std.put("already know about %s\n", usefile)
+		if opt_debug
+			std.put("already loaded deps for %s\n", usefile)
+		;;
 		->
 	;;
-	std.put("adding use dep for %s\n", usefile)
 	src = swapsuffix(usefile, ".use", ".myr")
 	pushdep(g, src, usefile)
 	srcdeps(g, seen, done, src)
@@ -210,7 +214,9 @@
 const pushdep = {dg, dst, src
 	var sl
 
-	std.put("%s ==> %s\n", src, dst)
+	if opt_debug
+		std.put("%s ==> %s\n", src, dst)
+	;;
 	sl = std.htgetv(dg.deps, src, [][:])
 	sl = std.slpush(sl, dst)
 	std.htput(dg.deps, src, sl)
--- a/main.myr
+++ b/main.myr
@@ -28,6 +28,7 @@
 				bld.opt_runtime = arg
 			;;
 		| ('R', arg): bld.opt_instroot = arg
+		| ('d', arg): bld.opt_debug = true
 		/*
 		internal undocumented args; used by compiler suite for
 		building with an uninstalled compiler.
--- a/opts.myr
+++ b/opts.myr
@@ -13,6 +13,7 @@
 	var opt_instroot	: byte[:]
 	var opt_destdir	: byte[:]
 	var opt_bldfile	: byte[:]
+	var opt_debug	: bool
 
 	/* undocumented/unsupported opts */
 	var opt_mc	: byte[:]
@@ -33,6 +34,7 @@
 var opt_incpaths	/* FIXME: taking a constant slice is a nonconstant initializer */
 var opt_instroot	= ""
 var opt_destdir	= ""
+var opt_debug	= false
 var opt_bldfile = "bldfile"
 var opt_mc	= "6m"
 var opt_as	= "as"
@@ -43,7 +45,9 @@
 const initopts = {
 	var un
 
-	std.uname(&un)
+	if std.uname(&un) < 0
+		std.fatal(1, "unable to determine host information (uname)\n")
+	;;
 	match cstr2myr(un.system[:])
 	| "Linux":	opt_sys = "linux"
 	| "Darwin":	opt_sys = "osx"