mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 13:11:00 +00:00
[qfcc] Treat fp constants as float for v6 progs
v6 progs don't support doubles, so demote double suffices to float, and treat implicit fp constants as float.
This commit is contained in:
parent
d9e2108b91
commit
7f021b074c
3 changed files with 23 additions and 9 deletions
|
@ -52,6 +52,7 @@ typedef struct {
|
|||
bool commute_float_dot; // allow fp dot product to commute
|
||||
bool assoc_float_add; // allow fp addition to be associative
|
||||
bool assoc_float_mul; // allow fp multiplication to be associative
|
||||
bool no_double; // double fp type is not supported
|
||||
|
||||
bool help;
|
||||
} code_options_t;
|
||||
|
|
|
@ -202,7 +202,7 @@ usage (int status)
|
|||
" default for separate compilation mode\n"
|
||||
" -S, --save-temps Do not delete temporary files\n"
|
||||
" -s, --source DIR Look for progs.src in DIR instead of \".\"\n"
|
||||
" --traditional Traditional QuakeC mode: implies v6only\n"
|
||||
" --traditional Traditional QuakeC mode: implies target=v6\n"
|
||||
" default when using progs.src\n"
|
||||
" -U, --undefine SYMBOL Undefine preprocessor symbols\n"
|
||||
" -V, --version Output version information and exit\n"
|
||||
|
@ -860,6 +860,7 @@ DecodeArgs (int argc, char **argv)
|
|||
}
|
||||
if (options.code.progsversion == PROG_ID_VERSION) {
|
||||
options.code.promote_float = false;
|
||||
options.code.no_double = true;
|
||||
cpp_define ("__VERSION6__=1");
|
||||
if (!options_user_set.code.crc) {
|
||||
options.code.crc = true;
|
||||
|
|
|
@ -584,16 +584,24 @@ parse_number (const rua_tok_t *tok, yyscan_t scanner)
|
|||
fp ? "floating" : type);
|
||||
return 0;
|
||||
}
|
||||
if (expl == suff_long_double) {
|
||||
warning (0, "long double treated as double");
|
||||
expl = suff_double;
|
||||
}
|
||||
if (options.code.no_double && expl == suff_double) {
|
||||
warning (0, "double treated as float");
|
||||
expl = suff_float;
|
||||
}
|
||||
|
||||
if (fp) {
|
||||
if (expl == suff_float) {
|
||||
return new_float_expr (fvalue);
|
||||
} else {
|
||||
if (expl == suff_long_double) {
|
||||
warning (0, "long double treated as double");
|
||||
expl = suff_double;
|
||||
if (options.code.no_double) {
|
||||
return new_float_expr (fvalue);
|
||||
} else {
|
||||
return new_double_expr (fvalue, expl == suff_implicit);
|
||||
}
|
||||
return new_double_expr (fvalue, expl == suff_implicit);
|
||||
}
|
||||
} else {
|
||||
if (expl == suff_unsigned) {
|
||||
|
@ -696,6 +704,14 @@ parse_vector (const rua_tok_t *tok, yyscan_t scanner)
|
|||
fp ? "floating" : "integer");
|
||||
return 0;
|
||||
}
|
||||
if (expl == suff_long_double) {
|
||||
warning (0, "long double treated as double");
|
||||
expl = suff_double;
|
||||
}
|
||||
if (options.code.no_double && expl == suff_double) {
|
||||
warning (0, "double treated as float");
|
||||
expl = suff_float;
|
||||
}
|
||||
union {
|
||||
pr_float_t f[4];
|
||||
pr_int_t i[4];
|
||||
|
@ -704,10 +720,6 @@ parse_vector (const rua_tok_t *tok, yyscan_t scanner)
|
|||
pr_type_t t[PR_SIZEOF (lvec4)];
|
||||
} data;
|
||||
const type_t *type = nullptr;
|
||||
if (expl == suff_long_double) {
|
||||
warning (0, "long double treated as double");
|
||||
expl = suff_double;
|
||||
}
|
||||
if (expl == suff_float) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
auto c = components[i];
|
||||
|
|
Loading…
Reference in a new issue