summaryrefslogtreecommitdiff
path: root/codegen.c
diff options
context:
space:
mode:
authorCarson Fleming <cflems@cflems.net>2026-07-30 00:20:30 -0400
committerCarson Fleming <cflems@cflems.net>2026-07-30 00:20:52 -0400
commit61531e58066e4d803624ab2c6dac84445fb75e59 (patch)
treec4ed43fdfdbd94c461e7429bbfa6cd46e4e78992 /codegen.c
parent3445947c072a4cd533f5f3a53178f77361859123 (diff)
downloadccc-61531e58066e4d803624ab2c6dac84445fb75e59.tar.gz
casting
Diffstat (limited to 'codegen.c')
-rw-r--r--codegen.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/codegen.c b/codegen.c
index 6d55d2c..5cba20f 100644
--- a/codegen.c
+++ b/codegen.c
@@ -515,12 +515,13 @@ static void emit_expr_list(
emit_expr(outfile, node->expr, node->next == NULL ? dst : NULL);
}
-static void emit_paren(
+static void emit_cast(
FILE* outfile,
- const struct paren_node* node,
+ const struct cast_node* node,
const struct lval_def* dst
) {
- emit_expr_list(outfile, node->expr_list, dst);
+ /* TODO: for anything but a reinterpret cast this is garbage */
+ emit_expr(outfile, node->expr, dst);
}
static void emit_expr(
@@ -557,7 +558,10 @@ static void emit_expr(
emit_binary(outfile, &node->inner.binary, dst);
break;
case EXPR_PAREN:
- emit_paren(outfile, &node->inner.paren, dst);
+ emit_expr_list(outfile, node->inner.paren.expr_list, dst);
+ break;
+ case EXPR_CAST:
+ emit_cast(outfile, &node->inner.cast, dst);
break;
}
}