mirror of
https://github.com/mirror/tinycc.git
synced 2025-04-01 12:30:08 +08:00
error() fixes
This commit is contained in:
parent
b0b2d5d2e9
commit
f50d0b4488
16
tcc.c
16
tcc.c
@ -464,10 +464,16 @@ void expect(const char *msg)
|
|||||||
error("%s expected", msg);
|
error("%s expected", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void warning(const char *msg)
|
void warning(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
printline();
|
printline();
|
||||||
fprintf(stderr, "warning: %s\n", msg);
|
fprintf(stderr, "warning: ");
|
||||||
|
vfprintf(stderr, fmt, ap);
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void skip(int c)
|
void skip(int c)
|
||||||
@ -2864,7 +2870,7 @@ int ist(void)
|
|||||||
next();
|
next();
|
||||||
basic_type1:
|
basic_type1:
|
||||||
if ((t & VT_BTYPE) != 0)
|
if ((t & VT_BTYPE) != 0)
|
||||||
error("too many basic types %x", t);
|
error("too many basic types");
|
||||||
t |= u;
|
t |= u;
|
||||||
break;
|
break;
|
||||||
case TOK_VOID:
|
case TOK_VOID:
|
||||||
@ -3418,7 +3424,7 @@ void unary(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (sa)
|
if (sa)
|
||||||
error("too few arguments to function %x", sa->t);
|
error("too few arguments to function");
|
||||||
skip(')');
|
skip(')');
|
||||||
gfunc_call(&gf);
|
gfunc_call(&gf);
|
||||||
/* return value */
|
/* return value */
|
||||||
@ -4157,7 +4163,7 @@ int decl_initializer_alloc(int t, int has_init)
|
|||||||
level = 0;
|
level = 0;
|
||||||
while (level > 0 || (tok != ',' && tok != ';')) {
|
while (level > 0 || (tok != ',' && tok != ';')) {
|
||||||
if (tok < 0)
|
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);
|
tok_add2(&init_str, &init_len, tok, &tokc);
|
||||||
if (tok == '{')
|
if (tok == '{')
|
||||||
level++;
|
level++;
|
||||||
|
Loading…
Reference in New Issue
Block a user