[qfcc] Support uint and enum in expr_int

Signed or unsigned isn't that important for internal errors.
This commit is contained in:
Bill Currie 2025-01-20 11:24:01 +09:00
parent 332c991064
commit 3a521ebe16

View file

@ -1235,11 +1235,12 @@ expr_int (const expr_t *e)
if (e->type == ex_value && e->value->lltype == ev_short) {
return e->value->short_val;
}
if (e->type == ex_symbol && e->symbol->sy_type == sy_const
&& (e->symbol->type->type == ev_int
|| is_enum (e->symbol->type))) {
if (e->type == ex_symbol && e->symbol->sy_type == sy_const) {
auto type = e->symbol->type;
if (!is_long (type) && !is_ulong (type) && is_integral (type)) {
return e->symbol->value->int_val;
}
}
if (e->type == ex_symbol && e->symbol->sy_type == sy_def
&& e->symbol->def->constant
&& is_integral (e->symbol->def->type)) {