]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parser.c
Improved parameter handling of qcvm a little, added --version and --help
[xonotic/gmqcc.git] / parser.c
index 4a1933bed1111ffdc28b077738bba9386e415989..ee4718519ece62aae2edf5b6c65ab6b66320fd9e 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -124,40 +124,22 @@ static void parseerror(parser_t *parser, const char *fmt, ...)
 /* returns true if it counts as an error */
 static bool GMQCC_WARN parsewarning(parser_t *parser, int warntype, const char *fmt, ...)
 {
+    bool    r;
        va_list ap;
-       int lvl = LVL_WARNING;
-
-    if (!OPTS_WARN(warntype))
-        return false;
-
-    if (opts.werror) {
-           parser->errors++;
-           lvl = LVL_ERROR;
-       }
-
        va_start(ap, fmt);
-    con_vprintmsg(lvl, parser->lex->tok.ctx.file, parser->lex->tok.ctx.line, (opts.werror ? "error" : "warning"), fmt, ap);
+       r = vcompile_warning(parser->lex->tok.ctx, warntype, fmt, ap);
        va_end(ap);
-
-       return opts.werror;
+       return r;
 }
 
 static bool GMQCC_WARN genwarning(lex_ctx ctx, int warntype, const char *fmt, ...)
 {
+    bool    r;
        va_list ap;
-       int lvl = LVL_WARNING;
-
-    if (!OPTS_WARN(warntype))
-        return false;
-
-    if (opts.werror)
-           lvl = LVL_ERROR;
-
        va_start(ap, fmt);
-    con_vprintmsg(lvl, ctx.file, ctx.line, (opts.werror ? "error" : "warning"), fmt, ap);
+       r = vcompile_warning(ctx, warntype, fmt, ap);
        va_end(ap);
-
-       return opts.werror;
+       return r;
 }
 
 /**********************************************************************
@@ -2479,7 +2461,7 @@ static bool parse_pragma_do(parser_t *parser)
     }
     else
     {
-        parseerror(parser, "unrecognized hash-keyword: `%s`", parser_tokval(parser));
+        (void)!parsewarning(parser, WARN_UNKNOWN_PRAGMAS, "ignoring #pragma %s", parser_tokval(parser));
         return false;
     }