error() fixes

tcc-xref
bellard 2001-12-19 23:01:51 +00:00
parent b0b2d5d2e9
commit f50d0b4488
1 changed files with 11 additions and 5 deletions

16
tcc.c
View File

@ -464,10 +464,16 @@ void expect(const char *msg)
error("%s expected", msg);
}
void warning(const char *msg)
void warning(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
printline();
fprintf(stderr, "warning: %s\n", msg);
fprintf(stderr, "warning: ");
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}
void skip(int c)
@ -2864,7 +2870,7 @@ int ist(void)
next();
basic_type1:
if ((t & VT_BTYPE) != 0)
error("too many basic types %x", t);
error("too many basic types");
t |= u;
break;
case TOK_VOID:
@ -3418,7 +3424,7 @@ void unary(void)
}
#endif
if (sa)
error("too few arguments to function %x", sa->t);
error("too few arguments to function");
skip(')');
gfunc_call(&gf);
/* return value */
@ -4157,7 +4163,7 @@ int decl_initializer_alloc(int t, int has_init)
level = 0;
while (level > 0 || (tok != ',' && tok != ';')) {
if (tok < 0)
error("unexpect end of file in initializer");
error("unexpected end of file in initializer");
tok_add2(&init_str, &init_len, tok, &tokc);
if (tok == '{')
level++;