[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.
This commit is contained in:
Bill Currie 2023-09-14 18:25:29 +09:00
parent 862b2669a5
commit e535fd51b7
3 changed files with 12 additions and 5 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -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);