From f50d0b4488889a2b0a5993c083fb4ccdb900610c Mon Sep 17 00:00:00 2001 From: bellard Date: Wed, 19 Dec 2001 23:01:51 +0000 Subject: [PATCH] error() fixes --- tcc.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tcc.c b/tcc.c index 9ff67a83..91a70f32 100644 --- a/tcc.c +++ b/tcc.c @@ -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++;