From e535fd51b7668f2363fe07fb3037734f8a8da4de Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 14 Sep 2023 18:25:29 +0900 Subject: [PATCH] [qfcc] Make passing int constants through ... ok That is, passing int constants through ... in Ruamoko progs is no longer a warning (still is for v6p and v6 progs). I got tired of getting the warning for sizeof expressions when int through ... hasn't been a problem for even most v6p progs, and was intended to not be a problem for Ruamoko progs. --- tools/qfcc/include/expr.h | 1 + tools/qfcc/source/expr.c | 12 ++++++++++-- tools/qfcc/source/method.c | 4 +--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/qfcc/include/expr.h b/tools/qfcc/include/expr.h index 4dc0d90c6..5671ac357 100644 --- a/tools/qfcc/include/expr.h +++ b/tools/qfcc/include/expr.h @@ -836,6 +836,7 @@ expr_t *binary_expr (int op, expr_t *e1, expr_t *e2); expr_t *field_expr (expr_t *e1, expr_t *e2); expr_t *asx_expr (int op, expr_t *e1, expr_t *e2); expr_t *unary_expr (int op, expr_t *e); +void vararg_integer (expr_t *e); expr_t *build_function_call (expr_t *fexpr, const struct type_s *ftype, expr_t *params); expr_t *function_expr (expr_t *e1, expr_t *e2); diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 70e490722..a65832d7d 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -2102,6 +2102,15 @@ bitnot_expr: internal_error (e, 0); } +void +vararg_integer (expr_t *e) +{ + if (is_int_val (e) && options.code.progsversion < PROG_VERSION + && options.warnings.vararg_integer) { + warning (e, "passing int constant into ... function"); + } +} + expr_t * build_function_call (expr_t *fexpr, const type_t *ftype, expr_t *params) { @@ -2211,8 +2220,7 @@ build_function_call (expr_t *fexpr, const type_t *ftype, expr_t *params) } } } - if (is_int_val (e) && options.warnings.vararg_integer) - warning (e, "passing int constant into ... function"); + vararg_integer (e); } arg_types[arg_count - 1 - i] = t; } diff --git a/tools/qfcc/source/method.c b/tools/qfcc/source/method.c index 1034ab337..694bef19b 100644 --- a/tools/qfcc/source/method.c +++ b/tools/qfcc/source/method.c @@ -749,9 +749,7 @@ method_check_params (method_t *method, expr_t *args) } } } else { - if (is_int_val (e) && options.warnings.vararg_integer) { - warning (e, "passing int consant into ... function"); - } + vararg_integer (e); } } free (arg_list);