mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Enforce pointer cast
This commit is contained in:
@@ -962,7 +962,7 @@ void lb_internal_dynamic_map_set(lbProcedure *p, lbValue const &map_ptr, Type *m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lb_dynamic_map_reserve(lbProcedure *p, lbValue const &map_ptr, isize const capacity, TokenPos const &pos) {
|
lbValue lb_dynamic_map_reserve(lbProcedure *p, lbValue const &map_ptr, isize const capacity, TokenPos const &pos) {
|
||||||
GB_ASSERT(!build_context.no_dynamic_literals);
|
GB_ASSERT(!build_context.no_dynamic_literals);
|
||||||
|
|
||||||
String proc_name = {};
|
String proc_name = {};
|
||||||
@@ -975,7 +975,7 @@ void lb_dynamic_map_reserve(lbProcedure *p, lbValue const &map_ptr, isize const
|
|||||||
args[1] = lb_gen_map_info_ptr(p->module, type_deref(map_ptr.type));
|
args[1] = lb_gen_map_info_ptr(p->module, type_deref(map_ptr.type));
|
||||||
args[2] = lb_const_int(p->module, t_uint, capacity);
|
args[2] = lb_const_int(p->module, t_uint, capacity);
|
||||||
args[3] = lb_emit_source_code_location_as_global(p, proc_name, pos);
|
args[3] = lb_emit_source_code_location_as_global(p, proc_name, pos);
|
||||||
lb_emit_runtime_call(p, "__dynamic_map_reserve", args);
|
return lb_emit_runtime_call(p, "__dynamic_map_reserve", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4131,7 +4131,8 @@ lbAddr lb_build_addr_compound_lit(lbProcedure *p, Ast *expr) {
|
|||||||
}
|
}
|
||||||
GB_ASSERT(!build_context.no_dynamic_literals);
|
GB_ASSERT(!build_context.no_dynamic_literals);
|
||||||
|
|
||||||
lb_dynamic_map_reserve(p, v.addr, 2*cl->elems.count, pos);
|
lbValue err = lb_dynamic_map_reserve(p, v.addr, 2*cl->elems.count, pos);
|
||||||
|
gb_unused(err);
|
||||||
|
|
||||||
for_array(field_index, cl->elems) {
|
for_array(field_index, cl->elems) {
|
||||||
Ast *elem = cl->elems[field_index];
|
Ast *elem = cl->elems[field_index];
|
||||||
|
|||||||
@@ -599,6 +599,7 @@ void lb_begin_procedure_body(lbProcedure *p) {
|
|||||||
p->entity->decl_info != nullptr &&
|
p->entity->decl_info != nullptr &&
|
||||||
p->entity->decl_info->defer_use_count == 0) {
|
p->entity->decl_info->defer_use_count == 0) {
|
||||||
lbValue val = lb_emit_struct_ep(p, p->return_ptr.addr, cast(i32)i);
|
lbValue val = lb_emit_struct_ep(p, p->return_ptr.addr, cast(i32)i);
|
||||||
|
val = lb_emit_conv(p, val, alloc_type_pointer(e->type));
|
||||||
|
|
||||||
lb_add_entity(p->module, e, val);
|
lb_add_entity(p->module, e, val);
|
||||||
lb_add_debug_local_variable(p, val.value, e->type, e->token);
|
lb_add_debug_local_variable(p, val.value, e->type, e->token);
|
||||||
|
|||||||
Reference in New Issue
Block a user