commit f48b24ef086f8d4f43ee5d4a9804755ad5ec9d0c
parent d621320ad8e5909f1949d1b69e2082c34676f937
Author: citbl <citbl@citbl.org>
Date: Mon, 13 Oct 2025 21:59:40 +1000
minor add voidptr
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/gen/gen.c b/src/gen/gen.c
@@ -13,6 +13,7 @@ static gcc_jit_type* type_uint;
static gcc_jit_type* type_double;
static gcc_jit_type* type_void;
static gcc_jit_type* type_cstr;
+static gcc_jit_type* type_voidp;
#define MAXARGS 16
@@ -57,6 +58,7 @@ gen_init(Scope* scope, const char* src, Node* node, bool quiet)
type_double = gcc_jit_context_get_type(ctx, GCC_JIT_TYPE_DOUBLE);
type_void = gcc_jit_context_get_type(ctx, GCC_JIT_TYPE_VOID);
type_cstr = gcc_jit_context_get_type(ctx, GCC_JIT_TYPE_CONST_CHAR_PTR);
+ type_voidp = gcc_jit_context_get_type(ctx, GCC_JIT_TYPE_VOID_PTR);
gcc_jit_location* loc = gcc_jit_context_new_location(ctx, node->filename, 0, 0);
@@ -386,7 +388,7 @@ build_func_decl(Gen* gen, Node* node)
build_block(gen, node->data.function_decl.body);
- if (gen->curr_block && ret_type == type_int) {
+ if (gen->curr_block && ret_type == type_int) { // TODO handle more return types
gcc_jit_rvalue* ret_value = gcc_jit_context_new_rvalue_from_int(gen->ctx, type_int, 0);
gcc_jit_block_end_with_return(gen->curr_block, loc, ret_value);
} else {