diff --git a/tools/qfcc/include/expr.h b/tools/qfcc/include/expr.h index 83968c2dc..d41a7fa59 100644 --- a/tools/qfcc/include/expr.h +++ b/tools/qfcc/include/expr.h @@ -328,7 +328,6 @@ typedef struct expr_s { expr_type type; ///< the type of the result of this expression int printid; ///< avoid duplicate output when printing unsigned paren:1; ///< the expression is enclosed in () - unsigned rvalue:1; ///< the expression is on the right side of = unsigned implicit:1; ///< don't warn for implicit casts unsigned nodag:1; ///< prevent use of dags for this expression ///< propagates up diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 5ec092387..e166dbb94 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -2708,9 +2708,6 @@ return_expr (function_t *f, const expr_t *e) if (e->type == ex_vector) { e = assign_expr (new_temp_def_expr (t), e); } - if (e->type == ex_block) { - ((expr_t *) e->block.result)->rvalue = 1;//FIXME - } return new_return_expr (e); } diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index 442005e86..47d18072d 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -1728,12 +1728,27 @@ expr_deref (sblock_t *sblock, const expr_t *deref, operand_t **op) return sblock; } +static sblock_t * +expr_slist (sblock_t *sblock, const ex_list_t *slist, const expr_t *result, + operand_t **op) +{ + + for (auto s = slist->head; s; s = s->next) { + if (s->expr == result) { + sblock = statement_subexpr (sblock, s->expr, op); + } else { + sblock = statement_single (sblock, s->expr); + } + } + return sblock; +} + static sblock_t * expr_block (sblock_t *sblock, const expr_t *e, operand_t **op) { if (!e->block.result) internal_error (e, "block sub-expression without result"); - sblock = statement_slist (sblock, &e->block.list); + sblock = expr_slist (sblock, &e->block.list, e->block.result, op); sblock = statement_subexpr (sblock, e->block.result, op); return sblock; } @@ -2389,7 +2404,7 @@ statement_assign (sblock_t *sblock, const expr_t *e) static sblock_t * statement_nonexec (sblock_t *sblock, const expr_t *e) { - if (!e->rvalue && options.warnings.executable) + if (options.warnings.executable) warning (e, "Non-executable statement; executing programmer instead."); return sblock; }