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

This commit is contained in:
cinap_lenrek 2012-02-11 13:05:34 +01:00
parent 784d811c3a
commit f51aa49bb0
6 changed files with 17 additions and 14 deletions

View file

@ -243,6 +243,10 @@ void yyerror(char*, ...);
int yylex(void);
int yyparse(void);
#pragma varargck argpos error 1
#pragma varargck argpos fatal 1
#pragma varargck argpos yyerror 1
enum
{
ONAME,

View file

@ -537,7 +537,7 @@ omod(Node *n, Node *res)
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;
}

View file

@ -329,6 +329,14 @@ loop:
case '\t':
goto loop;
case '/':
c = lexc();
if(c != '/'){
unlexc(c);
return '/';
}
eatnl();
case '\n':
line++;
if(interactive == 0)
@ -391,15 +399,6 @@ loop:
unlexc(c);
return '+';
case '/':
c = lexc();
if(c == '/') {
eatnl();
goto loop;
}
unlexc(c);
return '/';
case '\'':
c = lexc();
if(c == '\\')

View file

@ -162,7 +162,7 @@ attachfiles(char *aout, int pid)
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 @@ readtext(char *s)
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);

View file

@ -87,7 +87,7 @@ nproc(char **argv)
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");

View file

@ -203,7 +203,7 @@ rget(Map *map, char *reg)
break;
}
if(ret < 0)
error("can't get register %s: %r\n", reg);
error("can't get register %s: %r", reg);
return v;
}