From: Wolfgang (Blub) Bumiller Date: Mon, 17 Dec 2012 17:36:27 +0000 (+0100) Subject: messages caused by -Warnings now show the -W flag X-Git-Tag: 0.1.9~74 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0befe5da1cf2ac0c5fed8ebceede46eeab085c14;p=xonotic%2Fgmqcc.git messages caused by -Warnings now show the -W flag --- diff --git a/con.c b/con.c index 7adf2a9..53fc308 100644 --- a/con.c +++ b/con.c @@ -321,7 +321,7 @@ int con_out(const char *fmt, ...) { * for reporting of file:line based on lexer context, These are used * heavily in the parser/ir/ast. */ -void con_vprintmsg(int level, const char *name, size_t line, const char *msgtype, const char *msg, va_list ap) { +void con_vprintmsg_c(int level, const char *name, size_t line, const char *msgtype, const char *msg, va_list ap, const char *condname) { /* color selection table */ static int sel[] = { CON_WHITE, @@ -340,7 +340,14 @@ void con_vprintmsg(int level, const char *name, size_t line, const char *msgtype print("%s:%d: %s: ", name, (int)line, msgtype); vprint(msg, ap); - print("\n"); + if (condname) + print(" [%s]\n", condname); + else + print("\n"); +} + +void con_vprintmsg(int level, const char *name, size_t line, const char *msgtype, const char *msg, va_list ap) { + con_vprintmsg_c(level, name, line, msgtype, msg, ap, NULL); } void con_printmsg(int level, const char *name, size_t line, const char *msgtype, const char *msg, ...) { @@ -382,10 +389,15 @@ void compile_error(lex_ctx ctx, const char *msg, ...) bool GMQCC_WARN vcompile_warning(lex_ctx ctx, int warntype, const char *fmt, va_list ap) { int lvl = LVL_WARNING; + char warn_name[1024]; if (!OPTS_WARN(warntype)) return false; + warn_name[0] = '-'; + warn_name[1] = 'W'; + (void)util_strtononcmd(opts_warn_list[warntype].name, warn_name+2, sizeof(warn_name)-2); + if (opts.werror) { ++compile_errors; lvl = LVL_ERROR; @@ -393,7 +405,7 @@ bool GMQCC_WARN vcompile_warning(lex_ctx ctx, int warntype, const char *fmt, va_ else ++compile_warnings; - con_vprintmsg(lvl, ctx.file, ctx.line, (opts.werror ? "error" : "warning"), fmt, ap); + con_vprintmsg_c(lvl, ctx.file, ctx.line, (opts.werror ? "error" : "warning"), fmt, ap, warn_name); return opts.werror; }