Skip to content

Commit addaacc

Browse files
committed
Replace deprecated default initializations with decl literals
1 parent 218cf05 commit addaacc

File tree

152 files changed

+815
-815
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+815
-815
lines changed

doc/langref/wasi_args.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const std = @import("std");
22

33
pub fn main() !void {
4-
var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};
4+
var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
55
const gpa = general_purpose_allocator.allocator();
66
const args = try std.process.argsAlloc(gpa);
77
defer std.process.argsFree(gpa, args);

doc/langref/wasi_preopens.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const std = @import("std");
22
const fs = std.fs;
33

44
pub fn main() !void {
5-
var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};
5+
var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
66
const gpa = general_purpose_allocator.allocator();
77

88
var arena_instance = std.heap.ArenaAllocator.init(gpa);

lib/compiler/aro/aro/CodeGen.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ node_tag: []const Tree.Tag,
4242
node_data: []const Tree.Node.Data,
4343
node_ty: []const Type,
4444
wip_switch: *WipSwitch = undefined,
45-
symbols: std.ArrayListUnmanaged(Symbol) = .{},
46-
ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{},
47-
phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{},
48-
record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .{},
49-
record_cache: std.AutoHashMapUnmanaged(*Type.Record, Interner.Ref) = .{},
45+
symbols: std.ArrayListUnmanaged(Symbol) = .empty,
46+
ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .empty,
47+
phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .empty,
48+
record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .empty,
49+
record_cache: std.AutoHashMapUnmanaged(*Type.Record, Interner.Ref) = .empty,
5050
cond_dummy_ty: ?Interner.Ref = null,
5151
bool_invert: bool = false,
5252
bool_end_label: Ir.Ref = .none,

lib/compiler/aro/aro/Compilation.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ gpa: Allocator,
9393
diagnostics: Diagnostics,
9494

9595
environment: Environment = .{},
96-
sources: std.StringArrayHashMapUnmanaged(Source) = .{},
97-
include_dirs: std.ArrayListUnmanaged([]const u8) = .{},
98-
system_include_dirs: std.ArrayListUnmanaged([]const u8) = .{},
96+
sources: std.StringArrayHashMapUnmanaged(Source) = .empty,
97+
include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
98+
system_include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
9999
target: std.Target = @import("builtin").target,
100-
pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .{},
100+
pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty,
101101
langopts: LangOpts = .{},
102-
generated_buf: std.ArrayListUnmanaged(u8) = .{},
102+
generated_buf: std.ArrayListUnmanaged(u8) = .empty,
103103
builtins: Builtins = .{},
104104
types: struct {
105105
wchar: Type = undefined,

lib/compiler/aro/aro/Diagnostics.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ pub const Options = struct {
221221

222222
const Diagnostics = @This();
223223

224-
list: std.ArrayListUnmanaged(Message) = .{},
224+
list: std.ArrayListUnmanaged(Message) = .empty,
225225
arena: std.heap.ArenaAllocator,
226226
fatal_errors: bool = false,
227227
options: Options = .{},

lib/compiler/aro/aro/Driver.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ pub const Linker = enum {
2525
const Driver = @This();
2626

2727
comp: *Compilation,
28-
inputs: std.ArrayListUnmanaged(Source) = .{},
29-
link_objects: std.ArrayListUnmanaged([]const u8) = .{},
28+
inputs: std.ArrayListUnmanaged(Source) = .empty,
29+
link_objects: std.ArrayListUnmanaged([]const u8) = .empty,
3030
output_name: ?[]const u8 = null,
3131
sysroot: ?[]const u8 = null,
3232
system_defines: Compilation.SystemDefinesMode = .include_system_defines,

lib/compiler/aro/aro/Hideset.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ pub const Index = enum(u32) {
5151
_,
5252
};
5353

54-
map: std.AutoHashMapUnmanaged(Identifier, Index) = .{},
54+
map: std.AutoHashMapUnmanaged(Identifier, Index) = .empty,
5555
/// Used for computing union/intersection of two lists; stored here so that allocations can be retained
5656
/// until hideset is deinit'ed
57-
tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .{},
57+
tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .empty,
5858
linked_list: Item.List = .{},
5959
comp: *const Compilation,
6060

lib/compiler/aro/aro/InitList.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const Item = struct {
2323

2424
const InitList = @This();
2525

26-
list: std.ArrayListUnmanaged(Item) = .{},
26+
list: std.ArrayListUnmanaged(Item) = .empty,
2727
node: NodeIndex = .none,
2828
tok: TokenIndex = 0,
2929

lib/compiler/aro/aro/Parser.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ param_buf: std.ArrayList(Type.Func.Param),
109109
enum_buf: std.ArrayList(Type.Enum.Field),
110110
record_buf: std.ArrayList(Type.Record.Field),
111111
attr_buf: std.MultiArrayList(TentativeAttribute) = .{},
112-
attr_application_buf: std.ArrayListUnmanaged(Attribute) = .{},
112+
attr_application_buf: std.ArrayListUnmanaged(Attribute) = .empty,
113113
field_attr_buf: std.ArrayList([]const Attribute),
114114
/// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types)
115115
/// e.g. `struct Foo bar;` where `struct Foo` is not defined yet.
116116
/// The key is the StringId of `Foo` and the value is the TokenIndex of `bar`
117117
/// Items are removed if the type is subsequently completed with a definition.
118118
/// We only store the first tentative definition that uses a given type because this map is only used
119119
/// for issuing an error message, and correcting the first error for a type will fix all of them for that type.
120-
tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .{},
120+
tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .empty,
121121

122122
// configuration and miscellaneous info
123123
no_eval: bool = false,
@@ -174,7 +174,7 @@ record: struct {
174174
}
175175
}
176176
} = .{},
177-
record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .{},
177+
record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .empty,
178178
@"switch": ?*Switch = null,
179179
in_loop: bool = false,
180180
pragma_pack: ?u8 = null,

lib/compiler/aro/aro/Preprocessor.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ counter: u32 = 0,
9595
expansion_source_loc: Source.Location = undefined,
9696
poisoned_identifiers: std.StringHashMap(void),
9797
/// Map from Source.Id to macro name in the `#ifndef` condition which guards the source, if any
98-
include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{},
98+
include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .empty,
9999

100100
/// Store `keyword_define` and `keyword_undef` tokens.
101101
/// Used to implement preprocessor debug dump options

0 commit comments

Comments
 (0)