[qfcc] Don't auto-promote vector types through ...

Currently, only vector/vec3 and quaternion/vec4 can be printed anyway,
but I plan on making explicit format strings for the types, so there
should be no need to promote any vector types (and really, any hidden
promotion is a bit of a pain, but standards...).
This commit is contained in:
Bill Currie 2022-04-29 20:49:18 +09:00
parent 719fe5a935
commit 69ce0e952d

View file

@ -223,16 +223,8 @@ type_mismatch (expr_t *e1, expr_t *e2, int op)
expr_t * expr_t *
param_mismatch (expr_t *e, int param, const char *fn, type_t *t1, type_t *t2) param_mismatch (expr_t *e, int param, const char *fn, type_t *t1, type_t *t2)
{ {
dstring_t *s1 = dstring_newstr ();
dstring_t *s2 = dstring_newstr ();
print_type_str (s1, t1);
print_type_str (s2, t2);
e = error (e, "type mismatch for parameter %d of %s: expected %s, got %s", e = error (e, "type mismatch for parameter %d of %s: expected %s, got %s",
param, fn, s1->str, s2->str); param, fn, get_type_string (t1), get_type_string (t2));
dstring_delete (s1);
dstring_delete (s2);
return e; return e;
} }
@ -2011,11 +2003,11 @@ build_function_call (expr_t *fexpr, const type_t *ftype, expr_t *params)
&& options.code.progsversion == PROG_ID_VERSION) && options.code.progsversion == PROG_ID_VERSION)
e = cast_expr (&type_float, e); e = cast_expr (&type_float, e);
if (options.code.promote_float) { if (options.code.promote_float) {
if (is_float (get_type (e))) { if (is_scalar (get_type (e)) && is_float (get_type (e))) {
t = &type_double; t = &type_double;
} }
} else { } else {
if (is_double (get_type (e))) { if (is_scalar (get_type (e)) && is_double (get_type (e))) {
if (!e->implicit) { if (!e->implicit) {
warning (e, "passing double into ... function"); warning (e, "passing double into ... function");
} }