commit 4c9e73e3bc919fb444440f8aedfec6641dcdaa87
parent 4b6796f526ca07348b4e14df9768737808ee3b1d
Author: erai <erai@omiltem.net>
Date: Fri, 29 Nov 2024 10:44:13 -0500
remove doubled checks
Diffstat:
2 files changed, 0 insertions(+), 24 deletions(-)
diff --git a/cc0.c b/cc0.c
@@ -1810,10 +1810,6 @@ void( my_compile_expr)(struct my_compiler* my_c,struct my_decl* my_d,struct my_n
(my_compile_expr)((my_c),(my_d),((my_n)->my_a),(0UL));
(my_emit_store)(((my_c)->my_s),((my_n)->my_t));
} else if ((unsigned long)(((long)(my_kind))==((long)(my_N_SIZEOF)))) {
- (my_out)=((my_mklabel)(((my_c)->my_s)));
- (my_emit_jmp)(((my_c)->my_s),(my_out));
- (my_compile_expr)((my_c),(my_d),((my_n)->my_a),(0UL));
- (my_fixup_label)(((my_c)->my_s),(my_out));
if ((unsigned long)(((long)((((my_n)->my_a)->my_t)->my_kind))==((long)(my_TY_BYTE)))) {
(my_emit_num)(((my_c)->my_s),(1UL));
} else {
@@ -2058,14 +2054,8 @@ void( my_compile_stmt)(struct my_compiler* my_c,struct my_decl* my_d,struct my_n
(my_emit_jmp)(((my_c)->my_s),(my_top));
} else if ((unsigned long)(((long)(my_kind))==((long)(my_N_RETURN)))) {
if ((my_n)->my_a) {
- if ((unsigned long)(((long)((((my_d)->my_func_type)->my_val)->my_kind))==((long)(my_TY_VOID)))) {
- (my_cdie)((my_c),((unsigned char *)"returning a value in a void function"));
- }
(my_compile_expr)((my_c),(my_d),((my_n)->my_a),(1UL));
} else {
- if ((unsigned long)(((long)((((my_d)->my_func_type)->my_val)->my_kind))!=((long)(my_TY_VOID)))) {
- (my_cdie)((my_c),((unsigned char *)"returning void in a non void function"));
- }
(my_emit_num)(((my_c)->my_s),(0UL));
}
(my_emit_ret)(((my_c)->my_s));
diff --git a/cc1.om b/cc1.om
@@ -1433,14 +1433,6 @@ func compile_expr(c: *compiler, d: *decl, n: *node, rhs: int) {
emit_store(c.s, n.t);
} else if (kind == N_SIZEOF) {
- out = mklabel(c.s);
-
- emit_jmp(c.s, out);
-
- compile_expr(c, d, n.a, 0);
-
- fixup_label(c.s, out);
-
if (n.a.t.kind == TY_BYTE) {
emit_num(c.s, 1);
} else {
@@ -1728,14 +1720,8 @@ func compile_stmt(c: *compiler, d: *decl, n: *node, top: *label, out: *label) {
emit_jmp(c.s, top);
} else if (kind == N_RETURN) {
if (n.a) {
- if (d.func_type.val.kind == TY_VOID) {
- cdie(c, "returning a value in a void function");
- }
compile_expr(c, d, n.a, 1);
} else {
- if (d.func_type.val.kind != TY_VOID) {
- cdie(c, "returning void in a non void function");
- }
emit_num(c.s, 0);
}
emit_ret(c.s);