diff --git a/lib/compiler/aro/aro/InitList.zig b/lib/compiler/aro/aro/InitList.zig index 9d8af869d7..ed7af8f998 100644 --- a/lib/compiler/aro/aro/InitList.zig +++ b/lib/compiler/aro/aro/InitList.zig @@ -22,9 +22,15 @@ const Item = struct { const InitList = @This(); -list: std.ArrayList(Item) = .empty, -node: Node.OptIndex = .null, -tok: TokenIndex = 0, +list: std.ArrayList(Item), +node: Node.OptIndex, +tok: TokenIndex, + +pub const empty: InitList = .{ + .list = .empty, + .node = .null, + .tok = 0, +}; /// Deinitialize freeing all memory. pub fn deinit(il: *InitList, gpa: Allocator) void { @@ -43,7 +49,7 @@ pub fn find(il: *InitList, gpa: Allocator, index: u64) !*InitList { if (il.list.items.len == 0) { const item = try il.list.addOne(gpa); item.* = .{ - .list = .{}, + .list = .empty, .index = index, }; return &item.list; @@ -51,7 +57,7 @@ pub fn find(il: *InitList, gpa: Allocator, index: u64) !*InitList { // Append a new value to the end of the list. const new = try il.list.addOne(gpa); new.* = .{ - .list = .{}, + .list = .empty, .index = index, }; return &new.list; @@ -70,7 +76,7 @@ pub fn find(il: *InitList, gpa: Allocator, index: u64) !*InitList { // Insert a new value into a sorted position. try il.list.insert(gpa, left, .{ - .list = .{}, + .list = .empty, .index = index, }); return &il.list.items[left].list; @@ -78,7 +84,7 @@ pub fn find(il: *InitList, gpa: Allocator, index: u64) !*InitList { test "basic usage" { const gpa = testing.allocator; - var il: InitList = .{}; + var il: InitList = .empty; defer il.deinit(gpa); { diff --git a/lib/compiler/aro/aro/Parser.zig b/lib/compiler/aro/aro/Parser.zig index fc21ee4d0b..6e60dbd623 100644 --- a/lib/compiler/aro/aro/Parser.zig +++ b/lib/compiler/aro/aro/Parser.zig @@ -3977,7 +3977,7 @@ fn initializer(p: *Parser, init_qt: QualType) Error!Result { final_init_qt = .invalid; } - var il: InitList = .{}; + var il: InitList = .empty; defer il.deinit(p.comp.gpa); try p.initializerItem(&il, final_init_qt, l_brace); @@ -4028,12 +4028,12 @@ fn initializerItem(p: *Parser, il: *InitList, init_qt: QualType, l_brace: TokenI try p.err(first_tok, .initializer_overrides, .{}); try p.err(item.il.tok, .previous_initializer, .{}); item.il.deinit(gpa); - item.il.* = .{}; + item.il.* = .empty; } try p.initializerItem(item.il, item.qt, inner_l_brace); } else { // discard further values - var tmp_il: InitList = .{}; + var tmp_il: InitList = .empty; defer tmp_il.deinit(gpa); try p.initializerItem(&tmp_il, .invalid, inner_l_brace); if (!warned_excess) try p.err(first_tok, switch (init_qt.base(p.comp).type) { diff --git a/lib/compiler/aro/aro/Toolchain.zig b/lib/compiler/aro/aro/Toolchain.zig index 0aa9d76fc8..9a923c0846 100644 --- a/lib/compiler/aro/aro/Toolchain.zig +++ b/lib/compiler/aro/aro/Toolchain.zig @@ -43,13 +43,13 @@ const Toolchain = @This(); driver: *Driver, /// The list of toolchain specific path prefixes to search for libraries. -library_paths: PathList = .{}, +library_paths: PathList = .empty, /// The list of toolchain specific path prefixes to search for files. -file_paths: PathList = .{}, +file_paths: PathList = .empty, /// The list of toolchain specific path prefixes to search for programs. -program_paths: PathList = .{}, +program_paths: PathList = .empty, selected_multilib: Multilib = .{},