diff options
-rw-r--r-- | expand.c | 6 | ||||
-rw-r--r-- | expression.c | 2 | ||||
-rw-r--r-- | expression.h | 3 | ||||
-rw-r--r-- | parse.c | 2 |
4 files changed, 6 insertions, 7 deletions
@@ -94,9 +94,9 @@ static long long get_longlong(struct expression *expr) return (value & andmask) | ormask; } -void cast_value(struct expression *expr, struct symbol *newtype, - struct expression *old, struct symbol *oldtype) +void cast_value(struct expression *expr, struct symbol *newtype, struct expression *old) { + struct symbol *oldtype = old->ctype; int old_size = oldtype->bit_size; int new_size = newtype->bit_size; long long value, mask, signmask; @@ -876,7 +876,7 @@ static int expand_cast(struct expression *expr) /* Simplify normal integer casts.. */ if (target->type == EXPR_VALUE || target->type == EXPR_FVALUE) { - cast_value(expr, expr->ctype, target, target->ctype); + cast_value(expr, expr->ctype, target); return 0; } return cost + 1; diff --git a/expression.c b/expression.c index bead007f..727e7056 100644 --- a/expression.c +++ b/expression.c @@ -432,7 +432,7 @@ struct token *primary_expression(struct token *token, struct expression **tree) // TODO: handle 'u8', 'u' & 'U' prefixes. if (token_type(token) < TOKEN_WIDE_CHAR) { expr->ctype = &char_ctype; - cast_value(expr, &int_ctype, expr, expr->ctype); + cast_value(expr, &int_ctype, expr); } else { expr->ctype = wchar_ctype; } diff --git a/expression.h b/expression.h index f733c076..8bf40d32 100644 --- a/expression.h +++ b/expression.h @@ -337,7 +337,6 @@ struct token *compound_statement(struct token *, struct statement *); #define constant_expression(token,tree) conditional_expression(token, tree) /* Cast folding of constant values.. */ -void cast_value(struct expression *expr, struct symbol *newtype, - struct expression *old, struct symbol *oldtype); +void cast_value(struct expression *expr, struct symbol *newtype, struct expression *old); #endif @@ -903,7 +903,7 @@ static void cast_enum_list(struct symbol_list *list, struct symbol *base_type) expr->ctype = &int_ctype; continue; } - cast_value(expr, base_type, expr, ctype); + cast_value(expr, base_type, expr); } END_FOR_EACH_PTR(sym); } |