From a124b027b45384e595c6967adabe8b5033b9c410 Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Mon, 13 Jul 2020 01:10:13 -0400 Subject: [PATCH] CBE: Use hasCodeGenBits instead of checking against void and noreturn --- src-self-hosted/cgen.zig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src-self-hosted/cgen.zig b/src-self-hosted/cgen.zig index 81e2b4b7f8..daac5c328d 100644 --- a/src-self-hosted/cgen.zig +++ b/src-self-hosted/cgen.zig @@ -126,8 +126,7 @@ pub fn generate(file: *C, decl: *Decl) !void { const target = func_val.func.owner_decl; const target_ty = target.typed_value.most_recent.typed_value.ty; const ret_ty = target_ty.fnReturnType().tag(); - if (ret_ty != .void and ret_ty != .noreturn) { - // TODO: don't do this if we're actually using the value + if (target_ty.fnReturnType().hasCodeGenBits()) { try writer.print("(void)", .{}); } const tname = mem.spanZ(target.name);