From 31391519353ba65e032cf6681d056cc7401557e3 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 10 Oct 2019 21:24:32 +0100 Subject: Minor fix to systemv_distribute_struct_fields --- src/check_type.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index e4f3cbf0e..0d9722ad8 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1837,9 +1837,9 @@ Type *check_get_results(CheckerContext *ctx, Scope *scope, Ast *_results) { return tuple; } -Array systemv_distribute_struct_fields(Type *t, i32 level=0) { +Array systemv_distribute_struct_fields(Type *t) { t = base_type(t); - GB_ASSERT_MSG(t->kind == Type_Struct, "%s %d", type_to_string(t), level); + GB_ASSERT_MSG(t->kind == Type_Struct, "%s", type_to_string(t)); TypeStruct *ts = &t->Struct; auto distributed = array_make(heap_allocator(), 0, ts->fields.count); @@ -1865,11 +1865,7 @@ Array systemv_distribute_struct_fields(Type *t, i32 level=0) { array_add(&distributed, t_f32); break; case Basic_quaternion256: - array_add(&distributed, t_f64); - array_add(&distributed, t_f64); - array_add(&distributed, t_f64); - array_add(&distributed, t_f64); - break; + goto DEFAULT; case Basic_string: array_add(&distributed, t_u8_ptr); array_add(&distributed, t_int); @@ -1887,6 +1883,8 @@ Array systemv_distribute_struct_fields(Type *t, i32 level=0) { } else { array_add(&distributed, bt); } + break; + default: goto DEFAULT; } @@ -1898,7 +1896,7 @@ Array systemv_distribute_struct_fields(Type *t, i32 level=0) { } else { // IMPORTANT TOOD(bill): handle #packed structs correctly // IMPORTANT TODO(bill): handle #align structs correctly - auto nested = systemv_distribute_struct_fields(f->type, level+1); + auto nested = systemv_distribute_struct_fields(f->type); for_array(i, nested) { array_add(&distributed, nested[i]); } -- cgit v1.2.3