From 6d1671950a1a05809d63d6a5de1f550016ffe3c8 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 24 Jul 2001 04:45:53 +0000 Subject: [PATCH] expr.c: warn for int const / int const. this will probably want an option for newer games qfcc.c: clean up temp files when errors have occured --- tools/qfcc/source/expr.c | 3 ++- tools/qfcc/source/qfcc.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index d94a261fc..56d96a568 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -135,7 +135,7 @@ warning (expr_t *e, const char *fmt, ...) file = e->file; line = e->line; } - fprintf (stderr, "%s:%d: warning:", strings + file, line); + fprintf (stderr, "%s:%d: warning: ", strings + file, line); vfprintf (stderr, fmt, args); fputs ("\n", stderr); va_end (args); @@ -519,6 +519,7 @@ do_op_integer (int op, expr_t *e1, expr_t *e2) e1->e.integer_val *= i2; break; case '/': + warning (e2, "%d / %d == %d", i1, i2, i1 / i2); e1->e.integer_val /= i2; break; case '&': diff --git a/tools/qfcc/source/qfcc.c b/tools/qfcc/source/qfcc.c index 05de76609..34eff85bc 100644 --- a/tools/qfcc/source/qfcc.c +++ b/tools/qfcc/source/qfcc.c @@ -1026,6 +1026,7 @@ Options: \n\ char tempname[1024]; int tempfd; #endif + int error; extern FILE *yyin; int yyparse(void); extern void clear_frame_macros (void); @@ -1096,8 +1097,7 @@ Options: \n\ s_file = ReuseString (filename); pr_source_line = 1; clear_frame_macros (); - if (yyparse () || pr_error_count) - return 1; + error = yyparse () || pr_error_count; fclose (yyin); #ifdef USE_CPP if (!no_cpp) { @@ -1107,6 +1107,8 @@ Options: \n\ } } #endif + if (error) + return 1; #else char *src2; sprintf (filename, "%s%c%s", sourcedir, PATH_SEPARATOR, com_token);