scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit c61a84d918f0978ebb8e1abdba5e24aa1a97f916
parent f2eaad8b7bfd3d9bd01a032b9ee1c5b2ab630207
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue,  8 Apr 2014 22:08:11 +0200

Emit warnings only when the flag is not zero

This change avoid the warning while we are developping.
Maybe could be a good idea later to remove it.

Diffstat:
Mcc.h | 2+-
Merror.c | 8+++++---
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/cc.h b/cc.h @@ -20,7 +20,7 @@ extern struct user_opt options; extern void error(const char *fmt, ...); extern void die(const char *fmt, ...); -extern void warn(char flag, const char *fmt, ...); +extern void warn(signed char flag, const char *fmt, ...); extern void *xmalloc(size_t size); extern void *xcalloc(size_t nmemb, size_t size); extern char *xstrdup(const char *s); diff --git a/error.c b/error.c @@ -11,18 +11,20 @@ extern unsigned columnum; extern const char *filename; static void -warn_helper(char flag, const char *fmt, va_list va) +warn_helper(signed char flag, const char *fmt, va_list va) { + if (!flag) + return; fprintf(stderr, "%s:%s:%u:%u: ", (!flag) ? "warning" : "error", filename, linenum, columnum); vfprintf(stderr, fmt, va); putc('\n', stderr); - if (flag) + if (flag < 0) exit(EXIT_FAILURE); /* TODO: uhmmmm */ } void -warn(char flag, const char *fmt, ...) +warn(signed char flag, const char *fmt, ...) { va_list va; va_start(va, fmt);