Reimplement #ordered again

This commit is contained in:
Ginger Bill
2017-05-12 10:27:14 +01:00
parent 87f1a62ca4
commit 45eecc0905
6 changed files with 40 additions and 37 deletions
+8 -5
View File
@@ -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`");