From 45eecc0905fa72b17a74b2a258598eae1da10597 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Fri, 12 May 2017 10:27:14 +0100 Subject: Reimplement #ordered again --- src/check_expr.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/check_expr.c') diff --git a/src/check_expr.c b/src/check_expr.c index f205935c2..a7e85f819 100644 --- a/src/check_expr.c +++ b/src/check_expr.c @@ -555,7 +555,13 @@ void check_struct_type(Checker *c, Type *struct_type, AstNode *node) { struct_type->Record.field_count = field_count; struct_type->Record.names = make_names_field_for_record(c, c->context.scope); - if (false && !st->is_packed && !st->is_ordered) { + type_set_offsets(c->allocator, struct_type); + + + if (!struct_type->failure && !st->is_packed && !st->is_ordered) { + struct_type->failure = false; + struct_type->Record.are_offsets_set = false; + struct_type->Record.offsets = NULL; // NOTE(bill): Reorder fields for reduced size/performance Entity **reordered_fields = gb_alloc_array(c->allocator, Entity *, field_count); @@ -576,12 +582,9 @@ void check_struct_type(Checker *c, Type *struct_type, AstNode *node) { struct_type->Record.fields = reordered_fields; } - { - // i64 size = type_size_of(c->allocator, struct_type); - } - type_set_offsets(c->allocator, struct_type); + if (st->align != NULL) { if (st->is_packed) { syntax_error_node(st->align, "`#align` cannot be applied with `#packed`"); -- cgit v1.2.3