shithub: riscv

Download patch

ref: f51aa49bb0d93e23cd290c8f6335ff0fa6e9ea73
parent: 784d811c3ac3f57cd78acf6757d65f61a0dcfddd
author: cinap_lenrek <[email protected]>
date: Sat Feb 11 08:05:34 EST 2012

acid: fix format string bugs and comment line counting (from eriks patch/acid-nits patch)

--- a/sys/src/cmd/acid/acid.h
+++ b/sys/src/cmd/acid/acid.h
@@ -243,6 +243,10 @@
 int	yylex(void);
 int	yyparse(void);
 
+#pragma	varargck	argpos	error		1
+#pragma	varargck	argpos	fatal		1
+#pragma	varargck	argpos	yyerror		1
+
 enum
 {
 	ONAME,
--- a/sys/src/cmd/acid/expr.c
+++ b/sys/src/cmd/acid/expr.c
@@ -537,7 +537,7 @@
 	res->op = OCONST;
 	res->type = TINT;
 	if(l.type != TINT || r.type != TINT)
-		error("bad expr type %");
+		error("bad expr type %%");
 	res->ival = l.ival%r.ival;
 }
 
--- a/sys/src/cmd/acid/lex.c
+++ b/sys/src/cmd/acid/lex.c
@@ -329,6 +329,14 @@
 	case '\t':
 		goto loop;
 
+	case '/':
+		c = lexc();
+		if(c != '/'){
+			unlexc(c);
+			return '/';
+		}
+		eatnl();
+
 	case '\n':
 		line++;
 		if(interactive == 0)
@@ -390,15 +398,6 @@
 			return Tinc;
 		unlexc(c);
 		return '+';
-
-	case '/':
-		c = lexc();
-		if(c == '/') {
-			eatnl();
-			goto loop;
-		}
-		unlexc(c);
-		return '/';
 
 	case '\'':
 		c = lexc();
--- a/sys/src/cmd/acid/main.c
+++ b/sys/src/cmd/acid/main.c
@@ -162,7 +162,7 @@
 			text = open(aout, OREAD);
 
 		if(text < 0)
-			error("%s: can't open %s: %r\n", argv0, aout);
+			error("%s: can't open %s: %r", argv0, aout);
 		readtext(aout);
 	}
 	if(pid)					/* pid given */
@@ -273,7 +273,7 @@
 		print("%s: (error) loadmap: cannot make symbol map\n", argv0);
 
 	if(syminit(text, &fhdr) < 0) {
-		print("%s: (error) syminit: %r\n", argv0);
+		print("%s: (error) syminit: %r", argv0);
 		return;
 	}
 	print("%s:%s\n", s, fhdr.name);
--- a/sys/src/cmd/acid/proc.c
+++ b/sys/src/cmd/acid/proc.c
@@ -87,7 +87,7 @@
 		open("/dev/cons", OWRITE);
 		open("/dev/cons", OWRITE);
 		exec(argv[0], argv);
-		fatal("new: exec %s: %r");
+		fatal("new: exec %s: %r", argv[0]);
 	default:
 		install(pid);
 		msg(pid, "waitstop");
--- a/sys/src/cmd/acid/util.c
+++ b/sys/src/cmd/acid/util.c
@@ -203,7 +203,7 @@
 		break;
 	}
 	if(ret < 0)
-		error("can't get register %s: %r\n", reg);
+		error("can't get register %s: %r", reg);
 	return v;
 }