commit fe4b0856bb0efe95355dd24b849642c01f926701 parent 9e278c41af02695eaa14d34750826e8c389a7d76 Author: Eyal Sawady <ecs@d2evs.net> Date: Tue, 10 Aug 2021 10:10:04 +0000 Generate defers for @noreturn functions Signed-off-by: Eyal Sawady <ecs@d2evs.net> Diffstat:
M | src/gen.c | | | 8 | +++++++- |
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/gen.c b/src/gen.c @@ -865,7 +865,13 @@ gen_expr_call(struct gen_context *ctx, const struct expression *expr) const struct type *rtype = lvalue.type; assert(rtype->storage == STORAGE_FUNCTION); - // TODO: Run deferred expressions if rtype->func.flags & FN_NORETURN + + if (rtype->func.flags & FN_NORETURN) { + for (struct gen_scope *scope = ctx->scope; scope; + scope = scope->parent) { + gen_defers(ctx, scope); + } + } struct qbe_statement call = { .type = Q_INSTR,