mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 23:52:22 +00:00
[qfcc] Check for compound init in message args
I had forgotten message sending did its own type checking and thus needed to be updated for compound initializers in message parameters.
This commit is contained in:
parent
45acbddb79
commit
047131a737
1 changed files with 14 additions and 7 deletions
|
@ -706,22 +706,29 @@ method_check_params (method_t *method, expr_t *args)
|
||||||
arg_list[i--] = a;
|
arg_list[i--] = a;
|
||||||
for (i = 2; i < count; i++) {
|
for (i = 2; i < count; i++) {
|
||||||
expr_t *e = arg_list[i];
|
expr_t *e = arg_list[i];
|
||||||
type_t *t = get_type (e);
|
type_t *arg_type = mtype->t.func.param_types[i];
|
||||||
|
type_t *t;
|
||||||
|
|
||||||
if (!t)
|
if (e->type == ex_compound) {
|
||||||
|
e = expr_file_line (initialized_temp_expr (arg_type, e), e);
|
||||||
|
}
|
||||||
|
t = get_type (e);
|
||||||
|
if (!t) {
|
||||||
return e;
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
if (i < param_count) {
|
if (i < param_count) {
|
||||||
if (e->type != ex_nil)
|
if (e->type != ex_nil) {
|
||||||
if (!type_assignable (mtype->t.func.param_types[i], t)) {
|
if (!type_assignable (arg_type, t)) {
|
||||||
err = param_mismatch (e, i - 1, method->name,
|
err = param_mismatch (e, i - 1, method->name, arg_type, t);
|
||||||
mtype->t.func.param_types[i], t);
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_integer_val (e) && options.warnings.vararg_integer)
|
if (is_integer_val (e) && options.warnings.vararg_integer) {
|
||||||
warning (e, "passing integer consant into ... function");
|
warning (e, "passing integer consant into ... function");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
free (arg_list);
|
free (arg_list);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue