authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2024-03-11 22:42:32+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-03-11 22:42:32+02:00
log4f782d1e853accbe1c4bfab2617c3813d4b1e59f
tree0eb768171ecfb058fba72d199afc951af206f8fb
parentd0c06ca7127110a8afeb0ef524a197049892db21
parent6067d39522f939c08dd3f3ea4fb5889ff0024e72
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #18994 from ExpidusOS/feat/container-layout-rename-fields

std.builtin: make enum fields lowercase

126 files changed, 909 insertions(+), 916 deletions(-)

build.zig+1-1
......@@ -855,7 +855,7 @@ fn addCMakeLibraryList(exe: *std.Build.Step.Compile, list: []const u8) void {
855855}
856856
857857const CMakeConfig = struct {
858 llvm_linkage: std.Build.Step.Compile.Linkage,
858 llvm_linkage: std.builtin.LinkMode,
859859 cmake_binary_dir: []const u8,
860860 cmake_prefix_path: []const u8,
861861 cmake_static_library_prefix: []const u8,
doc/langref.html.in+2-2
......@@ -1453,7 +1453,7 @@ export fn foo_strict(x: f64) f64 {
14531453}
14541454
14551455export fn foo_optimized(x: f64) f64 {
1456 @setFloatMode(.Optimized);
1456 @setFloatMode(.optimized);
14571457 return x + big - big;
14581458}
14591459 {#code_end#}
......@@ -8356,7 +8356,7 @@ test "main" {
83568356 </p>
83578357 {#code_begin|obj|export_builtin#}
83588358comptime {
8359 @export(internalName, .{ .name = "foo", .linkage = .Strong });
8359 @export(internalName, .{ .name = "foo", .linkage = .strong });
83608360}
83618361
83628362fn internalName() callconv(.C) void {}
lib/build_runner.zig+6-6
......@@ -892,10 +892,10 @@ fn workerMakeOneStep(
892892 // then we return without doing the step, relying on another worker to
893893 // queue this step up again when dependencies are met.
894894 for (s.dependencies.items) |dep| {
895 switch (@atomicLoad(Step.State, &dep.state, .SeqCst)) {
895 switch (@atomicLoad(Step.State, &dep.state, .seq_cst)) {
896896 .success, .skipped => continue,
897897 .failure, .dependency_failure, .skipped_oom => {
898 @atomicStore(Step.State, &s.state, .dependency_failure, .SeqCst);
898 @atomicStore(Step.State, &s.state, .dependency_failure, .seq_cst);
899899 return;
900900 },
901901 .precheck_done, .running => {
......@@ -929,7 +929,7 @@ fn workerMakeOneStep(
929929 s.state = .running;
930930 } else {
931931 // Avoid running steps twice.
932 if (@cmpxchgStrong(Step.State, &s.state, .precheck_done, .running, .SeqCst, .SeqCst) != null) {
932 if (@cmpxchgStrong(Step.State, &s.state, .precheck_done, .running, .seq_cst, .seq_cst) != null) {
933933 // Another worker got the job.
934934 return;
935935 }
......@@ -956,13 +956,13 @@ fn workerMakeOneStep(
956956
957957 handle_result: {
958958 if (make_result) |_| {
959 @atomicStore(Step.State, &s.state, .success, .SeqCst);
959 @atomicStore(Step.State, &s.state, .success, .seq_cst);
960960 } else |err| switch (err) {
961961 error.MakeFailed => {
962 @atomicStore(Step.State, &s.state, .failure, .SeqCst);
962 @atomicStore(Step.State, &s.state, .failure, .seq_cst);
963963 break :handle_result;
964964 },
965 error.MakeSkipped => @atomicStore(Step.State, &s.state, .skipped, .SeqCst),
965 error.MakeSkipped => @atomicStore(Step.State, &s.state, .skipped, .seq_cst),
966966 }
967967
968968 // Successful completion of a step, so we queue up its dependants as well.
lib/c.zig+10-10
......@@ -26,7 +26,7 @@ const is_freestanding = switch (native_os) {
2626
2727comptime {
2828 if (is_freestanding and is_wasm and builtin.link_libc) {
29 @export(wasm_start, .{ .name = "_start", .linkage = .Strong });
29 @export(wasm_start, .{ .name = "_start", .linkage = .strong });
3030 }
3131
3232 if (native_os == .linux) {
......@@ -34,16 +34,16 @@ comptime {
3434 }
3535
3636 if (builtin.link_libc) {
37 @export(strcmp, .{ .name = "strcmp", .linkage = .Strong });
38 @export(strncmp, .{ .name = "strncmp", .linkage = .Strong });
39 @export(strerror, .{ .name = "strerror", .linkage = .Strong });
40 @export(strlen, .{ .name = "strlen", .linkage = .Strong });
41 @export(strcpy, .{ .name = "strcpy", .linkage = .Strong });
42 @export(strncpy, .{ .name = "strncpy", .linkage = .Strong });
43 @export(strcat, .{ .name = "strcat", .linkage = .Strong });
44 @export(strncat, .{ .name = "strncat", .linkage = .Strong });
37 @export(strcmp, .{ .name = "strcmp", .linkage = .strong });
38 @export(strncmp, .{ .name = "strncmp", .linkage = .strong });
39 @export(strerror, .{ .name = "strerror", .linkage = .strong });
40 @export(strlen, .{ .name = "strlen", .linkage = .strong });
41 @export(strcpy, .{ .name = "strcpy", .linkage = .strong });
42 @export(strncpy, .{ .name = "strncpy", .linkage = .strong });
43 @export(strcat, .{ .name = "strcat", .linkage = .strong });
44 @export(strncat, .{ .name = "strncat", .linkage = .strong });
4545 } else if (is_msvc) {
46 @export(_fltused, .{ .name = "_fltused", .linkage = .Strong });
46 @export(_fltused, .{ .name = "_fltused", .linkage = .strong });
4747 }
4848}
4949
lib/compiler/aro/aro/Attribute.zig+1-1
......@@ -653,7 +653,7 @@ pub const Arguments = blk: {
653653
654654 break :blk @Type(.{
655655 .Union = .{
656 .layout = .Auto,
656 .layout = .auto,
657657 .tag_type = null,
658658 .fields = &union_fields,
659659 .decls = &.{},
lib/compiler_rt/atomics.zig+9-9
......@@ -74,7 +74,7 @@ const SpinlockTable = struct {
7474 : "memory"
7575 );
7676 } else flag: {
77 break :flag @atomicRmw(@TypeOf(self.v), &self.v, .Xchg, .Locked, .Acquire);
77 break :flag @atomicRmw(@TypeOf(self.v), &self.v, .Xchg, .Locked, .acquire);
7878 };
7979
8080 switch (flag) {
......@@ -91,7 +91,7 @@ const SpinlockTable = struct {
9191 : "memory"
9292 );
9393 } else {
94 @atomicStore(@TypeOf(self.v), &self.v, .Unlocked, .Release);
94 @atomicStore(@TypeOf(self.v), &self.v, .Unlocked, .release);
9595 }
9696 }
9797 };
......@@ -172,7 +172,7 @@ inline fn atomic_load_N(comptime T: type, src: *T, model: i32) T {
172172 defer sl.release();
173173 return src.*;
174174 } else {
175 return @atomicLoad(T, src, .SeqCst);
175 return @atomicLoad(T, src, .seq_cst);
176176 }
177177}
178178
......@@ -203,7 +203,7 @@ inline fn atomic_store_N(comptime T: type, dst: *T, value: T, model: i32) void {
203203 defer sl.release();
204204 dst.* = value;
205205 } else {
206 @atomicStore(T, dst, value, .SeqCst);
206 @atomicStore(T, dst, value, .seq_cst);
207207 }
208208}
209209
......@@ -239,12 +239,12 @@ fn wideUpdate(comptime T: type, ptr: *T, val: T, update: anytype) T {
239239
240240 const mask = @as(WideAtomic, std.math.maxInt(T)) << inner_shift;
241241
242 var wide_old = @atomicLoad(WideAtomic, wide_ptr, .SeqCst);
242 var wide_old = @atomicLoad(WideAtomic, wide_ptr, .seq_cst);
243243 while (true) {
244244 const old = @as(T, @truncate((wide_old & mask) >> inner_shift));
245245 const new = update(val, old);
246246 const wide_new = wide_old & ~mask | (@as(WideAtomic, new) << inner_shift);
247 if (@cmpxchgWeak(WideAtomic, wide_ptr, wide_old, wide_new, .SeqCst, .SeqCst)) |new_wide_old| {
247 if (@cmpxchgWeak(WideAtomic, wide_ptr, wide_old, wide_new, .seq_cst, .seq_cst)) |new_wide_old| {
248248 wide_old = new_wide_old;
249249 } else {
250250 return old;
......@@ -270,7 +270,7 @@ inline fn atomic_exchange_N(comptime T: type, ptr: *T, val: T, model: i32) T {
270270 };
271271 return wideUpdate(T, ptr, val, Updater.update);
272272 } else {
273 return @atomicRmw(T, ptr, .Xchg, val, .SeqCst);
273 return @atomicRmw(T, ptr, .Xchg, val, .seq_cst);
274274 }
275275}
276276
......@@ -315,7 +315,7 @@ inline fn atomic_compare_exchange_N(
315315 expected.* = value;
316316 return 0;
317317 } else {
318 if (@cmpxchgStrong(T, ptr, expected.*, desired, .SeqCst, .SeqCst)) |old_value| {
318 if (@cmpxchgStrong(T, ptr, expected.*, desired, .seq_cst, .seq_cst)) |old_value| {
319319 expected.* = old_value;
320320 return 0;
321321 }
......@@ -373,7 +373,7 @@ inline fn fetch_op_N(comptime T: type, comptime op: std.builtin.AtomicRmwOp, ptr
373373 return wideUpdate(T, ptr, val, Updater.update);
374374 }
375375
376 return @atomicRmw(T, ptr, op, val, .SeqCst);
376 return @atomicRmw(T, ptr, op, val, .seq_cst);
377377}
378378
379379fn __atomic_fetch_add_1(ptr: *u8, val: u8, model: i32) callconv(.C) u8 {
lib/compiler_rt/clear_cache.zig+1-1
......@@ -162,7 +162,7 @@ fn clear_cache(start: usize, end: usize) callconv(.C) void {
162162 }
163163}
164164
165const linkage = if (builtin.is_test) std.builtin.GlobalLinkage.Internal else std.builtin.GlobalLinkage.Weak;
165const linkage = if (builtin.is_test) std.builtin.GlobalLinkage.internal else std.builtin.GlobalLinkage.weak;
166166
167167fn exportIt() void {
168168 @export(clear_cache, .{ .name = "__clear_cache", .linkage = linkage });
lib/compiler_rt/common.zig+2-2
......@@ -2,12 +2,12 @@ const std = @import("std");
22const builtin = @import("builtin");
33const native_endian = builtin.cpu.arch.endian();
44
5pub const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Weak;
5pub const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .internal else .weak;
66/// Determines the symbol's visibility to other objects.
77/// For WebAssembly this allows the symbol to be resolved to other modules, but will not
88/// export it to the host runtime.
99pub const visibility: std.builtin.SymbolVisibility =
10 if (builtin.target.isWasm() and linkage != .Internal) .hidden else .default;
10 if (builtin.target.isWasm() and linkage != .internal) .hidden else .default;
1111pub const want_aeabi = switch (builtin.abi) {
1212 .eabi,
1313 .eabihf,
lib/compiler_rt/os_version_check.zig+1-1
......@@ -1,7 +1,7 @@
11const std = @import("std");
22const testing = std.testing;
33const builtin = @import("builtin");
4const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Weak;
4const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .internal else .weak;
55const panic = @import("common.zig").panic;
66
77const have_availability_version_check = builtin.os.tag.isDarwin() and
lib/compiler_rt/stack_probe.zig+2-2
......@@ -8,8 +8,8 @@ const is_test = builtin.is_test;
88const is_gnu = abi.isGnu();
99const is_mingw = os_tag == .windows and is_gnu;
1010
11const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Weak;
12const strong_linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Strong;
11const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .internal else .weak;
12const strong_linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .internal else .strong;
1313pub const panic = @import("common.zig").panic;
1414
1515comptime {
lib/std/Build.zig+1-1
......@@ -645,7 +645,7 @@ pub const ExecutableOptions = struct {
645645 version: ?std.SemanticVersion = null,
646646 optimize: std.builtin.OptimizeMode = .Debug,
647647 code_model: std.builtin.CodeModel = .default,
648 linkage: ?Step.Compile.Linkage = null,
648 linkage: ?std.builtin.LinkMode = null,
649649 max_rss: usize = 0,
650650 link_libc: ?bool = null,
651651 single_threaded: ?bool = null,
lib/std/Build/Module.zig+1-1
......@@ -414,7 +414,7 @@ pub const LinkSystemLibraryOptions = struct {
414414 needed: bool = false,
415415 weak: bool = false,
416416 use_pkg_config: SystemLib.UsePkgConfig = .yes,
417 preferred_link_mode: std.builtin.LinkMode = .Dynamic,
417 preferred_link_mode: std.builtin.LinkMode = .dynamic,
418418 search_strategy: SystemLib.SearchStrategy = .paths_first,
419419};
420420
lib/std/Build/Step/Compile.zig+13-18
......@@ -28,7 +28,7 @@ linker_script: ?LazyPath = null,
2828version_script: ?LazyPath = null,
2929out_filename: []const u8,
3030out_lib_filename: []const u8,
31linkage: ?Linkage = null,
31linkage: ?std.builtin.LinkMode = null,
3232version: ?std.SemanticVersion,
3333kind: Kind,
3434major_only_filename: ?[]const u8,
......@@ -223,7 +223,7 @@ pub const Options = struct {
223223 name: []const u8,
224224 root_module: Module.CreateOptions,
225225 kind: Kind,
226 linkage: ?Linkage = null,
226 linkage: ?std.builtin.LinkMode = null,
227227 version: ?std.SemanticVersion = null,
228228 max_rss: usize = 0,
229229 filters: []const []const u8 = &.{},
......@@ -246,8 +246,6 @@ pub const Kind = enum {
246246 @"test",
247247};
248248
249pub const Linkage = enum { dynamic, static };
250
251249pub fn create(owner: *std.Build, options: Options) *Compile {
252250 const name = owner.dupe(options.name);
253251 if (mem.indexOf(u8, name, "/") != null or mem.indexOf(u8, name, "\\") != null) {
......@@ -283,10 +281,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile {
283281 .obj => .Obj,
284282 .exe, .@"test" => .Exe,
285283 },
286 .link_mode = if (options.linkage) |some| @as(std.builtin.LinkMode, switch (some) {
287 .dynamic => .Dynamic,
288 .static => .Static,
289 }) else null,
284 .link_mode = options.linkage,
290285 .version = options.version,
291286 }) catch @panic("OOM");
292287
......@@ -531,11 +526,11 @@ pub fn dependsOnSystemLibrary(self: *const Compile, name: []const u8) bool {
531526}
532527
533528pub fn isDynamicLibrary(self: *const Compile) bool {
534 return self.kind == .lib and self.linkage == Linkage.dynamic;
529 return self.kind == .lib and self.linkage == .dynamic;
535530}
536531
537532pub fn isStaticLibrary(self: *const Compile) bool {
538 return self.kind == .lib and self.linkage != Linkage.dynamic;
533 return self.kind == .lib and self.linkage != .dynamic;
539534}
540535
541536pub fn producesPdbFile(self: *Compile) bool {
......@@ -988,7 +983,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
988983 var prev_has_cflags = false;
989984 var prev_has_rcflags = false;
990985 var prev_search_strategy: Module.SystemLib.SearchStrategy = .paths_first;
991 var prev_preferred_link_mode: std.builtin.LinkMode = .Dynamic;
986 var prev_preferred_link_mode: std.builtin.LinkMode = .dynamic;
992987 // Track the number of positional arguments so that a nice error can be
993988 // emitted if there is nothing to link.
994989 var total_linker_objects: usize = @intFromBool(self.root_module.root_source_file != null);
......@@ -1053,16 +1048,16 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
10531048 {
10541049 switch (system_lib.search_strategy) {
10551050 .no_fallback => switch (system_lib.preferred_link_mode) {
1056 .Dynamic => try zig_args.append("-search_dylibs_only"),
1057 .Static => try zig_args.append("-search_static_only"),
1051 .dynamic => try zig_args.append("-search_dylibs_only"),
1052 .static => try zig_args.append("-search_static_only"),
10581053 },
10591054 .paths_first => switch (system_lib.preferred_link_mode) {
1060 .Dynamic => try zig_args.append("-search_paths_first"),
1061 .Static => try zig_args.append("-search_paths_first_static"),
1055 .dynamic => try zig_args.append("-search_paths_first"),
1056 .static => try zig_args.append("-search_paths_first_static"),
10621057 },
10631058 .mode_first => switch (system_lib.preferred_link_mode) {
1064 .Dynamic => try zig_args.append("-search_dylibs_first"),
1065 .Static => try zig_args.append("-search_static_first"),
1059 .dynamic => try zig_args.append("-search_dylibs_first"),
1060 .static => try zig_args.append("-search_static_first"),
10661061 },
10671062 }
10681063 prev_search_strategy = system_lib.search_strategy;
......@@ -1138,7 +1133,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
11381133 try zig_args.append(full_path_lib);
11391134 total_linker_objects += 1;
11401135
1141 if (other.linkage == Linkage.dynamic and
1136 if (other.linkage == .dynamic and
11421137 self.rootModuleTarget().os.tag != .windows)
11431138 {
11441139 if (fs.path.dirname(full_path_lib)) |dirname| {
lib/std/Build/Step/TranslateC.zig+1-1
......@@ -55,7 +55,7 @@ pub const AddExecutableOptions = struct {
5555 version: ?std.SemanticVersion = null,
5656 target: ?std.Build.ResolvedTarget = null,
5757 optimize: ?std.builtin.OptimizeMode = null,
58 linkage: ?Step.Compile.Linkage = null,
58 linkage: ?std.builtin.LinkMode = null,
5959};
6060
6161pub fn getOutput(self: *TranslateC) std.Build.LazyPath {
lib/std/Progress.zig+13-13
......@@ -95,9 +95,9 @@ pub const Node = struct {
9595 /// This is the same as calling `start` and then `end` on the returned `Node`. Thread-safe.
9696 pub fn completeOne(self: *Node) void {
9797 if (self.parent) |parent| {
98 @atomicStore(?*Node, &parent.recently_updated_child, self, .Release);
98 @atomicStore(?*Node, &parent.recently_updated_child, self, .release);
9999 }
100 _ = @atomicRmw(usize, &self.unprotected_completed_items, .Add, 1, .Monotonic);
100 _ = @atomicRmw(usize, &self.unprotected_completed_items, .Add, 1, .monotonic);
101101 self.context.maybeRefresh();
102102 }
103103
......@@ -108,7 +108,7 @@ pub const Node = struct {
108108 {
109109 self.context.update_mutex.lock();
110110 defer self.context.update_mutex.unlock();
111 _ = @cmpxchgStrong(?*Node, &parent.recently_updated_child, self, null, .Monotonic, .Monotonic);
111 _ = @cmpxchgStrong(?*Node, &parent.recently_updated_child, self, null, .monotonic, .monotonic);
112112 }
113113 parent.completeOne();
114114 } else {
......@@ -122,7 +122,7 @@ pub const Node = struct {
122122 /// Tell the parent node that this node is actively being worked on. Thread-safe.
123123 pub fn activate(self: *Node) void {
124124 if (self.parent) |parent| {
125 @atomicStore(?*Node, &parent.recently_updated_child, self, .Release);
125 @atomicStore(?*Node, &parent.recently_updated_child, self, .release);
126126 self.context.maybeRefresh();
127127 }
128128 }
......@@ -134,9 +134,9 @@ pub const Node = struct {
134134 defer progress.update_mutex.unlock();
135135 self.name = name;
136136 if (self.parent) |parent| {
137 @atomicStore(?*Node, &parent.recently_updated_child, self, .Release);
137 @atomicStore(?*Node, &parent.recently_updated_child, self, .release);
138138 if (parent.parent) |grand_parent| {
139 @atomicStore(?*Node, &grand_parent.recently_updated_child, parent, .Release);
139 @atomicStore(?*Node, &grand_parent.recently_updated_child, parent, .release);
140140 }
141141 if (progress.timer) |*timer| progress.maybeRefreshWithHeldLock(timer);
142142 }
......@@ -149,9 +149,9 @@ pub const Node = struct {
149149 defer progress.update_mutex.unlock();
150150 self.unit = unit;
151151 if (self.parent) |parent| {
152 @atomicStore(?*Node, &parent.recently_updated_child, self, .Release);
152 @atomicStore(?*Node, &parent.recently_updated_child, self, .release);
153153 if (parent.parent) |grand_parent| {
154 @atomicStore(?*Node, &grand_parent.recently_updated_child, parent, .Release);
154 @atomicStore(?*Node, &grand_parent.recently_updated_child, parent, .release);
155155 }
156156 if (progress.timer) |*timer| progress.maybeRefreshWithHeldLock(timer);
157157 }
......@@ -159,12 +159,12 @@ pub const Node = struct {
159159
160160 /// Thread-safe. 0 means unknown.
161161 pub fn setEstimatedTotalItems(self: *Node, count: usize) void {
162 @atomicStore(usize, &self.unprotected_estimated_total_items, count, .Monotonic);
162 @atomicStore(usize, &self.unprotected_estimated_total_items, count, .monotonic);
163163 }
164164
165165 /// Thread-safe.
166166 pub fn setCompletedItems(self: *Node, completed_items: usize) void {
167 @atomicStore(usize, &self.unprotected_completed_items, completed_items, .Monotonic);
167 @atomicStore(usize, &self.unprotected_completed_items, completed_items, .monotonic);
168168 }
169169};
170170
......@@ -313,8 +313,8 @@ fn refreshWithHeldLock(self: *Progress) void {
313313 self.bufWrite(&end, "... ", .{});
314314 }
315315 need_ellipse = false;
316 const eti = @atomicLoad(usize, &node.unprotected_estimated_total_items, .Monotonic);
317 const completed_items = @atomicLoad(usize, &node.unprotected_completed_items, .Monotonic);
316 const eti = @atomicLoad(usize, &node.unprotected_estimated_total_items, .monotonic);
317 const completed_items = @atomicLoad(usize, &node.unprotected_completed_items, .monotonic);
318318 const current_item = completed_items + 1;
319319 if (node.name.len != 0 or eti > 0) {
320320 if (node.name.len != 0) {
......@@ -331,7 +331,7 @@ fn refreshWithHeldLock(self: *Progress) void {
331331 need_ellipse = false;
332332 }
333333 }
334 maybe_node = @atomicLoad(?*Node, &node.recently_updated_child, .Acquire);
334 maybe_node = @atomicLoad(?*Node, &node.recently_updated_child, .acquire);
335335 }
336336 if (need_ellipse) {
337337 self.bufWrite(&end, "... ", .{});
lib/std/Thread.zig+12-12
......@@ -510,7 +510,7 @@ const WindowsThreadImpl = struct {
510510
511511 fn entryFn(raw_ptr: windows.PVOID) callconv(.C) windows.DWORD {
512512 const self: *@This() = @ptrCast(@alignCast(raw_ptr));
513 defer switch (self.thread.completion.swap(.completed, .SeqCst)) {
513 defer switch (self.thread.completion.swap(.completed, .seq_cst)) {
514514 .running => {},
515515 .completed => unreachable,
516516 .detached => self.thread.free(),
......@@ -563,7 +563,7 @@ const WindowsThreadImpl = struct {
563563
564564 fn detach(self: Impl) void {
565565 windows.CloseHandle(self.thread.thread_handle);
566 switch (self.thread.completion.swap(.detached, .SeqCst)) {
566 switch (self.thread.completion.swap(.detached, .seq_cst)) {
567567 .running => {},
568568 .completed => self.thread.free(),
569569 .detached => unreachable,
......@@ -573,7 +573,7 @@ const WindowsThreadImpl = struct {
573573 fn join(self: Impl) void {
574574 windows.WaitForSingleObjectEx(self.thread.thread_handle, windows.INFINITE, false) catch unreachable;
575575 windows.CloseHandle(self.thread.thread_handle);
576 assert(self.thread.completion.load(.SeqCst) == .completed);
576 assert(self.thread.completion.load(.seq_cst) == .completed);
577577 self.thread.free();
578578 }
579579};
......@@ -780,11 +780,11 @@ const WasiThreadImpl = struct {
780780 }
781781
782782 fn getHandle(self: Impl) ThreadHandle {
783 return self.thread.tid.load(.SeqCst);
783 return self.thread.tid.load(.seq_cst);
784784 }
785785
786786 fn detach(self: Impl) void {
787 switch (self.thread.state.swap(.detached, .SeqCst)) {
787 switch (self.thread.state.swap(.detached, .seq_cst)) {
788788 .running => {},
789789 .completed => self.join(),
790790 .detached => unreachable,
......@@ -801,7 +801,7 @@ const WasiThreadImpl = struct {
801801
802802 var spin: u8 = 10;
803803 while (true) {
804 const tid = self.thread.tid.load(.SeqCst);
804 const tid = self.thread.tid.load(.seq_cst);
805805 if (tid == 0) {
806806 break;
807807 }
......@@ -901,7 +901,7 @@ const WasiThreadImpl = struct {
901901 if (tid < 0) {
902902 return error.SystemResources;
903903 }
904 instance.thread.tid.store(tid, .SeqCst);
904 instance.thread.tid.store(tid, .seq_cst);
905905
906906 return .{ .thread = &instance.thread };
907907 }
......@@ -914,12 +914,12 @@ const WasiThreadImpl = struct {
914914 }
915915 __set_stack_pointer(arg.thread.memory.ptr + arg.stack_offset);
916916 __wasm_init_tls(arg.thread.memory.ptr + arg.tls_offset);
917 @atomicStore(u32, &WasiThreadImpl.tls_thread_id, @intCast(tid), .SeqCst);
917 @atomicStore(u32, &WasiThreadImpl.tls_thread_id, @intCast(tid), .seq_cst);
918918
919919 // Finished bootstrapping, call user's procedure.
920920 arg.call_back(arg.raw_ptr);
921921
922 switch (arg.thread.state.swap(.completed, .SeqCst)) {
922 switch (arg.thread.state.swap(.completed, .seq_cst)) {
923923 .running => {
924924 // reset the Thread ID
925925 asm volatile (
......@@ -1191,7 +1191,7 @@ const LinuxThreadImpl = struct {
11911191
11921192 fn entryFn(raw_arg: usize) callconv(.C) u8 {
11931193 const self = @as(*@This(), @ptrFromInt(raw_arg));
1194 defer switch (self.thread.completion.swap(.completed, .SeqCst)) {
1194 defer switch (self.thread.completion.swap(.completed, .seq_cst)) {
11951195 .running => {},
11961196 .completed => unreachable,
11971197 .detached => self.thread.freeAndExit(),
......@@ -1311,7 +1311,7 @@ const LinuxThreadImpl = struct {
13111311 }
13121312
13131313 fn detach(self: Impl) void {
1314 switch (self.thread.completion.swap(.detached, .SeqCst)) {
1314 switch (self.thread.completion.swap(.detached, .seq_cst)) {
13151315 .running => {},
13161316 .completed => self.join(),
13171317 .detached => unreachable,
......@@ -1323,7 +1323,7 @@ const LinuxThreadImpl = struct {
13231323
13241324 var spin: u8 = 10;
13251325 while (true) {
1326 const tid = self.thread.child_tid.load(.SeqCst);
1326 const tid = self.thread.child_tid.load(.seq_cst);
13271327 if (tid == 0) {
13281328 break;
13291329 }
lib/std/Thread/Condition.zig+12-12
......@@ -163,7 +163,7 @@ const WindowsImpl = struct {
163163
164164 if (comptime builtin.mode == .Debug) {
165165 // The internal state of the DebugMutex needs to be handled here as well.
166 mutex.impl.locking_thread.store(0, .Unordered);
166 mutex.impl.locking_thread.store(0, .unordered);
167167 }
168168 const rc = os.windows.kernel32.SleepConditionVariableSRW(
169169 &self.condition,
......@@ -173,7 +173,7 @@ const WindowsImpl = struct {
173173 );
174174 if (comptime builtin.mode == .Debug) {
175175 // The internal state of the DebugMutex needs to be handled here as well.
176 mutex.impl.locking_thread.store(std.Thread.getCurrentId(), .Unordered);
176 mutex.impl.locking_thread.store(std.Thread.getCurrentId(), .unordered);
177177 }
178178
179179 // Return error.Timeout if we know the timeout elapsed correctly.
......@@ -212,8 +212,8 @@ const FutexImpl = struct {
212212 // - T1: s & signals == 0 -> FUTEX_WAIT(&epoch, e) (missed the state update + the epoch change)
213213 //
214214 // Acquire barrier to ensure the epoch load happens before the state load.
215 var epoch = self.epoch.load(.Acquire);
216 var state = self.state.fetchAdd(one_waiter, .Monotonic);
215 var epoch = self.epoch.load(.acquire);
216 var state = self.state.fetchAdd(one_waiter, .monotonic);
217217 assert(state & waiter_mask != waiter_mask);
218218 state += one_waiter;
219219
......@@ -231,30 +231,30 @@ const FutexImpl = struct {
231231 // Acquire barrier ensures code before the wake() which added the signal happens before we decrement it and return.
232232 while (state & signal_mask != 0) {
233233 const new_state = state - one_waiter - one_signal;
234 state = self.state.cmpxchgWeak(state, new_state, .Acquire, .Monotonic) orelse return;
234 state = self.state.cmpxchgWeak(state, new_state, .acquire, .monotonic) orelse return;
235235 }
236236
237237 // Remove the waiter we added and officially return timed out.
238238 const new_state = state - one_waiter;
239 state = self.state.cmpxchgWeak(state, new_state, .Monotonic, .Monotonic) orelse return err;
239 state = self.state.cmpxchgWeak(state, new_state, .monotonic, .monotonic) orelse return err;
240240 }
241241 },
242242 };
243243
244 epoch = self.epoch.load(.Acquire);
245 state = self.state.load(.Monotonic);
244 epoch = self.epoch.load(.acquire);
245 state = self.state.load(.monotonic);
246246
247247 // Try to wake up by consuming a signal and decremented the waiter we added previously.
248248 // Acquire barrier ensures code before the wake() which added the signal happens before we decrement it and return.
249249 while (state & signal_mask != 0) {
250250 const new_state = state - one_waiter - one_signal;
251 state = self.state.cmpxchgWeak(state, new_state, .Acquire, .Monotonic) orelse return;
251 state = self.state.cmpxchgWeak(state, new_state, .acquire, .monotonic) orelse return;
252252 }
253253 }
254254 }
255255
256256 fn wake(self: *Impl, comptime notify: Notify) void {
257 var state = self.state.load(.Monotonic);
257 var state = self.state.load(.monotonic);
258258 while (true) {
259259 const waiters = (state & waiter_mask) / one_waiter;
260260 const signals = (state & signal_mask) / one_signal;
......@@ -275,7 +275,7 @@ const FutexImpl = struct {
275275 // Reserve the amount of waiters to wake by incrementing the signals count.
276276 // Release barrier ensures code before the wake() happens before the signal it posted and consumed by the wait() threads.
277277 const new_state = state + (one_signal * to_wake);
278 state = self.state.cmpxchgWeak(state, new_state, .Release, .Monotonic) orelse {
278 state = self.state.cmpxchgWeak(state, new_state, .release, .monotonic) orelse {
279279 // Wake up the waiting threads we reserved above by changing the epoch value.
280280 // NOTE: a waiting thread could miss a wake up if *exactly* ((1<<32)-1) wake()s happen between it observing the epoch and sleeping on it.
281281 // This is very unlikely due to how many precise amount of Futex.wake() calls that would be between the waiting thread's potential preemption.
......@@ -288,7 +288,7 @@ const FutexImpl = struct {
288288 // - T1: s = LOAD(&state)
289289 // - T2: UPDATE(&state, signal) + FUTEX_WAKE(&epoch)
290290 // - T1: s & signals == 0 -> FUTEX_WAIT(&epoch, e) (missed both epoch change and state change)
291 _ = self.epoch.fetchAdd(1, .Release);
291 _ = self.epoch.fetchAdd(1, .release);
292292 Futex.wake(&self.epoch, to_wake);
293293 return;
294294 };
lib/std/Thread/Futex.zig+15-15
......@@ -40,7 +40,7 @@ pub fn timedWait(ptr: *const atomic.Value(u32), expect: u32, timeout_ns: u64) er
4040
4141 // Avoid calling into the OS for no-op timeouts.
4242 if (timeout_ns == 0) {
43 if (ptr.load(.SeqCst) != expect) return;
43 if (ptr.load(.seq_cst) != expect) return;
4444 return error.Timeout;
4545 }
4646
......@@ -783,16 +783,16 @@ const PosixImpl = struct {
783783 // - T1: bumps pending waiters (was reordered after the ptr == expect check)
784784 // - T1: goes to sleep and misses both the ptr change and T2's wake up
785785 //
786 // SeqCst as Acquire barrier to ensure the announcement happens before the ptr check below.
787 // SeqCst as shared modification order to form a happens-before edge with the fence(.SeqCst)+load() in wake().
788 var pending = bucket.pending.fetchAdd(1, .SeqCst);
786 // seq_cst as Acquire barrier to ensure the announcement happens before the ptr check below.
787 // seq_cst as shared modification order to form a happens-before edge with the fence(.seq_cst)+load() in wake().
788 var pending = bucket.pending.fetchAdd(1, .seq_cst);
789789 assert(pending < std.math.maxInt(usize));
790790
791791 // If the wait gets cancelled, remove the pending count we previously added.
792792 // This is done outside the mutex lock to keep the critical section short in case of contention.
793793 var cancelled = false;
794794 defer if (cancelled) {
795 pending = bucket.pending.fetchSub(1, .Monotonic);
795 pending = bucket.pending.fetchSub(1, .monotonic);
796796 assert(pending > 0);
797797 };
798798
......@@ -850,11 +850,11 @@ const PosixImpl = struct {
850850 // but the RMW operation unconditionally marks the cache-line as modified for others causing unnecessary fetching/contention.
851851 //
852852 // Instead we opt to do a full-fence + load instead which avoids taking ownership of the cache-line.
853 // fence(SeqCst) effectively converts the ptr update to SeqCst and the pending load to SeqCst: creating a Store-Load barrier.
853 // fence(seq_cst) effectively converts the ptr update to seq_cst and the pending load to seq_cst: creating a Store-Load barrier.
854854 //
855 // The pending count increment in wait() must also now use SeqCst for the update + this pending load
856 // to be in the same modification order as our load isn't using Release/Acquire to guarantee it.
857 bucket.pending.fence(.SeqCst);
855 // The pending count increment in wait() must also now use seq_cst for the update + this pending load
856 // to be in the same modification order as our load isn't using release/acquire to guarantee it.
857 bucket.pending.fence(.seq_cst);
858858 if (bucket.pending.load(.Monotonic) == 0) {
859859 return;
860860 }
......@@ -912,7 +912,7 @@ test "signaling" {
912912 current: u32 = 0,
913913
914914 fn hit(self: *@This()) void {
915 _ = self.value.fetchAdd(1, .Release);
915 _ = self.value.fetchAdd(1, .release);
916916 Futex.wake(&self.value, 1);
917917 }
918918
......@@ -921,7 +921,7 @@ test "signaling" {
921921 // Wait for the value to change from hit()
922922 var new_value: u32 = undefined;
923923 while (true) {
924 new_value = self.value.load(.Acquire);
924 new_value = self.value.load(.acquire);
925925 if (new_value != self.current) break;
926926 Futex.wait(&self.value, self.current);
927927 }
......@@ -968,7 +968,7 @@ test "broadcasting" {
968968 fn wait(self: *@This()) !void {
969969 // Decrement the counter.
970970 // Release ensures stuff before this barrier.wait() happens before the last one.
971 const count = self.count.fetchSub(1, .Release);
971 const count = self.count.fetchSub(1, .release);
972972 try testing.expect(count <= num_threads);
973973 try testing.expect(count > 0);
974974
......@@ -976,15 +976,15 @@ test "broadcasting" {
976976 // Acquire for the last counter ensures stuff before previous barrier.wait()s happened before it.
977977 // Release on futex update ensures stuff before all barrier.wait()'s happens before they all return.
978978 if (count - 1 == 0) {
979 _ = self.count.load(.Acquire); // TODO: could be fence(Acquire) if not for TSAN
980 self.futex.store(1, .Release);
979 _ = self.count.load(.acquire); // TODO: could be fence(acquire) if not for TSAN
980 self.futex.store(1, .release);
981981 Futex.wake(&self.futex, num_threads - 1);
982982 return;
983983 }
984984
985985 // Other threads wait until last counter wakes them up.
986986 // Acquire on futex synchronizes with last barrier count to ensure stuff before all barrier.wait()'s happen before us.
987 while (self.futex.load(.Acquire) == 0) {
987 while (self.futex.load(.acquire) == 0) {
988988 Futex.wait(&self.futex, 0);
989989 }
990990 }
lib/std/Thread/Mutex.zig+10-10
......@@ -72,23 +72,23 @@ const DebugImpl = struct {
7272 inline fn tryLock(self: *@This()) bool {
7373 const locking = self.impl.tryLock();
7474 if (locking) {
75 self.locking_thread.store(Thread.getCurrentId(), .Unordered);
75 self.locking_thread.store(Thread.getCurrentId(), .unordered);
7676 }
7777 return locking;
7878 }
7979
8080 inline fn lock(self: *@This()) void {
8181 const current_id = Thread.getCurrentId();
82 if (self.locking_thread.load(.Unordered) == current_id and current_id != 0) {
82 if (self.locking_thread.load(.unordered) == current_id and current_id != 0) {
8383 @panic("Deadlock detected");
8484 }
8585 self.impl.lock();
86 self.locking_thread.store(current_id, .Unordered);
86 self.locking_thread.store(current_id, .unordered);
8787 }
8888
8989 inline fn unlock(self: *@This()) void {
90 assert(self.locking_thread.load(.Unordered) == Thread.getCurrentId());
91 self.locking_thread.store(0, .Unordered);
90 assert(self.locking_thread.load(.unordered) == Thread.getCurrentId());
91 self.locking_thread.store(0, .unordered);
9292 self.impl.unlock();
9393 }
9494};
......@@ -167,12 +167,12 @@ const FutexImpl = struct {
167167 // - `lock bts` is smaller instruction-wise which makes it better for inlining
168168 if (comptime builtin.target.cpu.arch.isX86()) {
169169 const locked_bit = @ctz(locked);
170 return self.state.bitSet(locked_bit, .Acquire) == 0;
170 return self.state.bitSet(locked_bit, .acquire) == 0;
171171 }
172172
173173 // Acquire barrier ensures grabbing the lock happens before the critical section
174174 // and that the previous lock holder's critical section happens before we grab the lock.
175 return self.state.cmpxchgWeak(unlocked, locked, .Acquire, .Monotonic) == null;
175 return self.state.cmpxchgWeak(unlocked, locked, .acquire, .monotonic) == null;
176176 }
177177
178178 fn lockSlow(self: *@This()) void {
......@@ -180,7 +180,7 @@ const FutexImpl = struct {
180180
181181 // Avoid doing an atomic swap below if we already know the state is contended.
182182 // An atomic swap unconditionally stores which marks the cache-line as modified unnecessarily.
183 if (self.state.load(.Monotonic) == contended) {
183 if (self.state.load(.monotonic) == contended) {
184184 Futex.wait(&self.state, contended);
185185 }
186186
......@@ -193,7 +193,7 @@ const FutexImpl = struct {
193193 //
194194 // Acquire barrier ensures grabbing the lock happens before the critical section
195195 // and that the previous lock holder's critical section happens before we grab the lock.
196 while (self.state.swap(contended, .Acquire) != unlocked) {
196 while (self.state.swap(contended, .acquire) != unlocked) {
197197 Futex.wait(&self.state, contended);
198198 }
199199 }
......@@ -206,7 +206,7 @@ const FutexImpl = struct {
206206 //
207207 // Release barrier ensures the critical section happens before we let go of the lock
208208 // and that our critical section happens before the next lock holder grabs the lock.
209 const state = self.state.swap(unlocked, .Release);
209 const state = self.state.swap(unlocked, .release);
210210 assert(state != unlocked);
211211
212212 if (state == contended) {
lib/std/Thread/ResetEvent.zig+9-9
......@@ -96,7 +96,7 @@ const FutexImpl = struct {
9696
9797 fn isSet(self: *const Impl) bool {
9898 // Acquire barrier ensures memory accesses before set() happen before we return true.
99 return self.state.load(.Acquire) == is_set;
99 return self.state.load(.acquire) == is_set;
100100 }
101101
102102 fn wait(self: *Impl, timeout: ?u64) error{Timeout}!void {
......@@ -112,9 +112,9 @@ const FutexImpl = struct {
112112 // Try to set the state from `unset` to `waiting` to indicate
113113 // to the set() thread that others are blocked on the ResetEvent.
114114 // We avoid using any strict barriers until the end when we know the ResetEvent is set.
115 var state = self.state.load(.Monotonic);
115 var state = self.state.load(.monotonic);
116116 if (state == unset) {
117 state = self.state.cmpxchgStrong(state, waiting, .Monotonic, .Monotonic) orelse waiting;
117 state = self.state.cmpxchgStrong(state, waiting, .monotonic, .monotonic) orelse waiting;
118118 }
119119
120120 // Wait until the ResetEvent is set since the state is waiting.
......@@ -124,7 +124,7 @@ const FutexImpl = struct {
124124 const wait_result = futex_deadline.wait(&self.state, waiting);
125125
126126 // Check if the ResetEvent was set before possibly reporting error.Timeout below.
127 state = self.state.load(.Monotonic);
127 state = self.state.load(.monotonic);
128128 if (state != waiting) {
129129 break;
130130 }
......@@ -135,25 +135,25 @@ const FutexImpl = struct {
135135
136136 // Acquire barrier ensures memory accesses before set() happen before we return.
137137 assert(state == is_set);
138 self.state.fence(.Acquire);
138 self.state.fence(.acquire);
139139 }
140140
141141 fn set(self: *Impl) void {
142142 // Quick check if the ResetEvent is already set before doing the atomic swap below.
143143 // set() could be getting called quite often and multiple threads calling swap() increases contention unnecessarily.
144 if (self.state.load(.Monotonic) == is_set) {
144 if (self.state.load(.monotonic) == is_set) {
145145 return;
146146 }
147147
148148 // Mark the ResetEvent as set and unblock all waiters waiting on it if any.
149149 // Release barrier ensures memory accesses before set() happen before the ResetEvent is observed to be "set".
150 if (self.state.swap(is_set, .Release) == waiting) {
150 if (self.state.swap(is_set, .release) == waiting) {
151151 Futex.wake(&self.state, std.math.maxInt(u32));
152152 }
153153 }
154154
155155 fn reset(self: *Impl) void {
156 self.state.store(unset, .Monotonic);
156 self.state.store(unset, .monotonic);
157157 }
158158};
159159
......@@ -254,7 +254,7 @@ test "broadcast" {
254254 counter: std.atomic.Value(usize) = std.atomic.Value(usize).init(num_threads),
255255
256256 fn wait(self: *@This()) void {
257 if (self.counter.fetchSub(1, .AcqRel) == 1) {
257 if (self.counter.fetchSub(1, .acq_rel) == 1) {
258258 self.event.set();
259259 }
260260 }
lib/std/Thread/RwLock.zig+16-16
......@@ -179,9 +179,9 @@ pub const DefaultRwLock = struct {
179179
180180 pub fn tryLock(rwl: *DefaultRwLock) bool {
181181 if (rwl.mutex.tryLock()) {
182 const state = @atomicLoad(usize, &rwl.state, .SeqCst);
182 const state = @atomicLoad(usize, &rwl.state, .seq_cst);
183183 if (state & READER_MASK == 0) {
184 _ = @atomicRmw(usize, &rwl.state, .Or, IS_WRITING, .SeqCst);
184 _ = @atomicRmw(usize, &rwl.state, .Or, IS_WRITING, .seq_cst);
185185 return true;
186186 }
187187
......@@ -192,34 +192,34 @@ pub const DefaultRwLock = struct {
192192 }
193193
194194 pub fn lock(rwl: *DefaultRwLock) void {
195 _ = @atomicRmw(usize, &rwl.state, .Add, WRITER, .SeqCst);
195 _ = @atomicRmw(usize, &rwl.state, .Add, WRITER, .seq_cst);
196196 rwl.mutex.lock();
197197
198 const state = @atomicRmw(usize, &rwl.state, .Add, IS_WRITING -% WRITER, .SeqCst);
198 const state = @atomicRmw(usize, &rwl.state, .Add, IS_WRITING -% WRITER, .seq_cst);
199199 if (state & READER_MASK != 0)
200200 rwl.semaphore.wait();
201201 }
202202
203203 pub fn unlock(rwl: *DefaultRwLock) void {
204 _ = @atomicRmw(usize, &rwl.state, .And, ~IS_WRITING, .SeqCst);
204 _ = @atomicRmw(usize, &rwl.state, .And, ~IS_WRITING, .seq_cst);
205205 rwl.mutex.unlock();
206206 }
207207
208208 pub fn tryLockShared(rwl: *DefaultRwLock) bool {
209 const state = @atomicLoad(usize, &rwl.state, .SeqCst);
209 const state = @atomicLoad(usize, &rwl.state, .seq_cst);
210210 if (state & (IS_WRITING | WRITER_MASK) == 0) {
211211 _ = @cmpxchgStrong(
212212 usize,
213213 &rwl.state,
214214 state,
215215 state + READER,
216 .SeqCst,
217 .SeqCst,
216 .seq_cst,
217 .seq_cst,
218218 ) orelse return true;
219219 }
220220
221221 if (rwl.mutex.tryLock()) {
222 _ = @atomicRmw(usize, &rwl.state, .Add, READER, .SeqCst);
222 _ = @atomicRmw(usize, &rwl.state, .Add, READER, .seq_cst);
223223 rwl.mutex.unlock();
224224 return true;
225225 }
......@@ -228,25 +228,25 @@ pub const DefaultRwLock = struct {
228228 }
229229
230230 pub fn lockShared(rwl: *DefaultRwLock) void {
231 var state = @atomicLoad(usize, &rwl.state, .SeqCst);
231 var state = @atomicLoad(usize, &rwl.state, .seq_cst);
232232 while (state & (IS_WRITING | WRITER_MASK) == 0) {
233233 state = @cmpxchgWeak(
234234 usize,
235235 &rwl.state,
236236 state,
237237 state + READER,
238 .SeqCst,
239 .SeqCst,
238 .seq_cst,
239 .seq_cst,
240240 ) orelse return;
241241 }
242242
243243 rwl.mutex.lock();
244 _ = @atomicRmw(usize, &rwl.state, .Add, READER, .SeqCst);
244 _ = @atomicRmw(usize, &rwl.state, .Add, READER, .seq_cst);
245245 rwl.mutex.unlock();
246246 }
247247
248248 pub fn unlockShared(rwl: *DefaultRwLock) void {
249 const state = @atomicRmw(usize, &rwl.state, .Sub, READER, .SeqCst);
249 const state = @atomicRmw(usize, &rwl.state, .Sub, READER, .seq_cst);
250250
251251 if ((state & READER_MASK == READER) and (state & IS_WRITING != 0))
252252 rwl.semaphore.post();
......@@ -318,12 +318,12 @@ test "concurrent access" {
318318 self.rwl.lockShared();
319319 defer self.rwl.unlockShared();
320320
321 if (self.writes >= num_writes or self.reads.load(.Unordered) >= num_reads)
321 if (self.writes >= num_writes or self.reads.load(.unordered) >= num_reads)
322322 break;
323323
324324 try self.check();
325325
326 _ = self.reads.fetchAdd(1, .Monotonic);
326 _ = self.reads.fetchAdd(1, .monotonic);
327327 }
328328 }
329329
lib/std/Thread/WaitGroup.zig+6-6
......@@ -10,22 +10,22 @@ state: std.atomic.Value(usize) = std.atomic.Value(usize).init(0),
1010event: std.Thread.ResetEvent = .{},
1111
1212pub fn start(self: *WaitGroup) void {
13 const state = self.state.fetchAdd(one_pending, .Monotonic);
13 const state = self.state.fetchAdd(one_pending, .monotonic);
1414 assert((state / one_pending) < (std.math.maxInt(usize) / one_pending));
1515}
1616
1717pub fn finish(self: *WaitGroup) void {
18 const state = self.state.fetchSub(one_pending, .Release);
18 const state = self.state.fetchSub(one_pending, .release);
1919 assert((state / one_pending) > 0);
2020
2121 if (state == (one_pending | is_waiting)) {
22 self.state.fence(.Acquire);
22 self.state.fence(.acquire);
2323 self.event.set();
2424 }
2525}
2626
2727pub fn wait(self: *WaitGroup) void {
28 const state = self.state.fetchAdd(is_waiting, .Acquire);
28 const state = self.state.fetchAdd(is_waiting, .acquire);
2929 assert(state & is_waiting == 0);
3030
3131 if ((state / one_pending) > 0) {
......@@ -34,12 +34,12 @@ pub fn wait(self: *WaitGroup) void {
3434}
3535
3636pub fn reset(self: *WaitGroup) void {
37 self.state.store(0, .Monotonic);
37 self.state.store(0, .monotonic);
3838 self.event.reset();
3939}
4040
4141pub fn isDone(wg: *WaitGroup) bool {
42 const state = wg.state.load(.Acquire);
42 const state = wg.state.load(.acquire);
4343 assert(state & is_waiting == 0);
4444
4545 return (state / one_pending) == 0;
lib/std/atomic.zig+82-82
......@@ -23,10 +23,10 @@ pub fn Value(comptime T: type) type {
2323
2424 const addr: *anyopaque = self;
2525 return switch (order) {
26 .Unordered, .Monotonic => @compileError(@tagName(order) ++ " only applies to atomic loads and stores"),
27 .Acquire => tsan.__tsan_acquire(addr),
28 .Release => tsan.__tsan_release(addr),
29 .AcqRel, .SeqCst => {
26 .unordered, .monotonic => @compileError(@tagName(order) ++ " only applies to atomic loads and stores"),
27 .acquire => tsan.__tsan_acquire(addr),
28 .release => tsan.__tsan_release(addr),
29 .acq_rel, .seq_cst => {
3030 tsan.__tsan_acquire(addr);
3131 tsan.__tsan_release(addr);
3232 },
......@@ -149,20 +149,20 @@ test Value {
149149
150150 fn ref(rc: *RefCount) void {
151151 // No ordering necessary; just updating a counter.
152 _ = rc.count.fetchAdd(1, .Monotonic);
152 _ = rc.count.fetchAdd(1, .monotonic);
153153 }
154154
155155 fn unref(rc: *RefCount) void {
156156 // Release ensures code before unref() happens-before the
157157 // count is decremented as dropFn could be called by then.
158 if (rc.count.fetchSub(1, .Release) == 1) {
159 // Acquire ensures count decrement and code before
158 if (rc.count.fetchSub(1, .release) == 1) {
159 // acquire ensures count decrement and code before
160160 // previous unrefs()s happens-before we call dropFn
161161 // below.
162162 // Another alternative is to use .AcqRel on the
163163 // fetchSub count decrement but it's extra barrier in
164164 // possibly hot path.
165 rc.count.fence(.Acquire);
165 rc.count.fence(.acquire);
166166 (rc.dropFn)(rc);
167167 }
168168 }
......@@ -182,118 +182,118 @@ test Value {
182182
183183test "Value.swap" {
184184 var x = Value(usize).init(5);
185 try testing.expectEqual(@as(usize, 5), x.swap(10, .SeqCst));
186 try testing.expectEqual(@as(usize, 10), x.load(.SeqCst));
185 try testing.expectEqual(@as(usize, 5), x.swap(10, .seq_cst));
186 try testing.expectEqual(@as(usize, 10), x.load(.seq_cst));
187187
188188 const E = enum(usize) { a, b, c };
189189 var y = Value(E).init(.c);
190 try testing.expectEqual(E.c, y.swap(.a, .SeqCst));
191 try testing.expectEqual(E.a, y.load(.SeqCst));
190 try testing.expectEqual(E.c, y.swap(.a, .seq_cst));
191 try testing.expectEqual(E.a, y.load(.seq_cst));
192192
193193 var z = Value(f32).init(5.0);
194 try testing.expectEqual(@as(f32, 5.0), z.swap(10.0, .SeqCst));
195 try testing.expectEqual(@as(f32, 10.0), z.load(.SeqCst));
194 try testing.expectEqual(@as(f32, 5.0), z.swap(10.0, .seq_cst));
195 try testing.expectEqual(@as(f32, 10.0), z.load(.seq_cst));
196196
197197 var a = Value(bool).init(false);
198 try testing.expectEqual(false, a.swap(true, .SeqCst));
199 try testing.expectEqual(true, a.load(.SeqCst));
198 try testing.expectEqual(false, a.swap(true, .seq_cst));
199 try testing.expectEqual(true, a.load(.seq_cst));
200200
201201 var b = Value(?*u8).init(null);
202 try testing.expectEqual(@as(?*u8, null), b.swap(@as(?*u8, @ptrFromInt(@alignOf(u8))), .SeqCst));
203 try testing.expectEqual(@as(?*u8, @ptrFromInt(@alignOf(u8))), b.load(.SeqCst));
202 try testing.expectEqual(@as(?*u8, null), b.swap(@as(?*u8, @ptrFromInt(@alignOf(u8))), .seq_cst));
203 try testing.expectEqual(@as(?*u8, @ptrFromInt(@alignOf(u8))), b.load(.seq_cst));
204204}
205205
206206test "Value.store" {
207207 var x = Value(usize).init(5);
208 x.store(10, .SeqCst);
209 try testing.expectEqual(@as(usize, 10), x.load(.SeqCst));
208 x.store(10, .seq_cst);
209 try testing.expectEqual(@as(usize, 10), x.load(.seq_cst));
210210}
211211
212212test "Value.cmpxchgWeak" {
213213 var x = Value(usize).init(0);
214214
215 try testing.expectEqual(@as(?usize, 0), x.cmpxchgWeak(1, 0, .SeqCst, .SeqCst));
216 try testing.expectEqual(@as(usize, 0), x.load(.SeqCst));
215 try testing.expectEqual(@as(?usize, 0), x.cmpxchgWeak(1, 0, .seq_cst, .seq_cst));
216 try testing.expectEqual(@as(usize, 0), x.load(.seq_cst));
217217
218 while (x.cmpxchgWeak(0, 1, .SeqCst, .SeqCst)) |_| {}
219 try testing.expectEqual(@as(usize, 1), x.load(.SeqCst));
218 while (x.cmpxchgWeak(0, 1, .seq_cst, .seq_cst)) |_| {}
219 try testing.expectEqual(@as(usize, 1), x.load(.seq_cst));
220220
221 while (x.cmpxchgWeak(1, 0, .SeqCst, .SeqCst)) |_| {}
222 try testing.expectEqual(@as(usize, 0), x.load(.SeqCst));
221 while (x.cmpxchgWeak(1, 0, .seq_cst, .seq_cst)) |_| {}
222 try testing.expectEqual(@as(usize, 0), x.load(.seq_cst));
223223}
224224
225225test "Value.cmpxchgStrong" {
226226 var x = Value(usize).init(0);
227 try testing.expectEqual(@as(?usize, 0), x.cmpxchgStrong(1, 0, .SeqCst, .SeqCst));
228 try testing.expectEqual(@as(usize, 0), x.load(.SeqCst));
229 try testing.expectEqual(@as(?usize, null), x.cmpxchgStrong(0, 1, .SeqCst, .SeqCst));
230 try testing.expectEqual(@as(usize, 1), x.load(.SeqCst));
231 try testing.expectEqual(@as(?usize, null), x.cmpxchgStrong(1, 0, .SeqCst, .SeqCst));
232 try testing.expectEqual(@as(usize, 0), x.load(.SeqCst));
227 try testing.expectEqual(@as(?usize, 0), x.cmpxchgStrong(1, 0, .seq_cst, .seq_cst));
228 try testing.expectEqual(@as(usize, 0), x.load(.seq_cst));
229 try testing.expectEqual(@as(?usize, null), x.cmpxchgStrong(0, 1, .seq_cst, .seq_cst));
230 try testing.expectEqual(@as(usize, 1), x.load(.seq_cst));
231 try testing.expectEqual(@as(?usize, null), x.cmpxchgStrong(1, 0, .seq_cst, .seq_cst));
232 try testing.expectEqual(@as(usize, 0), x.load(.seq_cst));
233233}
234234
235235test "Value.fetchAdd" {
236236 var x = Value(usize).init(5);
237 try testing.expectEqual(@as(usize, 5), x.fetchAdd(5, .SeqCst));
238 try testing.expectEqual(@as(usize, 10), x.load(.SeqCst));
239 try testing.expectEqual(@as(usize, 10), x.fetchAdd(std.math.maxInt(usize), .SeqCst));
240 try testing.expectEqual(@as(usize, 9), x.load(.SeqCst));
237 try testing.expectEqual(@as(usize, 5), x.fetchAdd(5, .seq_cst));
238 try testing.expectEqual(@as(usize, 10), x.load(.seq_cst));
239 try testing.expectEqual(@as(usize, 10), x.fetchAdd(std.math.maxInt(usize), .seq_cst));
240 try testing.expectEqual(@as(usize, 9), x.load(.seq_cst));
241241}
242242
243243test "Value.fetchSub" {
244244 var x = Value(usize).init(5);
245 try testing.expectEqual(@as(usize, 5), x.fetchSub(5, .SeqCst));
246 try testing.expectEqual(@as(usize, 0), x.load(.SeqCst));
247 try testing.expectEqual(@as(usize, 0), x.fetchSub(1, .SeqCst));
248 try testing.expectEqual(@as(usize, std.math.maxInt(usize)), x.load(.SeqCst));
245 try testing.expectEqual(@as(usize, 5), x.fetchSub(5, .seq_cst));
246 try testing.expectEqual(@as(usize, 0), x.load(.seq_cst));
247 try testing.expectEqual(@as(usize, 0), x.fetchSub(1, .seq_cst));
248 try testing.expectEqual(@as(usize, std.math.maxInt(usize)), x.load(.seq_cst));
249249}
250250
251251test "Value.fetchMin" {
252252 var x = Value(usize).init(5);
253 try testing.expectEqual(@as(usize, 5), x.fetchMin(0, .SeqCst));
254 try testing.expectEqual(@as(usize, 0), x.load(.SeqCst));
255 try testing.expectEqual(@as(usize, 0), x.fetchMin(10, .SeqCst));
256 try testing.expectEqual(@as(usize, 0), x.load(.SeqCst));
253 try testing.expectEqual(@as(usize, 5), x.fetchMin(0, .seq_cst));
254 try testing.expectEqual(@as(usize, 0), x.load(.seq_cst));
255 try testing.expectEqual(@as(usize, 0), x.fetchMin(10, .seq_cst));
256 try testing.expectEqual(@as(usize, 0), x.load(.seq_cst));
257257}
258258
259259test "Value.fetchMax" {
260260 var x = Value(usize).init(5);
261 try testing.expectEqual(@as(usize, 5), x.fetchMax(10, .SeqCst));
262 try testing.expectEqual(@as(usize, 10), x.load(.SeqCst));
263 try testing.expectEqual(@as(usize, 10), x.fetchMax(5, .SeqCst));
264 try testing.expectEqual(@as(usize, 10), x.load(.SeqCst));
261 try testing.expectEqual(@as(usize, 5), x.fetchMax(10, .seq_cst));
262 try testing.expectEqual(@as(usize, 10), x.load(.seq_cst));
263 try testing.expectEqual(@as(usize, 10), x.fetchMax(5, .seq_cst));
264 try testing.expectEqual(@as(usize, 10), x.load(.seq_cst));
265265}
266266
267267test "Value.fetchAnd" {
268268 var x = Value(usize).init(0b11);
269 try testing.expectEqual(@as(usize, 0b11), x.fetchAnd(0b10, .SeqCst));
270 try testing.expectEqual(@as(usize, 0b10), x.load(.SeqCst));
271 try testing.expectEqual(@as(usize, 0b10), x.fetchAnd(0b00, .SeqCst));
272 try testing.expectEqual(@as(usize, 0b00), x.load(.SeqCst));
269 try testing.expectEqual(@as(usize, 0b11), x.fetchAnd(0b10, .seq_cst));
270 try testing.expectEqual(@as(usize, 0b10), x.load(.seq_cst));
271 try testing.expectEqual(@as(usize, 0b10), x.fetchAnd(0b00, .seq_cst));
272 try testing.expectEqual(@as(usize, 0b00), x.load(.seq_cst));
273273}
274274
275275test "Value.fetchNand" {
276276 var x = Value(usize).init(0b11);
277 try testing.expectEqual(@as(usize, 0b11), x.fetchNand(0b10, .SeqCst));
278 try testing.expectEqual(~@as(usize, 0b10), x.load(.SeqCst));
279 try testing.expectEqual(~@as(usize, 0b10), x.fetchNand(0b00, .SeqCst));
280 try testing.expectEqual(~@as(usize, 0b00), x.load(.SeqCst));
277 try testing.expectEqual(@as(usize, 0b11), x.fetchNand(0b10, .seq_cst));
278 try testing.expectEqual(~@as(usize, 0b10), x.load(.seq_cst));
279 try testing.expectEqual(~@as(usize, 0b10), x.fetchNand(0b00, .seq_cst));
280 try testing.expectEqual(~@as(usize, 0b00), x.load(.seq_cst));
281281}
282282
283283test "Value.fetchOr" {
284284 var x = Value(usize).init(0b11);
285 try testing.expectEqual(@as(usize, 0b11), x.fetchOr(0b100, .SeqCst));
286 try testing.expectEqual(@as(usize, 0b111), x.load(.SeqCst));
287 try testing.expectEqual(@as(usize, 0b111), x.fetchOr(0b010, .SeqCst));
288 try testing.expectEqual(@as(usize, 0b111), x.load(.SeqCst));
285 try testing.expectEqual(@as(usize, 0b11), x.fetchOr(0b100, .seq_cst));
286 try testing.expectEqual(@as(usize, 0b111), x.load(.seq_cst));
287 try testing.expectEqual(@as(usize, 0b111), x.fetchOr(0b010, .seq_cst));
288 try testing.expectEqual(@as(usize, 0b111), x.load(.seq_cst));
289289}
290290
291291test "Value.fetchXor" {
292292 var x = Value(usize).init(0b11);
293 try testing.expectEqual(@as(usize, 0b11), x.fetchXor(0b10, .SeqCst));
294 try testing.expectEqual(@as(usize, 0b01), x.load(.SeqCst));
295 try testing.expectEqual(@as(usize, 0b01), x.fetchXor(0b01, .SeqCst));
296 try testing.expectEqual(@as(usize, 0b00), x.load(.SeqCst));
293 try testing.expectEqual(@as(usize, 0b11), x.fetchXor(0b10, .seq_cst));
294 try testing.expectEqual(@as(usize, 0b01), x.load(.seq_cst));
295 try testing.expectEqual(@as(usize, 0b01), x.fetchXor(0b01, .seq_cst));
296 try testing.expectEqual(@as(usize, 0b00), x.load(.seq_cst));
297297}
298298
299299test "Value.bitSet" {
......@@ -304,19 +304,19 @@ test "Value.bitSet" {
304304 const mask = @as(usize, 1) << bit;
305305
306306 // setting the bit should change the bit
307 try testing.expect(x.load(.SeqCst) & mask == 0);
308 try testing.expectEqual(@as(u1, 0), x.bitSet(bit, .SeqCst));
309 try testing.expect(x.load(.SeqCst) & mask != 0);
307 try testing.expect(x.load(.seq_cst) & mask == 0);
308 try testing.expectEqual(@as(u1, 0), x.bitSet(bit, .seq_cst));
309 try testing.expect(x.load(.seq_cst) & mask != 0);
310310
311311 // setting it again shouldn't change the bit
312 try testing.expectEqual(@as(u1, 1), x.bitSet(bit, .SeqCst));
313 try testing.expect(x.load(.SeqCst) & mask != 0);
312 try testing.expectEqual(@as(u1, 1), x.bitSet(bit, .seq_cst));
313 try testing.expect(x.load(.seq_cst) & mask != 0);
314314
315315 // all the previous bits should have not changed (still be set)
316316 for (0..bit_index) |prev_bit_index| {
317317 const prev_bit = @as(std.math.Log2Int(usize), @intCast(prev_bit_index));
318318 const prev_mask = @as(usize, 1) << prev_bit;
319 try testing.expect(x.load(.SeqCst) & prev_mask != 0);
319 try testing.expect(x.load(.seq_cst) & prev_mask != 0);
320320 }
321321 }
322322}
......@@ -330,19 +330,19 @@ test "Value.bitReset" {
330330 x.raw |= mask;
331331
332332 // unsetting the bit should change the bit
333 try testing.expect(x.load(.SeqCst) & mask != 0);
334 try testing.expectEqual(@as(u1, 1), x.bitReset(bit, .SeqCst));
335 try testing.expect(x.load(.SeqCst) & mask == 0);
333 try testing.expect(x.load(.seq_cst) & mask != 0);
334 try testing.expectEqual(@as(u1, 1), x.bitReset(bit, .seq_cst));
335 try testing.expect(x.load(.seq_cst) & mask == 0);
336336
337337 // unsetting it again shouldn't change the bit
338 try testing.expectEqual(@as(u1, 0), x.bitReset(bit, .SeqCst));
339 try testing.expect(x.load(.SeqCst) & mask == 0);
338 try testing.expectEqual(@as(u1, 0), x.bitReset(bit, .seq_cst));
339 try testing.expect(x.load(.seq_cst) & mask == 0);
340340
341341 // all the previous bits should have not changed (still be reset)
342342 for (0..bit_index) |prev_bit_index| {
343343 const prev_bit = @as(std.math.Log2Int(usize), @intCast(prev_bit_index));
344344 const prev_mask = @as(usize, 1) << prev_bit;
345 try testing.expect(x.load(.SeqCst) & prev_mask == 0);
345 try testing.expect(x.load(.seq_cst) & prev_mask == 0);
346346 }
347347 }
348348}
......@@ -355,19 +355,19 @@ test "Value.bitToggle" {
355355 const mask = @as(usize, 1) << bit;
356356
357357 // toggling the bit should change the bit
358 try testing.expect(x.load(.SeqCst) & mask == 0);
359 try testing.expectEqual(@as(u1, 0), x.bitToggle(bit, .SeqCst));
360 try testing.expect(x.load(.SeqCst) & mask != 0);
358 try testing.expect(x.load(.seq_cst) & mask == 0);
359 try testing.expectEqual(@as(u1, 0), x.bitToggle(bit, .seq_cst));
360 try testing.expect(x.load(.seq_cst) & mask != 0);
361361
362362 // toggling it again *should* change the bit
363 try testing.expectEqual(@as(u1, 1), x.bitToggle(bit, .SeqCst));
364 try testing.expect(x.load(.SeqCst) & mask == 0);
363 try testing.expectEqual(@as(u1, 1), x.bitToggle(bit, .seq_cst));
364 try testing.expect(x.load(.seq_cst) & mask == 0);
365365
366366 // all the previous bits should have not changed (still be toggled back)
367367 for (0..bit_index) |prev_bit_index| {
368368 const prev_bit = @as(std.math.Log2Int(usize), @intCast(prev_bit_index));
369369 const prev_mask = @as(usize, 1) << prev_bit;
370 try testing.expect(x.load(.SeqCst) & prev_mask == 0);
370 try testing.expect(x.load(.seq_cst) & prev_mask == 0);
371371 }
372372 }
373373}
lib/std/builtin.zig+20-20
......@@ -64,10 +64,10 @@ pub const StackTrace = struct {
6464/// This data structure is used by the Zig language code generation and
6565/// therefore must be kept in sync with the compiler implementation.
6666pub const GlobalLinkage = enum {
67 Internal,
68 Strong,
69 Weak,
70 LinkOnce,
67 internal,
68 strong,
69 weak,
70 link_once,
7171};
7272
7373/// This data structure is used by the Zig language code generation and
......@@ -81,12 +81,12 @@ pub const SymbolVisibility = enum {
8181/// This data structure is used by the Zig language code generation and
8282/// therefore must be kept in sync with the compiler implementation.
8383pub const AtomicOrder = enum {
84 Unordered,
85 Monotonic,
86 Acquire,
87 Release,
88 AcqRel,
89 SeqCst,
84 unordered,
85 monotonic,
86 acquire,
87 release,
88 acq_rel,
89 seq_cst,
9090};
9191
9292/// This data structure is used by the Zig language code generation and
......@@ -334,9 +334,9 @@ pub const Type = union(enum) {
334334 /// This data structure is used by the Zig language code generation and
335335 /// therefore must be kept in sync with the compiler implementation.
336336 pub const ContainerLayout = enum(u2) {
337 Auto,
338 Extern,
339 Packed,
337 auto,
338 @"extern",
339 @"packed",
340340 };
341341
342342 /// This data structure is used by the Zig language code generation and
......@@ -353,7 +353,7 @@ pub const Type = union(enum) {
353353 /// therefore must be kept in sync with the compiler implementation.
354354 pub const Struct = struct {
355355 layout: ContainerLayout,
356 /// Only valid if layout is .Packed
356 /// Only valid if layout is .@"packed"
357357 backing_integer: ?type = null,
358358 fields: []const StructField,
359359 decls: []const Declaration,
......@@ -471,8 +471,8 @@ pub const Type = union(enum) {
471471/// This data structure is used by the Zig language code generation and
472472/// therefore must be kept in sync with the compiler implementation.
473473pub const FloatMode = enum {
474 Strict,
475 Optimized,
474 strict,
475 optimized,
476476};
477477
478478/// This data structure is used by the Zig language code generation and
......@@ -500,8 +500,8 @@ pub const OutputMode = enum {
500500/// This data structure is used by the Zig language code generation and
501501/// therefore must be kept in sync with the compiler implementation.
502502pub const LinkMode = enum {
503 Static,
504 Dynamic,
503 static,
504 dynamic,
505505};
506506
507507/// This data structure is used by the Zig language code generation and
......@@ -659,7 +659,7 @@ pub const PrefetchOptions = struct {
659659/// therefore must be kept in sync with the compiler implementation.
660660pub const ExportOptions = struct {
661661 name: []const u8,
662 linkage: GlobalLinkage = .Strong,
662 linkage: GlobalLinkage = .strong,
663663 section: ?[]const u8 = null,
664664 visibility: SymbolVisibility = .default,
665665};
......@@ -669,7 +669,7 @@ pub const ExportOptions = struct {
669669pub const ExternOptions = struct {
670670 name: []const u8,
671671 library_name: ?[]const u8 = null,
672 linkage: GlobalLinkage = .Strong,
672 linkage: GlobalLinkage = .strong,
673673 is_thread_local: bool = false,
674674};
675675
lib/std/c/darwin.zig+1-1
......@@ -202,7 +202,7 @@ var dummy_execute_header: mach_hdr = undefined;
202202pub extern var _mh_execute_header: mach_hdr;
203203comptime {
204204 if (builtin.target.isDarwin()) {
205 @export(dummy_execute_header, .{ .name = "_mh_execute_header", .linkage = .Weak });
205 @export(dummy_execute_header, .{ .name = "_mh_execute_header", .linkage = .weak });
206206 }
207207}
208208
lib/std/child_process.zig+1-1
......@@ -1420,7 +1420,7 @@ fn windowsMakeAsyncPipe(rd: *?windows.HANDLE, wr: *?windows.HANDLE, sattr: *cons
14201420 const pipe_path = std.fmt.bufPrintZ(
14211421 &tmp_buf,
14221422 "\\\\.\\pipe\\zig-childprocess-{d}-{d}",
1423 .{ windows.kernel32.GetCurrentProcessId(), pipe_name_counter.fetchAdd(1, .Monotonic) },
1423 .{ windows.kernel32.GetCurrentProcessId(), pipe_name_counter.fetchAdd(1, .monotonic) },
14241424 ) catch unreachable;
14251425 const len = std.unicode.wtf8ToWtf16Le(&tmp_bufw, pipe_path) catch unreachable;
14261426 tmp_bufw[len] = 0;
lib/std/debug.zig+4-4
......@@ -461,7 +461,7 @@ pub fn panicImpl(trace: ?*const std.builtin.StackTrace, first_trace_addr: ?usize
461461 0 => {
462462 panic_stage = 1;
463463
464 _ = panicking.fetchAdd(1, .SeqCst);
464 _ = panicking.fetchAdd(1, .seq_cst);
465465
466466 // Make sure to release the mutex when done
467467 {
......@@ -503,7 +503,7 @@ pub fn panicImpl(trace: ?*const std.builtin.StackTrace, first_trace_addr: ?usize
503503
504504/// Must be called only after adding 1 to `panicking`. There are three callsites.
505505fn waitForOtherThreadToFinishPanicking() void {
506 if (panicking.fetchSub(1, .SeqCst) != 1) {
506 if (panicking.fetchSub(1, .seq_cst) != 1) {
507507 // Another thread is panicking, wait for the last one to finish
508508 // and call abort()
509509 if (builtin.single_threaded) unreachable;
......@@ -2587,7 +2587,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
25872587 nosuspend switch (panic_stage) {
25882588 0 => {
25892589 panic_stage = 1;
2590 _ = panicking.fetchAdd(1, .SeqCst);
2590 _ = panicking.fetchAdd(1, .seq_cst);
25912591
25922592 {
25932593 panic_mutex.lock();
......@@ -2663,7 +2663,7 @@ fn handleSegfaultWindowsExtra(
26632663 nosuspend switch (panic_stage) {
26642664 0 => {
26652665 panic_stage = 1;
2666 _ = panicking.fetchAdd(1, .SeqCst);
2666 _ = panicking.fetchAdd(1, .seq_cst);
26672667
26682668 {
26692669 panic_mutex.lock();
lib/std/dynamic_library.zig+2-2
......@@ -8,7 +8,7 @@ const windows = std.os.windows;
88const system = std.os.system;
99
1010pub const DynLib = switch (builtin.os.tag) {
11 .linux => if (!builtin.link_libc or builtin.abi == .musl and builtin.link_mode == .Static)
11 .linux => if (!builtin.link_libc or builtin.abi == .musl and builtin.link_mode == .static)
1212 ElfDynLib
1313 else
1414 DlDynLib,
......@@ -56,7 +56,7 @@ const RDebug = extern struct {
5656/// TODO make it possible to reference this same external symbol 2x so we don't need this
5757/// helper function.
5858pub fn get_DYNAMIC() ?[*]elf.Dyn {
59 return @extern([*]elf.Dyn, .{ .name = "_DYNAMIC", .linkage = .Weak });
59 return @extern([*]elf.Dyn, .{ .name = "_DYNAMIC", .linkage = .weak });
6060}
6161
6262pub fn linkmap_iterator(phdrs: []elf.Phdr) !LinkMap.Iterator {
lib/std/enums.zig+1-1
......@@ -22,7 +22,7 @@ pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_def
2222 }};
2323 }
2424 return @Type(.{ .Struct = .{
25 .layout = .Auto,
25 .layout = .auto,
2626 .fields = fields,
2727 .decls = &.{},
2828 .is_tuple = false,
lib/std/heap.zig+4-4
......@@ -303,11 +303,11 @@ pub const HeapAllocator = switch (builtin.os.tag) {
303303
304304 const ptr_align = @as(usize, 1) << @as(Allocator.Log2Align, @intCast(log2_ptr_align));
305305 const amt = n + ptr_align - 1 + @sizeOf(usize);
306 const optional_heap_handle = @atomicLoad(?HeapHandle, &self.heap_handle, .SeqCst);
306 const optional_heap_handle = @atomicLoad(?HeapHandle, &self.heap_handle, .seq_cst);
307307 const heap_handle = optional_heap_handle orelse blk: {
308308 const options = if (builtin.single_threaded) os.windows.HEAP_NO_SERIALIZE else 0;
309309 const hh = os.windows.kernel32.HeapCreate(options, amt, 0) orelse return null;
310 const other_hh = @cmpxchgStrong(?HeapHandle, &self.heap_handle, null, hh, .SeqCst, .SeqCst) orelse break :blk hh;
310 const other_hh = @cmpxchgStrong(?HeapHandle, &self.heap_handle, null, hh, .seq_cst, .seq_cst) orelse break :blk hh;
311311 os.windows.HeapDestroy(hh);
312312 break :blk other_hh.?; // can't be null because of the cmpxchg
313313 };
......@@ -482,13 +482,13 @@ pub const FixedBufferAllocator = struct {
482482 const self: *FixedBufferAllocator = @ptrCast(@alignCast(ctx));
483483 _ = ra;
484484 const ptr_align = @as(usize, 1) << @as(Allocator.Log2Align, @intCast(log2_ptr_align));
485 var end_index = @atomicLoad(usize, &self.end_index, .SeqCst);
485 var end_index = @atomicLoad(usize, &self.end_index, .seq_cst);
486486 while (true) {
487487 const adjust_off = mem.alignPointerOffset(self.buffer.ptr + end_index, ptr_align) orelse return null;
488488 const adjusted_index = end_index + adjust_off;
489489 const new_end_index = adjusted_index + n;
490490 if (new_end_index > self.buffer.len) return null;
491 end_index = @cmpxchgWeak(usize, &self.end_index, end_index, new_end_index, .SeqCst, .SeqCst) orelse
491 end_index = @cmpxchgWeak(usize, &self.end_index, end_index, new_end_index, .seq_cst, .seq_cst) orelse
492492 return self.buffer[adjusted_index..new_end_index].ptr;
493493 }
494494 }
lib/std/heap/PageAllocator.zig+2-2
......@@ -30,7 +30,7 @@ fn alloc(_: *anyopaque, n: usize, log2_align: u8, ra: usize) ?[*]u8 {
3030 return @ptrCast(addr);
3131 }
3232
33 const hint = @atomicLoad(@TypeOf(std.heap.next_mmap_addr_hint), &std.heap.next_mmap_addr_hint, .Unordered);
33 const hint = @atomicLoad(@TypeOf(std.heap.next_mmap_addr_hint), &std.heap.next_mmap_addr_hint, .unordered);
3434 const slice = os.mmap(
3535 hint,
3636 aligned_len,
......@@ -41,7 +41,7 @@ fn alloc(_: *anyopaque, n: usize, log2_align: u8, ra: usize) ?[*]u8 {
4141 ) catch return null;
4242 assert(mem.isAligned(@intFromPtr(slice.ptr), mem.page_size));
4343 const new_hint: [*]align(mem.page_size) u8 = @alignCast(slice.ptr + aligned_len);
44 _ = @cmpxchgStrong(@TypeOf(std.heap.next_mmap_addr_hint), &std.heap.next_mmap_addr_hint, hint, new_hint, .Monotonic, .Monotonic);
44 _ = @cmpxchgStrong(@TypeOf(std.heap.next_mmap_addr_hint), &std.heap.next_mmap_addr_hint, hint, new_hint, .monotonic, .monotonic);
4545 return slice.ptr;
4646}
4747
lib/std/http/Client.zig+2-2
......@@ -1642,7 +1642,7 @@ pub fn open(
16421642
16431643 const host = uri.host orelse return error.UriMissingHost;
16441644
1645 if (protocol == .tls and @atomicLoad(bool, &client.next_https_rescan_certs, .Acquire)) {
1645 if (protocol == .tls and @atomicLoad(bool, &client.next_https_rescan_certs, .acquire)) {
16461646 if (disable_tls) unreachable;
16471647
16481648 client.ca_bundle_mutex.lock();
......@@ -1650,7 +1650,7 @@ pub fn open(
16501650
16511651 if (client.next_https_rescan_certs) {
16521652 client.ca_bundle.rescan(client.allocator) catch return error.CertificateBundleLoadFailure;
1653 @atomicStore(bool, &client.next_https_rescan_certs, false, .Release);
1653 @atomicStore(bool, &client.next_https_rescan_certs, false, .release);
16541654 }
16551655 }
16561656
lib/std/io.zig+1-1
......@@ -688,7 +688,7 @@ pub fn PollFiles(comptime StreamEnum: type) type {
688688 };
689689 }
690690 return @Type(.{ .Struct = .{
691 .layout = .Auto,
691 .layout = .auto,
692692 .fields = &struct_fields,
693693 .decls = &.{},
694694 .is_tuple = false,
lib/std/io/Reader.zig+1-1
......@@ -326,7 +326,7 @@ pub fn isBytes(self: Self, slice: []const u8) anyerror!bool {
326326
327327pub fn readStruct(self: Self, comptime T: type) anyerror!T {
328328 // Only extern and packed structs have defined in-memory layout.
329 comptime assert(@typeInfo(T).Struct.layout != .Auto);
329 comptime assert(@typeInfo(T).Struct.layout != .auto);
330330 var res: [1]T = undefined;
331331 try self.readNoEof(mem.sliceAsBytes(res[0..]));
332332 return res[0];
lib/std/io/Writer.zig+1-1
......@@ -55,7 +55,7 @@ pub inline fn writeInt(self: Self, comptime T: type, value: T, endian: std.built
5555
5656pub fn writeStruct(self: Self, value: anytype) anyerror!void {
5757 // Only extern and packed structs have defined in-memory layout.
58 comptime assert(@typeInfo(@TypeOf(value)).Struct.layout != .Auto);
58 comptime assert(@typeInfo(@TypeOf(value)).Struct.layout != .auto);
5959 return self.writeAll(mem.asBytes(&value));
6060}
6161
lib/std/mem.zig+3-3
......@@ -238,7 +238,7 @@ pub fn zeroes(comptime T: type) T {
238238 },
239239 .Struct => |struct_info| {
240240 if (@sizeOf(T) == 0) return undefined;
241 if (struct_info.layout == .Extern) {
241 if (struct_info.layout == .@"extern") {
242242 var item: T = undefined;
243243 @memset(asBytes(&item), 0);
244244 return item;
......@@ -284,7 +284,7 @@ pub fn zeroes(comptime T: type) T {
284284 return @splat(zeroes(info.child));
285285 },
286286 .Union => |info| {
287 if (info.layout == .Extern) {
287 if (info.layout == .@"extern") {
288288 var item: T = undefined;
289289 @memset(asBytes(&item), 0);
290290 return item;
......@@ -429,7 +429,7 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
429429 }
430430 }
431431
432 var value: T = if (struct_info.layout == .Extern) zeroes(T) else undefined;
432 var value: T = if (struct_info.layout == .@"extern") zeroes(T) else undefined;
433433
434434 inline for (struct_info.fields, 0..) |field, i| {
435435 if (field.is_comptime) {
lib/std/meta.zig+7-7
......@@ -269,12 +269,12 @@ test containerLayout {
269269 a: u8,
270270 };
271271
272 try testing.expect(containerLayout(S1) == .Auto);
273 try testing.expect(containerLayout(S2) == .Packed);
274 try testing.expect(containerLayout(S3) == .Extern);
275 try testing.expect(containerLayout(U1) == .Auto);
276 try testing.expect(containerLayout(U2) == .Packed);
277 try testing.expect(containerLayout(U3) == .Extern);
272 try testing.expect(containerLayout(S1) == .auto);
273 try testing.expect(containerLayout(S2) == .@"packed");
274 try testing.expect(containerLayout(S3) == .@"extern");
275 try testing.expect(containerLayout(U1) == .auto);
276 try testing.expect(containerLayout(U2) == .@"packed");
277 try testing.expect(containerLayout(U3) == .@"extern");
278278}
279279
280280/// Instead of this function, prefer to use e.g. `@typeInfo(foo).Struct.decls`
......@@ -1025,7 +1025,7 @@ fn CreateUniqueTuple(comptime N: comptime_int, comptime types: [N]type) type {
10251025 return @Type(.{
10261026 .Struct = .{
10271027 .is_tuple = true,
1028 .layout = .Auto,
1028 .layout = .auto,
10291029 .decls = &.{},
10301030 .fields = &tuple_fields,
10311031 },
lib/std/meta/trailer_flags.zig+1-1
......@@ -32,7 +32,7 @@ pub fn TrailerFlags(comptime Fields: type) type {
3232 }
3333 break :blk @Type(.{
3434 .Struct = .{
35 .layout = .Auto,
35 .layout = .auto,
3636 .fields = &fields,
3737 .decls = &.{},
3838 .is_tuple = false,
lib/std/multi_array_list.zig+1-1
......@@ -558,7 +558,7 @@ pub fn MultiArrayList(comptime T: type) type {
558558 .alignment = fields[i].alignment,
559559 };
560560 break :entry @Type(.{ .Struct = .{
561 .layout = .Extern,
561 .layout = .@"extern",
562562 .fields = &entry_fields,
563563 .decls = &.{},
564564 .is_tuple = false,
lib/std/once.zig+2-2
......@@ -17,7 +17,7 @@ pub fn Once(comptime f: fn () void) type {
1717 /// first time.
1818 /// The invocations are thread-safe.
1919 pub fn call(self: *@This()) void {
20 if (@atomicLoad(bool, &self.done, .Acquire))
20 if (@atomicLoad(bool, &self.done, .acquire))
2121 return;
2222
2323 return self.callSlow();
......@@ -32,7 +32,7 @@ pub fn Once(comptime f: fn () void) type {
3232 // The first thread to acquire the mutex gets to run the initializer
3333 if (!self.done) {
3434 f();
35 @atomicStore(bool, &self.done, true, .Release);
35 @atomicStore(bool, &self.done, true, .release);
3636 }
3737 }
3838 };
lib/std/os.zig+5-5
......@@ -436,7 +436,7 @@ fn fchmodat1(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr
436436fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtError!void {
437437 const path_c = try toPosixPath(path);
438438 const use_fchmodat2 = (builtin.os.isAtLeast(.linux, .{ .major = 6, .minor = 6, .patch = 0 }) orelse false) and
439 has_fchmodat2_syscall.load(.Monotonic);
439 has_fchmodat2_syscall.load(.monotonic);
440440 while (use_fchmodat2) {
441441 // Later on this should be changed to `system.fchmodat2`
442442 // when the musl/glibc add a wrapper.
......@@ -458,7 +458,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr
458458 .ROFS => return error.ReadOnlyFileSystem,
459459
460460 .NOSYS => { // Use fallback.
461 has_fchmodat2_syscall.store(false, .Monotonic);
461 has_fchmodat2_syscall.store(false, .monotonic);
462462 break;
463463 },
464464 else => |err| return unexpectedErrno(err),
......@@ -729,7 +729,7 @@ pub fn abort() noreturn {
729729 const global = struct {
730730 var abort_entered: bool = false;
731731 };
732 while (@cmpxchgWeak(bool, &global.abort_entered, false, true, .SeqCst, .SeqCst)) |_| {}
732 while (@cmpxchgWeak(bool, &global.abort_entered, false, true, .seq_cst, .seq_cst)) |_| {}
733733 }
734734
735735 // Install default handler so that the tkill below will terminate.
......@@ -6809,7 +6809,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len
68096809 if ((comptime builtin.os.isAtLeast(.freebsd, .{ .major = 13, .minor = 0, .patch = 0 }) orelse false) or
68106810 ((comptime builtin.os.isAtLeast(.linux, .{ .major = 4, .minor = 5, .patch = 0 }) orelse false and
68116811 std.c.versionCheck(.{ .major = 2, .minor = 27, .patch = 0 })) and
6812 has_copy_file_range_syscall.load(.Monotonic)))
6812 has_copy_file_range_syscall.load(.monotonic)))
68136813 {
68146814 var off_in_copy: i64 = @bitCast(off_in);
68156815 var off_out_copy: i64 = @bitCast(off_out);
......@@ -6844,7 +6844,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len
68446844 .TXTBSY => return error.SwapFile,
68456845 .XDEV => break, // support for cross-filesystem copy added in Linux 5.3, use fallback
68466846 .NOSYS => { // syscall added in Linux 4.5, use fallback
6847 has_copy_file_range_syscall.store(false, .Monotonic);
6847 has_copy_file_range_syscall.store(false, .monotonic);
68486848 break;
68496849 },
68506850 else => |err| return unexpectedErrno(err),
lib/std/os/linux.zig+3-3
......@@ -394,7 +394,7 @@ const extern_getauxval = switch (builtin.zig_backend) {
394394
395395comptime {
396396 if (extern_getauxval) {
397 @export(getauxvalImpl, .{ .name = "getauxval", .linkage = .Weak });
397 @export(getauxvalImpl, .{ .name = "getauxval", .linkage = .weak });
398398 }
399399}
400400
......@@ -1334,7 +1334,7 @@ const vdso_clock_gettime_ty = *align(1) const fn (i32, *timespec) callconv(.C) u
13341334
13351335pub fn clock_gettime(clk_id: i32, tp: *timespec) usize {
13361336 if (@hasDecl(VDSO, "CGT_SYM")) {
1337 const ptr = @atomicLoad(?*const anyopaque, &vdso_clock_gettime, .Unordered);
1337 const ptr = @atomicLoad(?*const anyopaque, &vdso_clock_gettime, .unordered);
13381338 if (ptr) |fn_ptr| {
13391339 const f = @as(vdso_clock_gettime_ty, @ptrCast(fn_ptr));
13401340 const rc = f(clk_id, tp);
......@@ -1351,7 +1351,7 @@ fn init_vdso_clock_gettime(clk: i32, ts: *timespec) callconv(.C) usize {
13511351 const ptr = @as(?*const anyopaque, @ptrFromInt(vdso.lookup(VDSO.CGT_VER, VDSO.CGT_SYM)));
13521352 // Note that we may not have a VDSO at all, update the stub address anyway
13531353 // so that clock_gettime will fall back on the good old (and slow) syscall
1354 @atomicStore(?*const anyopaque, &vdso_clock_gettime, ptr, .Monotonic);
1354 @atomicStore(?*const anyopaque, &vdso_clock_gettime, ptr, .monotonic);
13551355 // Call into the VDSO if available
13561356 if (ptr) |fn_ptr| {
13571357 const f = @as(vdso_clock_gettime_ty, @ptrCast(fn_ptr));
lib/std/os/linux/IoUring.zig+7-7
......@@ -133,7 +133,7 @@ pub fn deinit(self: *IoUring) void {
133133/// alternative. In Zig, we have first-class error handling... so let's use it.
134134/// Matches the implementation of io_uring_get_sqe() in liburing.
135135pub fn get_sqe(self: *IoUring) !*linux.io_uring_sqe {
136 const head = @atomicLoad(u32, self.sq.head, .Acquire);
136 const head = @atomicLoad(u32, self.sq.head, .acquire);
137137 // Remember that these head and tail offsets wrap around every four billion operations.
138138 // We must therefore use wrapping addition and subtraction to avoid a runtime crash.
139139 const next = self.sq.sqe_tail +% 1;
......@@ -222,7 +222,7 @@ pub fn flush_sq(self: *IoUring) u32 {
222222 self.sq.sqe_head +%= 1;
223223 }
224224 // Ensure that the kernel can actually see the SQE updates when it sees the tail update.
225 @atomicStore(u32, self.sq.tail, tail, .Release);
225 @atomicStore(u32, self.sq.tail, tail, .release);
226226 }
227227 return self.sq_ready();
228228}
......@@ -234,7 +234,7 @@ pub fn flush_sq(self: *IoUring) u32 {
234234pub fn sq_ring_needs_enter(self: *IoUring, flags: *u32) bool {
235235 assert(flags.* == 0);
236236 if ((self.flags & linux.IORING_SETUP_SQPOLL) == 0) return true;
237 if ((@atomicLoad(u32, self.sq.flags, .Unordered) & linux.IORING_SQ_NEED_WAKEUP) != 0) {
237 if ((@atomicLoad(u32, self.sq.flags, .unordered) & linux.IORING_SQ_NEED_WAKEUP) != 0) {
238238 flags.* |= linux.IORING_ENTER_SQ_WAKEUP;
239239 return true;
240240 }
......@@ -248,14 +248,14 @@ pub fn sq_ring_needs_enter(self: *IoUring, flags: *u32) bool {
248248pub fn sq_ready(self: *IoUring) u32 {
249249 // Always use the shared ring state (i.e. head and not sqe_head) to avoid going out of sync,
250250 // see https://github.com/axboe/liburing/issues/92.
251 return self.sq.sqe_tail -% @atomicLoad(u32, self.sq.head, .Acquire);
251 return self.sq.sqe_tail -% @atomicLoad(u32, self.sq.head, .acquire);
252252}
253253
254254/// Returns the number of CQEs in the completion queue, i.e. its length.
255255/// These are CQEs that the application is yet to consume.
256256/// Matches the implementation of io_uring_cq_ready in liburing.
257257pub fn cq_ready(self: *IoUring) u32 {
258 return @atomicLoad(u32, self.cq.tail, .Acquire) -% self.cq.head.*;
258 return @atomicLoad(u32, self.cq.tail, .acquire) -% self.cq.head.*;
259259}
260260
261261/// Copies as many CQEs as are ready, and that can fit into the destination `cqes` slice.
......@@ -313,7 +313,7 @@ pub fn copy_cqe(ring: *IoUring) !linux.io_uring_cqe {
313313
314314/// Matches the implementation of cq_ring_needs_flush() in liburing.
315315pub fn cq_ring_needs_flush(self: *IoUring) bool {
316 return (@atomicLoad(u32, self.sq.flags, .Unordered) & linux.IORING_SQ_CQ_OVERFLOW) != 0;
316 return (@atomicLoad(u32, self.sq.flags, .unordered) & linux.IORING_SQ_CQ_OVERFLOW) != 0;
317317}
318318
319319/// For advanced use cases only that implement custom completion queue methods.
......@@ -331,7 +331,7 @@ pub fn cqe_seen(self: *IoUring, cqe: *linux.io_uring_cqe) void {
331331pub fn cq_advance(self: *IoUring, count: u32) void {
332332 if (count > 0) {
333333 // Ensure the kernel only sees the new head value after the CQEs have been read.
334 @atomicStore(u32, self.cq.head, self.cq.head.* +% count, .Release);
334 @atomicStore(u32, self.cq.head, self.cq.head.* +% count, .release);
335335 }
336336}
337337
lib/std/os/test.zig+1-1
......@@ -425,7 +425,7 @@ fn start1() u8 {
425425}
426426
427427fn start2(ctx: *i32) u8 {
428 _ = @atomicRmw(i32, ctx, AtomicRmwOp.Add, 1, AtomicOrder.SeqCst);
428 _ = @atomicRmw(i32, ctx, AtomicRmwOp.Add, 1, AtomicOrder.seq_cst);
429429 return 0;
430430}
431431
lib/std/start.zig+1-1
......@@ -50,7 +50,7 @@ comptime {
5050 }
5151 }
5252 } else {
53 if (builtin.output_mode == .Lib and builtin.link_mode == .Dynamic) {
53 if (builtin.output_mode == .Lib and builtin.link_mode == .dynamic) {
5454 if (native_os == .windows and !@hasDecl(root, "_DllMainCRTStartup")) {
5555 @export(_DllMainCRTStartup, .{ .name = "_DllMainCRTStartup" });
5656 }
lib/std/zig.zig+12-12
......@@ -155,9 +155,9 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
155155 .coff => switch (options.output_mode) {
156156 .Exe => return std.fmt.allocPrint(allocator, "{s}{s}", .{ root_name, t.exeFileExt() }),
157157 .Lib => {
158 const suffix = switch (options.link_mode orelse .Static) {
159 .Static => ".lib",
160 .Dynamic => ".dll",
158 const suffix = switch (options.link_mode orelse .static) {
159 .static => ".lib",
160 .dynamic => ".dll",
161161 };
162162 return std.fmt.allocPrint(allocator, "{s}{s}", .{ root_name, suffix });
163163 },
......@@ -166,11 +166,11 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
166166 .elf => switch (options.output_mode) {
167167 .Exe => return allocator.dupe(u8, root_name),
168168 .Lib => {
169 switch (options.link_mode orelse .Static) {
170 .Static => return std.fmt.allocPrint(allocator, "{s}{s}.a", .{
169 switch (options.link_mode orelse .static) {
170 .static => return std.fmt.allocPrint(allocator, "{s}{s}.a", .{
171171 t.libPrefix(), root_name,
172172 }),
173 .Dynamic => {
173 .dynamic => {
174174 if (options.version) |ver| {
175175 return std.fmt.allocPrint(allocator, "{s}{s}.so.{d}.{d}.{d}", .{
176176 t.libPrefix(), root_name, ver.major, ver.minor, ver.patch,
......@@ -188,11 +188,11 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
188188 .macho => switch (options.output_mode) {
189189 .Exe => return allocator.dupe(u8, root_name),
190190 .Lib => {
191 switch (options.link_mode orelse .Static) {
192 .Static => return std.fmt.allocPrint(allocator, "{s}{s}.a", .{
191 switch (options.link_mode orelse .static) {
192 .static => return std.fmt.allocPrint(allocator, "{s}{s}.a", .{
193193 t.libPrefix(), root_name,
194194 }),
195 .Dynamic => {
195 .dynamic => {
196196 if (options.version) |ver| {
197197 return std.fmt.allocPrint(allocator, "{s}{s}.{d}.{d}.{d}.dylib", .{
198198 t.libPrefix(), root_name, ver.major, ver.minor, ver.patch,
......@@ -210,11 +210,11 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
210210 .wasm => switch (options.output_mode) {
211211 .Exe => return std.fmt.allocPrint(allocator, "{s}{s}", .{ root_name, t.exeFileExt() }),
212212 .Lib => {
213 switch (options.link_mode orelse .Static) {
214 .Static => return std.fmt.allocPrint(allocator, "{s}{s}.a", .{
213 switch (options.link_mode orelse .static) {
214 .static => return std.fmt.allocPrint(allocator, "{s}{s}.a", .{
215215 t.libPrefix(), root_name,
216216 }),
217 .Dynamic => return std.fmt.allocPrint(allocator, "{s}.wasm", .{root_name}),
217 .dynamic => return std.fmt.allocPrint(allocator, "{s}.wasm", .{root_name}),
218218 }
219219 },
220220 .Obj => return std.fmt.allocPrint(allocator, "{s}.o", .{root_name}),
lib/std/zig/AstGen.zig+21-22
......@@ -175,7 +175,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir {
175175 &gen_scope.base,
176176 0,
177177 tree.containerDeclRoot(),
178 .Auto,
178 .auto,
179179 0,
180180 )) |struct_decl_ref| {
181181 assert(struct_decl_ref.toIndex().? == .main_struct_inst);
......@@ -4907,7 +4907,7 @@ fn structDeclInner(
49074907 var backing_int_body_len: usize = 0;
49084908 const backing_int_ref: Zir.Inst.Ref = blk: {
49094909 if (backing_int_node != 0) {
4910 if (layout != .Packed) {
4910 if (layout != .@"packed") {
49114911 return astgen.failNode(backing_int_node, "non-packed struct does not support backing integer type", .{});
49124912 } else {
49134913 const backing_int_ref = try typeExpr(&block_scope, &namespace.base, backing_int_node);
......@@ -4958,9 +4958,9 @@ fn structDeclInner(
49584958 } else false;
49594959
49604960 if (is_tuple) switch (layout) {
4961 .Auto => {},
4962 .Extern => return astgen.failNode(node, "extern tuples are not supported", .{}),
4963 .Packed => return astgen.failNode(node, "packed tuples are not supported", .{}),
4961 .auto => {},
4962 .@"extern" => return astgen.failNode(node, "extern tuples are not supported", .{}),
4963 .@"packed" => return astgen.failNode(node, "packed tuples are not supported", .{}),
49644964 };
49654965
49664966 if (is_tuple) for (container_decl.ast.members) |member_node| {
......@@ -5055,9 +5055,9 @@ fn structDeclInner(
50555055
50565056 if (is_comptime) {
50575057 switch (layout) {
5058 .Packed => return astgen.failTok(member.comptime_token.?, "packed struct fields cannot be marked comptime", .{}),
5059 .Extern => return astgen.failTok(member.comptime_token.?, "extern struct fields cannot be marked comptime", .{}),
5060 .Auto => any_comptime_fields = true,
5058 .@"packed" => return astgen.failTok(member.comptime_token.?, "packed struct fields cannot be marked comptime", .{}),
5059 .@"extern" => return astgen.failTok(member.comptime_token.?, "extern struct fields cannot be marked comptime", .{}),
5060 .auto => any_comptime_fields = true,
50615061 }
50625062 } else {
50635063 known_non_opv = known_non_opv or
......@@ -5082,7 +5082,7 @@ fn structDeclInner(
50825082 }
50835083
50845084 if (have_align) {
5085 if (layout == .Packed) {
5085 if (layout == .@"packed") {
50865086 try astgen.appendErrorNode(member.ast.align_expr, "unable to override alignment of packed struct fields", .{});
50875087 }
50885088 any_aligned_fields = true;
......@@ -5229,12 +5229,11 @@ fn unionDeclInner(
52295229 const decl_count = try astgen.scanDecls(&namespace, members);
52305230 const field_count: u32 = @intCast(members.len - decl_count);
52315231
5232 if (layout != .Auto and (auto_enum_tok != null or arg_node != 0)) {
5233 const layout_str = if (layout == .Extern) "extern" else "packed";
5232 if (layout != .auto and (auto_enum_tok != null or arg_node != 0)) {
52345233 if (arg_node != 0) {
5235 return astgen.failNode(arg_node, "{s} union does not support enum tag type", .{layout_str});
5234 return astgen.failNode(arg_node, "{s} union does not support enum tag type", .{@tagName(layout)});
52365235 } else {
5237 return astgen.failTok(auto_enum_tok.?, "{s} union does not support enum tag type", .{layout_str});
5236 return astgen.failTok(auto_enum_tok.?, "{s} union does not support enum tag type", .{@tagName(layout)});
52385237 }
52395238 }
52405239
......@@ -5429,21 +5428,21 @@ fn containerDecl(
54295428
54305429 switch (token_tags[container_decl.ast.main_token]) {
54315430 .keyword_struct => {
5432 const layout = if (container_decl.layout_token) |t| switch (token_tags[t]) {
5433 .keyword_packed => std.builtin.Type.ContainerLayout.Packed,
5434 .keyword_extern => std.builtin.Type.ContainerLayout.Extern,
5431 const layout: std.builtin.Type.ContainerLayout = if (container_decl.layout_token) |t| switch (token_tags[t]) {
5432 .keyword_packed => .@"packed",
5433 .keyword_extern => .@"extern",
54355434 else => unreachable,
5436 } else std.builtin.Type.ContainerLayout.Auto;
5435 } else .auto;
54375436
54385437 const result = try structDeclInner(gz, scope, node, container_decl, layout, container_decl.ast.arg);
54395438 return rvalue(gz, ri, result, node);
54405439 },
54415440 .keyword_union => {
5442 const layout = if (container_decl.layout_token) |t| switch (token_tags[t]) {
5443 .keyword_packed => std.builtin.Type.ContainerLayout.Packed,
5444 .keyword_extern => std.builtin.Type.ContainerLayout.Extern,
5441 const layout: std.builtin.Type.ContainerLayout = if (container_decl.layout_token) |t| switch (token_tags[t]) {
5442 .keyword_packed => .@"packed",
5443 .keyword_extern => .@"extern",
54455444 else => unreachable,
5446 } else std.builtin.Type.ContainerLayout.Auto;
5445 } else .auto;
54475446
54485447 const result = try unionDeclInner(gz, scope, node, container_decl.ast.members, layout, container_decl.ast.arg, container_decl.ast.enum_token);
54495448 return rvalue(gz, ri, result, node);
......@@ -8588,7 +8587,7 @@ fn numberLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index, source_node:
85888587 .positive => unsigned_float_number,
85898588 };
85908589 // If the value fits into a f64 without losing any precision, store it that way.
8591 @setFloatMode(.Strict);
8590 @setFloatMode(.strict);
85928591 const smaller_float: f64 = @floatCast(float_number);
85938592 const bigger_again: f128 = smaller_float;
85948593 if (bigger_again == float_number) {
lib/std/zig/Server.zig+3-3
......@@ -250,18 +250,18 @@ fn bswap(x: anytype) @TypeOf(x) {
250250 .Enum => return @as(T, @enumFromInt(@byteSwap(@intFromEnum(x)))),
251251 .Int => return @byteSwap(x),
252252 .Struct => |info| switch (info.layout) {
253 .Extern => {
253 .@"extern" => {
254254 var result: T = undefined;
255255 inline for (info.fields) |field| {
256256 @field(result, field.name) = bswap(@field(x, field.name));
257257 }
258258 return result;
259259 },
260 .Packed => {
260 .@"packed" => {
261261 const I = info.backing_integer.?;
262262 return @as(T, @bitCast(@byteSwap(@as(I, @bitCast(x)))));
263263 },
264 .Auto => @compileError("auto layout struct"),
264 .auto => @compileError("auto layout struct"),
265265 },
266266 else => @compileError("bswap on type " ++ @typeName(T)),
267267 }
src/Compilation.zig+6-6
......@@ -1201,7 +1201,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
12011201 const output_mode = options.config.output_mode;
12021202 const is_dyn_lib = switch (output_mode) {
12031203 .Obj, .Exe => false,
1204 .Lib => options.config.link_mode == .Dynamic,
1204 .Lib => options.config.link_mode == .dynamic,
12051205 };
12061206 const is_exe_or_dyn_lib = switch (output_mode) {
12071207 .Obj => false,
......@@ -1806,8 +1806,8 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
18061806 .{ .musl_crt_file = .scrt1_o },
18071807 .{ .musl_crt_file = .rcrt1_o },
18081808 switch (comp.config.link_mode) {
1809 .Static => .{ .musl_crt_file = .libc_a },
1810 .Dynamic => .{ .musl_crt_file = .libc_so },
1809 .static => .{ .musl_crt_file = .libc_a },
1810 .dynamic => .{ .musl_crt_file = .libc_so },
18111811 },
18121812 });
18131813 }
......@@ -6087,7 +6087,7 @@ pub fn get_libc_crt_file(comp: *Compilation, arena: Allocator, basename: []const
60876087fn wantBuildLibCFromSource(comp: Compilation) bool {
60886088 const is_exe_or_dyn_lib = switch (comp.config.output_mode) {
60896089 .Obj => false,
6090 .Lib => comp.config.link_mode == .Dynamic,
6090 .Lib => comp.config.link_mode == .dynamic,
60916091 .Exe => true,
60926092 };
60936093 const ofmt = comp.root_mod.resolved_target.result.ofmt;
......@@ -6116,7 +6116,7 @@ fn wantBuildMinGWFromSource(comp: Compilation) bool {
61166116fn wantBuildLibUnwindFromSource(comp: *Compilation) bool {
61176117 const is_exe_or_dyn_lib = switch (comp.config.output_mode) {
61186118 .Obj => false,
6119 .Lib => comp.config.link_mode == .Dynamic,
6119 .Lib => comp.config.link_mode == .dynamic,
61206120 .Exe => true,
61216121 };
61226122 const ofmt = comp.root_mod.resolved_target.result.ofmt;
......@@ -6310,7 +6310,7 @@ fn buildOutputFromZig(
63106310
63116311 const config = try Config.resolve(.{
63126312 .output_mode = output_mode,
6313 .link_mode = .Static,
6313 .link_mode = .static,
63146314 .resolved_target = comp.root_mod.resolved_target,
63156315 .is_test = false,
63166316 .have_zcu = true,
src/Compilation/Config.zig+12-12
......@@ -348,26 +348,26 @@ pub fn resolve(options: Options) ResolveError!Config {
348348 const link_mode = b: {
349349 const explicitly_exe_or_dyn_lib = switch (options.output_mode) {
350350 .Obj => false,
351 .Lib => (options.link_mode orelse .Static) == .Dynamic,
351 .Lib => (options.link_mode orelse .static) == .dynamic,
352352 .Exe => true,
353353 };
354354
355355 if (target_util.cannotDynamicLink(target)) {
356 if (options.link_mode == .Dynamic) return error.TargetCannotDynamicLink;
357 break :b .Static;
356 if (options.link_mode == .dynamic) return error.TargetCannotDynamicLink;
357 break :b .static;
358358 }
359359 if (explicitly_exe_or_dyn_lib and link_libc and
360360 (target.isGnuLibC() or target_util.osRequiresLibC(target)))
361361 {
362 if (options.link_mode == .Static) return error.LibCRequiresDynamicLinking;
363 break :b .Dynamic;
362 if (options.link_mode == .static) return error.LibCRequiresDynamicLinking;
363 break :b .dynamic;
364364 }
365365 // When creating a executable that links to system libraries, we
366366 // require dynamic linking, but we must not link static libraries
367367 // or object files dynamically!
368368 if (options.any_dyn_libs and options.output_mode == .Exe) {
369 if (options.link_mode == .Static) return error.SharedLibrariesRequireDynamicLinking;
370 break :b .Dynamic;
369 if (options.link_mode == .static) return error.SharedLibrariesRequireDynamicLinking;
370 break :b .dynamic;
371371 }
372372
373373 if (options.link_mode) |link_mode| break :b link_mode;
......@@ -377,16 +377,16 @@ pub fn resolve(options: Options) ResolveError!Config {
377377 {
378378 // If targeting the system's native ABI and the system's libc is
379379 // musl, link dynamically by default.
380 break :b .Dynamic;
380 break :b .dynamic;
381381 }
382382
383383 // Static is generally a better default. Fight me.
384 break :b .Static;
384 break :b .static;
385385 };
386386
387387 const import_memory = options.import_memory orelse (options.output_mode == .Obj);
388388 const export_memory = b: {
389 if (link_mode == .Dynamic) {
389 if (link_mode == .dynamic) {
390390 if (options.export_memory == true) return error.ExportMemoryAndDynamicIncompatible;
391391 break :b false;
392392 }
......@@ -397,7 +397,7 @@ pub fn resolve(options: Options) ResolveError!Config {
397397 const pie: bool = b: {
398398 switch (options.output_mode) {
399399 .Obj, .Exe => {},
400 .Lib => if (link_mode == .Dynamic) {
400 .Lib => if (link_mode == .dynamic) {
401401 if (options.pie == true) return error.DynamicLibraryPrecludesPie;
402402 break :b false;
403403 },
......@@ -467,7 +467,7 @@ pub fn resolve(options: Options) ResolveError!Config {
467467 if (rdynamic) break :b true;
468468 break :b switch (options.output_mode) {
469469 .Obj, .Exe => false,
470 .Lib => link_mode == .Dynamic,
470 .Lib => link_mode == .dynamic,
471471 };
472472 };
473473
src/InternPool.zig+35-36
......@@ -2025,15 +2025,15 @@ pub const LoadedStructType = struct {
20252025 /// complicated logic.
20262026 pub fn knownNonOpv(s: @This(), ip: *InternPool) bool {
20272027 return switch (s.layout) {
2028 .Packed => false,
2029 .Auto, .Extern => s.flagsPtr(ip).known_non_opv,
2028 .@"packed" => false,
2029 .auto, .@"extern" => s.flagsPtr(ip).known_non_opv,
20302030 };
20312031 }
20322032
20332033 /// The returned pointer expires with any addition to the `InternPool`.
20342034 /// Asserts the struct is not packed.
20352035 pub fn flagsPtr(self: @This(), ip: *const InternPool) *Tag.TypeStruct.Flags {
2036 assert(self.layout != .Packed);
2036 assert(self.layout != .@"packed");
20372037 const flags_field_index = std.meta.fieldIndex(Tag.TypeStruct, "flags").?;
20382038 return @ptrCast(&ip.extra.items[self.extra_index + flags_field_index]);
20392039 }
......@@ -2041,13 +2041,13 @@ pub const LoadedStructType = struct {
20412041 /// The returned pointer expires with any addition to the `InternPool`.
20422042 /// Asserts that the struct is packed.
20432043 pub fn packedFlagsPtr(self: @This(), ip: *const InternPool) *Tag.TypeStructPacked.Flags {
2044 assert(self.layout == .Packed);
2044 assert(self.layout == .@"packed");
20452045 const flags_field_index = std.meta.fieldIndex(Tag.TypeStructPacked, "flags").?;
20462046 return @ptrCast(&ip.extra.items[self.extra_index + flags_field_index]);
20472047 }
20482048
20492049 pub fn assumeRuntimeBitsIfFieldTypesWip(s: @This(), ip: *InternPool) bool {
2050 if (s.layout == .Packed) return false;
2050 if (s.layout == .@"packed") return false;
20512051 const flags_ptr = s.flagsPtr(ip);
20522052 if (flags_ptr.field_types_wip) {
20532053 flags_ptr.assumed_runtime_bits = true;
......@@ -2057,7 +2057,7 @@ pub const LoadedStructType = struct {
20572057 }
20582058
20592059 pub fn setTypesWip(s: @This(), ip: *InternPool) bool {
2060 if (s.layout == .Packed) return false;
2060 if (s.layout == .@"packed") return false;
20612061 const flags_ptr = s.flagsPtr(ip);
20622062 if (flags_ptr.field_types_wip) return true;
20632063 flags_ptr.field_types_wip = true;
......@@ -2065,12 +2065,12 @@ pub const LoadedStructType = struct {
20652065 }
20662066
20672067 pub fn clearTypesWip(s: @This(), ip: *InternPool) void {
2068 if (s.layout == .Packed) return;
2068 if (s.layout == .@"packed") return;
20692069 s.flagsPtr(ip).field_types_wip = false;
20702070 }
20712071
20722072 pub fn setLayoutWip(s: @This(), ip: *InternPool) bool {
2073 if (s.layout == .Packed) return false;
2073 if (s.layout == .@"packed") return false;
20742074 const flags_ptr = s.flagsPtr(ip);
20752075 if (flags_ptr.layout_wip) return true;
20762076 flags_ptr.layout_wip = true;
......@@ -2078,12 +2078,12 @@ pub const LoadedStructType = struct {
20782078 }
20792079
20802080 pub fn clearLayoutWip(s: @This(), ip: *InternPool) void {
2081 if (s.layout == .Packed) return;
2081 if (s.layout == .@"packed") return;
20822082 s.flagsPtr(ip).layout_wip = false;
20832083 }
20842084
20852085 pub fn setAlignmentWip(s: @This(), ip: *InternPool) bool {
2086 if (s.layout == .Packed) return false;
2086 if (s.layout == .@"packed") return false;
20872087 const flags_ptr = s.flagsPtr(ip);
20882088 if (flags_ptr.alignment_wip) return true;
20892089 flags_ptr.alignment_wip = true;
......@@ -2091,19 +2091,19 @@ pub const LoadedStructType = struct {
20912091 }
20922092
20932093 pub fn clearAlignmentWip(s: @This(), ip: *InternPool) void {
2094 if (s.layout == .Packed) return;
2094 if (s.layout == .@"packed") return;
20952095 s.flagsPtr(ip).alignment_wip = false;
20962096 }
20972097
20982098 pub fn setInitsWip(s: @This(), ip: *InternPool) bool {
20992099 switch (s.layout) {
2100 .Packed => {
2100 .@"packed" => {
21012101 const flag = &s.packedFlagsPtr(ip).field_inits_wip;
21022102 if (flag.*) return true;
21032103 flag.* = true;
21042104 return false;
21052105 },
2106 .Auto, .Extern => {
2106 .auto, .@"extern" => {
21072107 const flag = &s.flagsPtr(ip).field_inits_wip;
21082108 if (flag.*) return true;
21092109 flag.* = true;
......@@ -2114,13 +2114,13 @@ pub const LoadedStructType = struct {
21142114
21152115 pub fn clearInitsWip(s: @This(), ip: *InternPool) void {
21162116 switch (s.layout) {
2117 .Packed => s.packedFlagsPtr(ip).field_inits_wip = false,
2118 .Auto, .Extern => s.flagsPtr(ip).field_inits_wip = false,
2117 .@"packed" => s.packedFlagsPtr(ip).field_inits_wip = false,
2118 .auto, .@"extern" => s.flagsPtr(ip).field_inits_wip = false,
21192119 }
21202120 }
21212121
21222122 pub fn setFullyResolved(s: @This(), ip: *InternPool) bool {
2123 if (s.layout == .Packed) return true;
2123 if (s.layout == .@"packed") return true;
21242124 const flags_ptr = s.flagsPtr(ip);
21252125 if (flags_ptr.fully_resolved) return true;
21262126 flags_ptr.fully_resolved = true;
......@@ -2134,7 +2134,7 @@ pub const LoadedStructType = struct {
21342134 /// The returned pointer expires with any addition to the `InternPool`.
21352135 /// Asserts the struct is not packed.
21362136 pub fn size(self: @This(), ip: *InternPool) *u32 {
2137 assert(self.layout != .Packed);
2137 assert(self.layout != .@"packed");
21382138 const size_field_index = std.meta.fieldIndex(Tag.TypeStruct, "size").?;
21392139 return @ptrCast(&ip.extra.items[self.extra_index + size_field_index]);
21402140 }
......@@ -2144,14 +2144,14 @@ pub const LoadedStructType = struct {
21442144 /// set to `none` until the layout is resolved.
21452145 /// Asserts the struct is packed.
21462146 pub fn backingIntType(s: @This(), ip: *const InternPool) *Index {
2147 assert(s.layout == .Packed);
2147 assert(s.layout == .@"packed");
21482148 const field_index = std.meta.fieldIndex(Tag.TypeStructPacked, "backing_int_ty").?;
21492149 return @ptrCast(&ip.extra.items[s.extra_index + field_index]);
21502150 }
21512151
21522152 /// Asserts the struct is not packed.
21532153 pub fn setZirIndex(s: @This(), ip: *InternPool, new_zir_index: TrackedInst.Index.Optional) void {
2154 assert(s.layout != .Packed);
2154 assert(s.layout != .@"packed");
21552155 const field_index = std.meta.fieldIndex(Tag.TypeStruct, "zir_index").?;
21562156 ip.extra.items[s.extra_index + field_index] = @intFromEnum(new_zir_index);
21572157 }
......@@ -2163,31 +2163,31 @@ pub const LoadedStructType = struct {
21632163
21642164 pub fn haveFieldInits(s: @This(), ip: *const InternPool) bool {
21652165 return switch (s.layout) {
2166 .Packed => s.packedFlagsPtr(ip).inits_resolved,
2167 .Auto, .Extern => s.flagsPtr(ip).inits_resolved,
2166 .@"packed" => s.packedFlagsPtr(ip).inits_resolved,
2167 .auto, .@"extern" => s.flagsPtr(ip).inits_resolved,
21682168 };
21692169 }
21702170
21712171 pub fn setHaveFieldInits(s: @This(), ip: *InternPool) void {
21722172 switch (s.layout) {
2173 .Packed => s.packedFlagsPtr(ip).inits_resolved = true,
2174 .Auto, .Extern => s.flagsPtr(ip).inits_resolved = true,
2173 .@"packed" => s.packedFlagsPtr(ip).inits_resolved = true,
2174 .auto, .@"extern" => s.flagsPtr(ip).inits_resolved = true,
21752175 }
21762176 }
21772177
21782178 pub fn haveLayout(s: @This(), ip: *InternPool) bool {
21792179 return switch (s.layout) {
2180 .Packed => s.backingIntType(ip).* != .none,
2181 .Auto, .Extern => s.flagsPtr(ip).layout_resolved,
2180 .@"packed" => s.backingIntType(ip).* != .none,
2181 .auto, .@"extern" => s.flagsPtr(ip).layout_resolved,
21822182 };
21832183 }
21842184
21852185 pub fn isTuple(s: @This(), ip: *InternPool) bool {
2186 return s.layout != .Packed and s.flagsPtr(ip).is_tuple;
2186 return s.layout != .@"packed" and s.flagsPtr(ip).is_tuple;
21872187 }
21882188
21892189 pub fn hasReorderedFields(s: @This()) bool {
2190 return s.layout == .Auto;
2190 return s.layout == .auto;
21912191 }
21922192
21932193 pub const RuntimeOrderIterator = struct {
......@@ -2221,7 +2221,7 @@ pub const LoadedStructType = struct {
22212221 /// May or may not include zero-bit fields.
22222222 /// Asserts the struct is not packed.
22232223 pub fn iterateRuntimeOrder(s: @This(), ip: *InternPool) RuntimeOrderIterator {
2224 assert(s.layout != .Packed);
2224 assert(s.layout != .@"packed");
22252225 return .{
22262226 .ip = ip,
22272227 .field_index = 0,
......@@ -2239,7 +2239,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
22392239 .decl = .none,
22402240 .namespace = .none,
22412241 .zir_index = .none,
2242 .layout = .Auto,
2242 .layout = .auto,
22432243 .field_names = .{ .start = 0, .len = 0 },
22442244 .field_types = .{ .start = 0, .len = 0 },
22452245 .field_inits = .{ .start = 0, .len = 0 },
......@@ -2314,7 +2314,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
23142314 .decl = extra.data.decl.toOptional(),
23152315 .namespace = namespace,
23162316 .zir_index = extra.data.zir_index.toOptional(),
2317 .layout = if (extra.data.flags.is_extern) .Extern else .Auto,
2317 .layout = if (extra.data.flags.is_extern) .@"extern" else .auto,
23182318 .field_names = names,
23192319 .field_types = field_types,
23202320 .field_inits = inits,
......@@ -2367,7 +2367,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
23672367 .decl = extra.data.decl.toOptional(),
23682368 .namespace = extra.data.namespace,
23692369 .zir_index = extra.data.zir_index.toOptional(),
2370 .layout = .Packed,
2370 .layout = .@"packed",
23712371 .field_names = field_names,
23722372 .field_types = field_types,
23732373 .field_inits = field_inits,
......@@ -4455,7 +4455,6 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key {
44554455 } else .{ .start = 0, .len = 0 } },
44564456 } };
44574457 } },
4458
44594458 .type_struct_anon => .{ .anon_struct_type = extraTypeStructAnon(ip, data) },
44604459 .type_tuple_anon => .{ .anon_struct_type = extraTypeTupleAnon(ip, data) },
44614460 .type_union => .{ .union_type = ns: {
......@@ -6009,9 +6008,9 @@ pub fn getStructType(
60096008 };
60106009
60116010 const is_extern = switch (ini.layout) {
6012 .Auto => false,
6013 .Extern => true,
6014 .Packed => {
6011 .auto => false,
6012 .@"extern" => true,
6013 .@"packed" => {
60156014 try ip.extra.ensureUnusedCapacity(gpa, @typeInfo(Tag.TypeStructPacked).Struct.fields.len +
60166015 // TODO: fmt bug
60176016 // zig fmt: off
......@@ -6140,7 +6139,7 @@ pub fn getStructType(
61406139 if (ini.any_comptime_fields) {
61416140 ip.extra.appendNTimesAssumeCapacity(0, comptime_elements_len);
61426141 }
6143 if (ini.layout == .Auto) {
6142 if (ini.layout == .auto) {
61446143 ip.extra.appendNTimesAssumeCapacity(@intFromEnum(LoadedStructType.RuntimeOrder.unresolved), ini.fields_len);
61456144 }
61466145 ip.extra.appendNTimesAssumeCapacity(std.math.maxInt(u32), ini.fields_len);
src/Module.zig+9-9
......@@ -279,7 +279,7 @@ pub const Export = struct {
279279
280280 pub const Options = struct {
281281 name: InternPool.NullTerminatedString,
282 linkage: std.builtin.GlobalLinkage = .Strong,
282 linkage: std.builtin.GlobalLinkage = .strong,
283283 section: InternPool.OptionalNullTerminatedString = .none,
284284 visibility: std.builtin.SymbolVisibility = .default,
285285 };
......@@ -3310,7 +3310,7 @@ fn getFileRootStruct(zcu: *Zcu, decl_index: Decl.Index, namespace_index: Namespa
33103310 const small: Zir.Inst.StructDecl.Small = @bitCast(extended.small);
33113311 assert(!small.has_captures_len);
33123312 assert(!small.has_backing_int);
3313 assert(small.layout == .Auto);
3313 assert(small.layout == .auto);
33143314 var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).Struct.fields.len;
33153315 const fields_len = if (small.has_fields_len) blk: {
33163316 const fields_len = file.zir.extra[extra_index];
......@@ -3327,7 +3327,7 @@ fn getFileRootStruct(zcu: *Zcu, decl_index: Decl.Index, namespace_index: Namespa
33273327
33283328 const tracked_inst = try ip.trackZir(gpa, file, .main_struct_inst);
33293329 const wip_ty = switch (try ip.getStructType(gpa, .{
3330 .layout = .Auto,
3330 .layout = .auto,
33313331 .fields_len = fields_len,
33323332 .known_non_opv = small.known_non_opv,
33333333 .requires_comptime = if (small.known_comptime_only) .yes else .unknown,
......@@ -5969,7 +5969,7 @@ pub fn typeToStruct(mod: *Module, ty: Type) ?InternPool.LoadedStructType {
59695969
59705970pub fn typeToPackedStruct(mod: *Module, ty: Type) ?InternPool.LoadedStructType {
59715971 const s = mod.typeToStruct(ty) orelse return null;
5972 if (s.layout != .Packed) return null;
5972 if (s.layout != .@"packed") return null;
59735973 return s;
59745974}
59755975
......@@ -6185,18 +6185,18 @@ pub fn structFieldAlignment(
61856185 field_ty: Type,
61866186 layout: std.builtin.Type.ContainerLayout,
61876187) Alignment {
6188 assert(layout != .Packed);
6188 assert(layout != .@"packed");
61896189 if (explicit_alignment != .none) return explicit_alignment;
61906190 switch (layout) {
6191 .Packed => unreachable,
6192 .Auto => {
6191 .@"packed" => unreachable,
6192 .auto => {
61936193 if (mod.getTarget().ofmt == .c) {
61946194 return structFieldAlignmentExtern(mod, field_ty);
61956195 } else {
61966196 return field_ty.abiAlignment(mod);
61976197 }
61986198 },
6199 .Extern => return structFieldAlignmentExtern(mod, field_ty),
6199 .@"extern" => return structFieldAlignmentExtern(mod, field_ty),
62006200 }
62016201}
62026202
......@@ -6224,7 +6224,7 @@ pub fn structPackedFieldBitOffset(
62246224 field_index: u32,
62256225) u16 {
62266226 const ip = &mod.intern_pool;
6227 assert(struct_type.layout == .Packed);
6227 assert(struct_type.layout == .@"packed");
62286228 assert(struct_type.haveLayout(ip));
62296229 var bit_sum: u64 = 0;
62306230 for (0..struct_type.field_types.len) |i| {
src/Package/Module.zig+1-1
......@@ -178,7 +178,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
178178 return error.PieRequiresPic;
179179 break :b true;
180180 }
181 if (options.global.link_mode == .Dynamic) {
181 if (options.global.link_mode == .dynamic) {
182182 if (options.inherited.pic == false)
183183 return error.DynamicLinkingRequiresPic;
184184 break :b true;
src/Sema.zig+117-117
......@@ -357,7 +357,7 @@ pub const Block = struct {
357357 want_safety: ?bool = null,
358358
359359 /// What mode to generate float operations in, set by @setFloatMode
360 float_mode: std.builtin.FloatMode = .Strict,
360 float_mode: std.builtin.FloatMode = .strict,
361361
362362 c_import_buf: ?*std.ArrayList(u8) = null,
363363
......@@ -686,7 +686,7 @@ pub const Block = struct {
686686 const sema = block.sema;
687687 const mod = sema.mod;
688688 return block.addInst(.{
689 .tag = if (block.float_mode == .Optimized) .cmp_vector_optimized else .cmp_vector,
689 .tag = if (block.float_mode == .optimized) .cmp_vector_optimized else .cmp_vector,
690690 .data = .{ .ty_pl = .{
691691 .ty = Air.internedToRef((try mod.vectorType(.{
692692 .len = sema.typeOf(lhs).vectorLen(mod),
......@@ -1020,10 +1020,10 @@ fn analyzeBodyInner(
10201020 .field_call => try sema.zirCall(block, inst, .field),
10211021 .cmp_lt => try sema.zirCmp(block, inst, .lt),
10221022 .cmp_lte => try sema.zirCmp(block, inst, .lte),
1023 .cmp_eq => try sema.zirCmpEq(block, inst, .eq, Air.Inst.Tag.fromCmpOp(.eq, block.float_mode == .Optimized)),
1023 .cmp_eq => try sema.zirCmpEq(block, inst, .eq, Air.Inst.Tag.fromCmpOp(.eq, block.float_mode == .optimized)),
10241024 .cmp_gte => try sema.zirCmp(block, inst, .gte),
10251025 .cmp_gt => try sema.zirCmp(block, inst, .gt),
1026 .cmp_neq => try sema.zirCmpEq(block, inst, .neq, Air.Inst.Tag.fromCmpOp(.neq, block.float_mode == .Optimized)),
1026 .cmp_neq => try sema.zirCmpEq(block, inst, .neq, Air.Inst.Tag.fromCmpOp(.neq, block.float_mode == .optimized)),
10271027 .decl_ref => try sema.zirDeclRef(block, inst),
10281028 .decl_val => try sema.zirDeclVal(block, inst),
10291029 .load => try sema.zirLoad(block, inst),
......@@ -3236,7 +3236,7 @@ fn zirUnionDecl(
32363236 .status = .none,
32373237 .runtime_tag = if (small.has_tag_type or small.auto_enum_tag)
32383238 .tagged
3239 else if (small.layout != .Auto)
3239 else if (small.layout != .auto)
32403240 .none
32413241 else switch (block.wantSafety()) {
32423242 true => .safety,
......@@ -6274,7 +6274,7 @@ fn zirExportValue(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
62746274 .needed_comptime_reason = "export target must be comptime-known",
62756275 });
62766276 const options = try sema.resolveExportOptions(block, options_src, extra.options);
6277 if (options.linkage == .Internal)
6277 if (options.linkage == .internal)
62786278 return;
62796279 if (operand.val.getFunction(mod)) |function| {
62806280 const decl_index = function.owner_decl;
......@@ -6301,7 +6301,7 @@ pub fn analyzeExport(
63016301 const gpa = sema.gpa;
63026302 const mod = sema.mod;
63036303
6304 if (options.linkage == .Internal)
6304 if (options.linkage == .internal)
63056305 return;
63066306
63076307 try mod.ensureDeclAnalyzed(exported_decl_index);
......@@ -6450,8 +6450,8 @@ fn zirFence(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) Co
64506450 .needed_comptime_reason = "atomic order of @fence must be comptime-known",
64516451 });
64526452
6453 if (@intFromEnum(order) < @intFromEnum(std.builtin.AtomicOrder.Acquire)) {
6454 return sema.fail(block, order_src, "atomic ordering must be Acquire or stricter", .{});
6453 if (@intFromEnum(order) < @intFromEnum(std.builtin.AtomicOrder.acquire)) {
6454 return sema.fail(block, order_src, "atomic ordering must be acquire or stricter", .{});
64556455 }
64566456
64576457 _ = try block.addInst(.{
......@@ -10264,7 +10264,7 @@ fn intCast(
1026410264 const ok = if (is_vector) ok: {
1026510265 const is_in_range = try block.addCmpVector(diff_unsigned, dest_range, .lte);
1026610266 const all_in_range = try block.addInst(.{
10267 .tag = if (block.float_mode == .Optimized) .reduce_optimized else .reduce,
10267 .tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
1026810268 .data = .{ .reduce = .{
1026910269 .operand = is_in_range,
1027010270 .operation = .And,
......@@ -10281,7 +10281,7 @@ fn intCast(
1028110281 const ok = if (is_vector) ok: {
1028210282 const is_in_range = try block.addCmpVector(diff, dest_max, .lte);
1028310283 const all_in_range = try block.addInst(.{
10284 .tag = if (block.float_mode == .Optimized) .reduce_optimized else .reduce,
10284 .tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
1028510285 .data = .{ .reduce = .{
1028610286 .operand = is_in_range,
1028710287 .operation = .And,
......@@ -10303,7 +10303,7 @@ fn intCast(
1030310303 const zero_inst = Air.internedToRef(zero_val.toIntern());
1030410304 const is_in_range = try block.addCmpVector(operand, zero_inst, .gte);
1030510305 const all_in_range = try block.addInst(.{
10306 .tag = if (block.float_mode == .Optimized) .reduce_optimized else .reduce,
10306 .tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
1030710307 .data = .{ .reduce = .{
1030810308 .operand = is_in_range,
1030910309 .operation = .And,
......@@ -10380,7 +10380,7 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
1038010380 };
1038110381 return sema.failWithOwnedErrorMsg(block, msg);
1038210382 },
10383 .Struct, .Union => if (dest_ty.containerLayout(mod) == .Auto) {
10383 .Struct, .Union => if (dest_ty.containerLayout(mod) == .auto) {
1038410384 const container = switch (dest_ty.zigTypeTag(mod)) {
1038510385 .Struct => "struct",
1038610386 .Union => "union",
......@@ -10443,7 +10443,7 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
1044310443 };
1044410444 return sema.failWithOwnedErrorMsg(block, msg);
1044510445 },
10446 .Struct, .Union => if (operand_ty.containerLayout(mod) == .Auto) {
10446 .Struct, .Union => if (operand_ty.containerLayout(mod) == .auto) {
1044710447 const container = switch (operand_ty.zigTypeTag(mod)) {
1044810448 .Struct => "struct",
1044910449 .Union => "union",
......@@ -12530,7 +12530,7 @@ fn analyzeSwitchRuntimeBlock(
1253012530 cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items));
1253112531 } else {
1253212532 for (items) |item| {
12533 const cmp_ok = try case_block.addBinOp(if (case_block.float_mode == .Optimized) .cmp_eq_optimized else .cmp_eq, operand, item);
12533 const cmp_ok = try case_block.addBinOp(if (case_block.float_mode == .optimized) .cmp_eq_optimized else .cmp_eq, operand, item);
1253412534 if (any_ok != .none) {
1253512535 any_ok = try case_block.addBinOp(.bool_or, any_ok, cmp_ok);
1253612536 } else {
......@@ -12549,12 +12549,12 @@ fn analyzeSwitchRuntimeBlock(
1254912549
1255012550 // operand >= first and operand <= last
1255112551 const range_first_ok = try case_block.addBinOp(
12552 if (case_block.float_mode == .Optimized) .cmp_gte_optimized else .cmp_gte,
12552 if (case_block.float_mode == .optimized) .cmp_gte_optimized else .cmp_gte,
1255312553 operand,
1255412554 item_first,
1255512555 );
1255612556 const range_last_ok = try case_block.addBinOp(
12557 if (case_block.float_mode == .Optimized) .cmp_lte_optimized else .cmp_lte,
12557 if (case_block.float_mode == .optimized) .cmp_lte_optimized else .cmp_lte,
1255812558 operand,
1255912559 item_last,
1256012560 );
......@@ -13904,7 +13904,7 @@ fn zirShl(
1390413904 const ov_bit = try sema.tupleFieldValByIndex(block, src, op_ov, 1, op_ov_tuple_ty);
1390513905 const any_ov_bit = if (lhs_ty.zigTypeTag(mod) == .Vector)
1390613906 try block.addInst(.{
13907 .tag = if (block.float_mode == .Optimized) .reduce_optimized else .reduce,
13907 .tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
1390813908 .data = .{ .reduce = .{
1390913909 .operand = ov_bit,
1391013910 .operation = .Or,
......@@ -14044,7 +14044,7 @@ fn zirShr(
1404414044 const ok = if (rhs_ty.zigTypeTag(mod) == .Vector) ok: {
1404514045 const eql = try block.addCmpVector(lhs, back, .eq);
1404614046 break :ok try block.addInst(.{
14047 .tag = if (block.float_mode == .Optimized) .reduce_optimized else .reduce,
14047 .tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
1404814048 .data = .{ .reduce = .{
1404914049 .operand = eql,
1405014050 .operation = .And,
......@@ -14811,7 +14811,7 @@ fn zirNegate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
1481114811 return Air.internedToRef((try rhs_val.floatNeg(rhs_ty, sema.arena, mod)).toIntern());
1481214812 }
1481314813 try sema.requireRuntimeBlock(block, src, null);
14814 return block.addUnOp(if (block.float_mode == .Optimized) .neg_optimized else .neg, rhs);
14814 return block.addUnOp(if (block.float_mode == .optimized) .neg_optimized else .neg, rhs);
1481514815 }
1481614816
1481714817 const lhs = Air.internedToRef((try sema.splat(rhs_ty, try mod.intValue(rhs_scalar_ty, 0))).toIntern());
......@@ -15018,8 +15018,8 @@ fn zirDiv(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins
1501815018 }
1501915019 break :blk Air.Inst.Tag.div_trunc;
1502015020 } else switch (block.float_mode) {
15021 .Optimized => Air.Inst.Tag.div_float_optimized,
15022 .Strict => Air.Inst.Tag.div_float,
15021 .optimized => Air.Inst.Tag.div_float_optimized,
15022 .strict => Air.Inst.Tag.div_float,
1502315023 };
1502415024 return block.addBinOp(air_tag, casted_lhs, casted_rhs);
1502515025}
......@@ -15142,8 +15142,8 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1514215142 const eql = try block.addCmpVector(result, floored, .eq);
1514315143 break :ok try block.addInst(.{
1514415144 .tag = switch (block.float_mode) {
15145 .Strict => .reduce,
15146 .Optimized => .reduce_optimized,
15145 .strict => .reduce,
15146 .optimized => .reduce_optimized,
1514715147 },
1514815148 .data = .{ .reduce = .{
1514915149 .operand = eql,
......@@ -15152,8 +15152,8 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1515215152 });
1515315153 } else {
1515415154 const is_in_range = try block.addBinOp(switch (block.float_mode) {
15155 .Strict => .cmp_eq,
15156 .Optimized => .cmp_eq_optimized,
15155 .strict => .cmp_eq,
15156 .optimized => .cmp_eq_optimized,
1515715157 }, result, floored);
1515815158 break :ok is_in_range;
1515915159 }
......@@ -15503,7 +15503,7 @@ fn addDivByZeroSafety(
1550315503 is_int: bool,
1550415504) CompileError!void {
1550515505 // Strict IEEE floats have well-defined division by zero.
15506 if (!is_int and block.float_mode == .Strict) return;
15506 if (!is_int and block.float_mode == .strict) return;
1550715507
1550815508 // If rhs was comptime-known to be zero a compile error would have been
1550915509 // emitted above.
......@@ -15535,8 +15535,8 @@ fn addDivByZeroSafety(
1553515535fn airTag(block: *Block, is_int: bool, normal: Air.Inst.Tag, optimized: Air.Inst.Tag) Air.Inst.Tag {
1553615536 if (is_int) return normal;
1553715537 return switch (block.float_mode) {
15538 .Strict => normal,
15539 .Optimized => optimized,
15538 .strict => normal,
15539 .optimized => optimized,
1554015540 };
1554115541}
1554215542
......@@ -16228,7 +16228,7 @@ fn analyzeArithmetic(
1622816228 return casted_lhs;
1622916229 }
1623016230 }
16231 const air_tag: Air.Inst.Tag = if (block.float_mode == .Optimized) .add_optimized else .add;
16231 const air_tag: Air.Inst.Tag = if (block.float_mode == .optimized) .add_optimized else .add;
1623216232 if (maybe_lhs_val) |lhs_val| {
1623316233 if (lhs_val.isUndef(mod)) {
1623416234 if (is_int) {
......@@ -16330,7 +16330,7 @@ fn analyzeArithmetic(
1633016330 return casted_lhs;
1633116331 }
1633216332 }
16333 const air_tag: Air.Inst.Tag = if (block.float_mode == .Optimized) .sub_optimized else .sub;
16333 const air_tag: Air.Inst.Tag = if (block.float_mode == .optimized) .sub_optimized else .sub;
1633416334 if (maybe_lhs_val) |lhs_val| {
1633516335 if (lhs_val.isUndef(mod)) {
1633616336 if (is_int) {
......@@ -16448,7 +16448,7 @@ fn analyzeArithmetic(
1644816448 }
1644916449 }
1645016450 }
16451 const air_tag: Air.Inst.Tag = if (block.float_mode == .Optimized) .mul_optimized else .mul;
16451 const air_tag: Air.Inst.Tag = if (block.float_mode == .optimized) .mul_optimized else .mul;
1645216452 if (maybe_rhs_val) |rhs_val| {
1645316453 if (rhs_val.isUndef(mod)) {
1645416454 if (is_int) {
......@@ -16625,7 +16625,7 @@ fn analyzeArithmetic(
1662516625 const ov_bit = try sema.tupleFieldValByIndex(block, src, op_ov, 1, op_ov_tuple_ty);
1662616626 const any_ov_bit = if (resolved_type.zigTypeTag(mod) == .Vector)
1662716627 try block.addInst(.{
16628 .tag = if (block.float_mode == .Optimized) .reduce_optimized else .reduce,
16628 .tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
1662916629 .data = .{ .reduce = .{
1663016630 .operand = ov_bit,
1663116631 .operation = .Or,
......@@ -17168,7 +17168,7 @@ fn cmpSelf(
1716817168 if (resolved_type.zigTypeTag(mod) == .Vector) {
1716917169 return block.addCmpVector(casted_lhs, casted_rhs, op);
1717017170 }
17171 const tag = Air.Inst.Tag.fromCmpOp(op, block.float_mode == .Optimized);
17171 const tag = Air.Inst.Tag.fromCmpOp(op, block.float_mode == .optimized);
1717217172 return block.addBinOp(tag, casted_lhs, casted_rhs);
1717317173}
1717417174
......@@ -18131,8 +18131,8 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1813118131 };
1813218132
1813318133 const alignment = switch (layout) {
18134 .Auto, .Extern => try sema.unionFieldAlignment(union_obj, @intCast(i)),
18135 .Packed => .none,
18134 .auto, .@"extern" => try sema.unionFieldAlignment(union_obj, @intCast(i)),
18135 .@"packed" => .none,
1813618136 };
1813718137
1813818138 const field_ty = union_obj.field_types.get(ip)[i];
......@@ -18350,7 +18350,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1835018350 const opt_default_val = if (field_init == .none) null else Value.fromInterned(field_init);
1835118351 const default_val_ptr = try sema.optRefValue(opt_default_val);
1835218352 const alignment = switch (struct_type.layout) {
18353 .Packed => .none,
18353 .@"packed" => .none,
1835418354 else => try sema.structFieldAlignment(
1835518355 struct_type.fieldAlign(ip, i),
1835618356 field_ty,
......@@ -19906,7 +19906,7 @@ fn zirStructInit(
1990619906 var field_i: u32 = 0;
1990719907 var extra_index = extra.end;
1990819908
19909 const is_packed = resolved_ty.containerLayout(mod) == .Packed;
19909 const is_packed = resolved_ty.containerLayout(mod) == .@"packed";
1991019910 while (field_i < extra.data.fields_len) : (field_i += 1) {
1991119911 const item = sema.code.extraData(Zir.Inst.StructInit.Item, extra_index);
1991219912 extra_index = item.end;
......@@ -21302,7 +21302,7 @@ fn zirReify(
2130221302 return sema.fail(block, src, "reified structs must have no decls", .{});
2130321303 }
2130421304
21305 if (layout != .Packed and !backing_integer_val.isNull(mod)) {
21305 if (layout != .@"packed" and !backing_integer_val.isNull(mod)) {
2130621306 return sema.fail(block, src, "non-packed struct does not support backing integer type", .{});
2130721307 }
2130821308
......@@ -21665,7 +21665,7 @@ fn reifyUnion(
2166521665 .status = .none,
2166621666 .runtime_tag = if (opt_tag_type_val.optionalValue(mod) != null)
2166721667 .tagged
21668 else if (layout != .Auto)
21668 else if (layout != .auto)
2166921669 .none
2167021670 else switch (block.wantSafety()) {
2167121671 true => .safety,
......@@ -21804,7 +21804,7 @@ fn reifyUnion(
2180421804 break :msg msg;
2180521805 });
2180621806 }
21807 if (layout == .Extern and !try sema.validateExternType(field_ty, .union_field)) {
21807 if (layout == .@"extern" and !try sema.validateExternType(field_ty, .union_field)) {
2180821808 return sema.failWithOwnedErrorMsg(block, msg: {
2180921809 const msg = try sema.errMsg(block, src, "extern unions cannot contain fields of type '{}'", .{field_ty.fmt(mod)});
2181021810 errdefer msg.destroy(gpa);
......@@ -21815,7 +21815,7 @@ fn reifyUnion(
2181521815 try sema.addDeclaredHereNote(msg, field_ty);
2181621816 break :msg msg;
2181721817 });
21818 } else if (layout == .Packed and !try sema.validatePackedType(field_ty)) {
21818 } else if (layout == .@"packed" and !try sema.validatePackedType(field_ty)) {
2181921819 return sema.failWithOwnedErrorMsg(block, msg: {
2182021820 const msg = try sema.errMsg(block, src, "packed unions cannot contain fields of type '{}'", .{field_ty.fmt(mod)});
2182121821 errdefer msg.destroy(gpa);
......@@ -21938,9 +21938,9 @@ fn reifyStruct(
2193821938 errdefer wip_ty.cancel(ip);
2193921939
2194021940 if (is_tuple) switch (layout) {
21941 .Extern => return sema.fail(block, src, "extern tuples are not supported", .{}),
21942 .Packed => return sema.fail(block, src, "packed tuples are not supported", .{}),
21943 .Auto => {},
21941 .@"extern" => return sema.fail(block, src, "extern tuples are not supported", .{}),
21942 .@"packed" => return sema.fail(block, src, "packed tuples are not supported", .{}),
21943 .auto => {},
2194421944 };
2194521945
2194621946 const new_decl_index = try sema.createAnonymousDeclTypeNamed(block, src, .{
......@@ -21990,11 +21990,11 @@ fn reifyStruct(
2199021990
2199121991 const byte_align = try field_alignment_val.toUnsignedIntAdvanced(sema);
2199221992 if (byte_align == 0) {
21993 if (layout != .Packed) {
21993 if (layout != .@"packed") {
2199421994 struct_type.field_aligns.get(ip)[field_idx] = .none;
2199521995 }
2199621996 } else {
21997 if (layout == .Packed) return sema.fail(block, src, "alignment in a packed struct field must be set to 0", .{});
21997 if (layout == .@"packed") return sema.fail(block, src, "alignment in a packed struct field must be set to 0", .{});
2199821998 if (!math.isPowerOfTwo(byte_align)) return sema.fail(block, src, "alignment value '{d}' is not a power of two or zero", .{byte_align});
2199921999 struct_type.field_aligns.get(ip)[field_idx] = Alignment.fromNonzeroByteUnits(byte_align);
2200022000 }
......@@ -22004,9 +22004,9 @@ fn reifyStruct(
2200422004 if (field_is_comptime) {
2200522005 assert(any_comptime_fields);
2200622006 switch (layout) {
22007 .Extern => return sema.fail(block, src, "extern struct fields cannot be marked comptime", .{}),
22008 .Packed => return sema.fail(block, src, "packed struct fields cannot be marked comptime", .{}),
22009 .Auto => struct_type.setFieldComptime(ip, field_idx),
22007 .@"extern" => return sema.fail(block, src, "extern struct fields cannot be marked comptime", .{}),
22008 .@"packed" => return sema.fail(block, src, "packed struct fields cannot be marked comptime", .{}),
22009 .auto => struct_type.setFieldComptime(ip, field_idx),
2201022010 }
2201122011 }
2201222012
......@@ -22047,7 +22047,7 @@ fn reifyStruct(
2204722047 break :msg msg;
2204822048 });
2204922049 }
22050 if (layout == .Extern and !try sema.validateExternType(field_ty, .struct_field)) {
22050 if (layout == .@"extern" and !try sema.validateExternType(field_ty, .struct_field)) {
2205122051 return sema.failWithOwnedErrorMsg(block, msg: {
2205222052 const msg = try sema.errMsg(block, src, "extern structs cannot contain fields of type '{}'", .{field_ty.fmt(sema.mod)});
2205322053 errdefer msg.destroy(gpa);
......@@ -22058,7 +22058,7 @@ fn reifyStruct(
2205822058 try sema.addDeclaredHereNote(msg, field_ty);
2205922059 break :msg msg;
2206022060 });
22061 } else if (layout == .Packed and !try sema.validatePackedType(field_ty)) {
22061 } else if (layout == .@"packed" and !try sema.validatePackedType(field_ty)) {
2206222062 return sema.failWithOwnedErrorMsg(block, msg: {
2206322063 const msg = try sema.errMsg(block, src, "packed structs cannot contain fields of type '{}'", .{field_ty.fmt(sema.mod)});
2206422064 errdefer msg.destroy(gpa);
......@@ -22072,7 +22072,7 @@ fn reifyStruct(
2207222072 }
2207322073 }
2207422074
22075 if (layout == .Packed) {
22075 if (layout == .@"packed") {
2207622076 var fields_bit_sum: u64 = 0;
2207722077 for (0..struct_type.field_types.len) |field_idx| {
2207822078 const field_ty = Type.fromInterned(struct_type.field_types.get(ip)[field_idx]);
......@@ -22226,7 +22226,7 @@ fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
2222622226 if (dest_scalar_ty.intInfo(mod).bits == 0) {
2222722227 if (!is_vector) {
2222822228 if (block.wantSafety()) {
22229 const ok = try block.addBinOp(if (block.float_mode == .Optimized) .cmp_eq_optimized else .cmp_eq, operand, Air.internedToRef((try mod.floatValue(operand_ty, 0.0)).toIntern()));
22229 const ok = try block.addBinOp(if (block.float_mode == .optimized) .cmp_eq_optimized else .cmp_eq, operand, Air.internedToRef((try mod.floatValue(operand_ty, 0.0)).toIntern()));
2223022230 try sema.addSafetyCheck(block, src, ok, .integer_part_out_of_bounds);
2223122231 }
2223222232 return Air.internedToRef((try mod.intValue(dest_ty, 0)).toIntern());
......@@ -22236,7 +22236,7 @@ fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
2223622236 for (0..len) |i| {
2223722237 const idx_ref = try mod.intRef(Type.usize, i);
2223822238 const elem_ref = try block.addBinOp(.array_elem_val, operand, idx_ref);
22239 const ok = try block.addBinOp(if (block.float_mode == .Optimized) .cmp_eq_optimized else .cmp_eq, elem_ref, Air.internedToRef((try mod.floatValue(operand_scalar_ty, 0.0)).toIntern()));
22239 const ok = try block.addBinOp(if (block.float_mode == .optimized) .cmp_eq_optimized else .cmp_eq, elem_ref, Air.internedToRef((try mod.floatValue(operand_scalar_ty, 0.0)).toIntern()));
2224022240 try sema.addSafetyCheck(block, src, ok, .integer_part_out_of_bounds);
2224122241 }
2224222242 }
......@@ -22246,12 +22246,12 @@ fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
2224622246 } }));
2224722247 }
2224822248 if (!is_vector) {
22249 const result = try block.addTyOp(if (block.float_mode == .Optimized) .int_from_float_optimized else .int_from_float, dest_ty, operand);
22249 const result = try block.addTyOp(if (block.float_mode == .optimized) .int_from_float_optimized else .int_from_float, dest_ty, operand);
2225022250 if (block.wantSafety()) {
2225122251 const back = try block.addTyOp(.float_from_int, operand_ty, result);
2225222252 const diff = try block.addBinOp(.sub, operand, back);
22253 const ok_pos = try block.addBinOp(if (block.float_mode == .Optimized) .cmp_lt_optimized else .cmp_lt, diff, Air.internedToRef((try mod.floatValue(operand_ty, 1.0)).toIntern()));
22254 const ok_neg = try block.addBinOp(if (block.float_mode == .Optimized) .cmp_gt_optimized else .cmp_gt, diff, Air.internedToRef((try mod.floatValue(operand_ty, -1.0)).toIntern()));
22253 const ok_pos = try block.addBinOp(if (block.float_mode == .optimized) .cmp_lt_optimized else .cmp_lt, diff, Air.internedToRef((try mod.floatValue(operand_ty, 1.0)).toIntern()));
22254 const ok_neg = try block.addBinOp(if (block.float_mode == .optimized) .cmp_gt_optimized else .cmp_gt, diff, Air.internedToRef((try mod.floatValue(operand_ty, -1.0)).toIntern()));
2225522255 const ok = try block.addBinOp(.bool_and, ok_pos, ok_neg);
2225622256 try sema.addSafetyCheck(block, src, ok, .integer_part_out_of_bounds);
2225722257 }
......@@ -22262,12 +22262,12 @@ fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
2226222262 for (new_elems, 0..) |*new_elem, i| {
2226322263 const idx_ref = try mod.intRef(Type.usize, i);
2226422264 const old_elem = try block.addBinOp(.array_elem_val, operand, idx_ref);
22265 const result = try block.addTyOp(if (block.float_mode == .Optimized) .int_from_float_optimized else .int_from_float, dest_scalar_ty, old_elem);
22265 const result = try block.addTyOp(if (block.float_mode == .optimized) .int_from_float_optimized else .int_from_float, dest_scalar_ty, old_elem);
2226622266 if (block.wantSafety()) {
2226722267 const back = try block.addTyOp(.float_from_int, operand_scalar_ty, result);
2226822268 const diff = try block.addBinOp(.sub, old_elem, back);
22269 const ok_pos = try block.addBinOp(if (block.float_mode == .Optimized) .cmp_lt_optimized else .cmp_lt, diff, Air.internedToRef((try mod.floatValue(operand_scalar_ty, 1.0)).toIntern()));
22270 const ok_neg = try block.addBinOp(if (block.float_mode == .Optimized) .cmp_gt_optimized else .cmp_gt, diff, Air.internedToRef((try mod.floatValue(operand_scalar_ty, -1.0)).toIntern()));
22269 const ok_pos = try block.addBinOp(if (block.float_mode == .optimized) .cmp_lt_optimized else .cmp_lt, diff, Air.internedToRef((try mod.floatValue(operand_scalar_ty, 1.0)).toIntern()));
22270 const ok_neg = try block.addBinOp(if (block.float_mode == .optimized) .cmp_gt_optimized else .cmp_gt, diff, Air.internedToRef((try mod.floatValue(operand_scalar_ty, -1.0)).toIntern()));
2227122271 const ok = try block.addBinOp(.bool_and, ok_pos, ok_neg);
2227222272 try sema.addSafetyCheck(block, src, ok, .integer_part_out_of_bounds);
2227322273 }
......@@ -23311,7 +23311,7 @@ fn bitOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!u6
2331123311 }
2331223312
2331323313 switch (ty.containerLayout(mod)) {
23314 .Packed => {
23314 .@"packed" => {
2331523315 var bit_sum: u64 = 0;
2331623316 const struct_type = ip.loadStructType(ty.toIntern());
2331723317 for (0..struct_type.field_types.len) |i| {
......@@ -23802,7 +23802,7 @@ fn resolveExportOptions(
2380223802 return sema.fail(block, name_src, "exported symbol name cannot be empty", .{});
2380323803 }
2380423804
23805 if (visibility != .default and linkage == .Internal) {
23805 if (visibility != .default and linkage == .internal) {
2380623806 return sema.fail(block, visibility_src, "symbol '{s}' exported with internal linkage has non-default visibility {s}", .{
2380723807 name, @tagName(visibility),
2380823808 });
......@@ -23894,17 +23894,17 @@ fn zirCmpxchg(
2389423894 .needed_comptime_reason = "atomic order of cmpxchg failure must be comptime-known",
2389523895 });
2389623896
23897 if (@intFromEnum(success_order) < @intFromEnum(std.builtin.AtomicOrder.Monotonic)) {
23898 return sema.fail(block, success_order_src, "success atomic ordering must be Monotonic or stricter", .{});
23897 if (@intFromEnum(success_order) < @intFromEnum(std.builtin.AtomicOrder.monotonic)) {
23898 return sema.fail(block, success_order_src, "success atomic ordering must be monotonic or stricter", .{});
2389923899 }
23900 if (@intFromEnum(failure_order) < @intFromEnum(std.builtin.AtomicOrder.Monotonic)) {
23901 return sema.fail(block, failure_order_src, "failure atomic ordering must be Monotonic or stricter", .{});
23900 if (@intFromEnum(failure_order) < @intFromEnum(std.builtin.AtomicOrder.monotonic)) {
23901 return sema.fail(block, failure_order_src, "failure atomic ordering must be monotonic or stricter", .{});
2390223902 }
2390323903 if (@intFromEnum(failure_order) > @intFromEnum(success_order)) {
2390423904 return sema.fail(block, failure_order_src, "failure atomic ordering must be no stricter than success", .{});
2390523905 }
23906 if (failure_order == .Release or failure_order == .AcqRel) {
23907 return sema.fail(block, failure_order_src, "failure atomic ordering must not be Release or AcqRel", .{});
23906 if (failure_order == .release or failure_order == .acq_rel) {
23907 return sema.fail(block, failure_order_src, "failure atomic ordering must not be release or acq_rel", .{});
2390823908 }
2390923909
2391023910 const result_ty = try mod.optionalType(elem_ty.toIntern());
......@@ -24042,7 +24042,7 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
2404224042
2404324043 try sema.requireRuntimeBlock(block, inst_data.src(), operand_src);
2404424044 return block.addInst(.{
24045 .tag = if (block.float_mode == .Optimized) .reduce_optimized else .reduce,
24045 .tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
2404624046 .data = .{ .reduce = .{
2404724047 .operand = operand,
2404824048 .operation = operation,
......@@ -24346,11 +24346,11 @@ fn zirAtomicLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
2434624346 });
2434724347
2434824348 switch (order) {
24349 .Release, .AcqRel => {
24349 .release, .acq_rel => {
2435024350 return sema.fail(
2435124351 block,
2435224352 order_src,
24353 "@atomicLoad atomic ordering must not be Release or AcqRel",
24353 "@atomicLoad atomic ordering must not be release or acq_rel",
2435424354 .{},
2435524355 );
2435624356 },
......@@ -24412,8 +24412,8 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
2441224412 .needed_comptime_reason = "atomic order of @atomicRmW must be comptime-known",
2441324413 });
2441424414
24415 if (order == .Unordered) {
24416 return sema.fail(block, order_src, "@atomicRmw atomic ordering must not be Unordered", .{});
24415 if (order == .unordered) {
24416 return sema.fail(block, order_src, "@atomicRmw atomic ordering must not be unordered", .{});
2441724417 }
2441824418
2441924419 // special case zero bit types
......@@ -24482,18 +24482,18 @@ fn zirAtomicStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
2448224482 });
2448324483
2448424484 const air_tag: Air.Inst.Tag = switch (order) {
24485 .Acquire, .AcqRel => {
24485 .acquire, .acq_rel => {
2448624486 return sema.fail(
2448724487 block,
2448824488 order_src,
24489 "@atomicStore atomic ordering must not be Acquire or AcqRel",
24489 "@atomicStore atomic ordering must not be acquire or acq_rel",
2449024490 .{},
2449124491 );
2449224492 },
24493 .Unordered => .atomic_store_unordered,
24494 .Monotonic => .atomic_store_monotonic,
24495 .Release => .atomic_store_release,
24496 .SeqCst => .atomic_store_seq_cst,
24493 .unordered => .atomic_store_unordered,
24494 .monotonic => .atomic_store_monotonic,
24495 .release => .atomic_store_release,
24496 .seq_cst => .atomic_store_seq_cst,
2449724497 };
2449824498
2449924499 return sema.storePtr2(block, src, ptr, ptr_src, operand, operand_src, air_tag);
......@@ -24710,7 +24710,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr
2471024710 },
2471124711 };
2471224712
24713 if (parent_ty.containerLayout(mod) == .Packed) {
24713 if (parent_ty.containerLayout(mod) == .@"packed") {
2471424714 return sema.fail(block, src, "TODO handle packed structs/unions with @fieldParentPtr", .{});
2471524715 } else {
2471624716 ptr_ty_data.flags.alignment = blk: {
......@@ -25888,7 +25888,7 @@ fn resolveExternOptions(
2588825888) CompileError!struct {
2588925889 name: InternPool.NullTerminatedString,
2589025890 library_name: InternPool.OptionalNullTerminatedString = .none,
25891 linkage: std.builtin.GlobalLinkage = .Strong,
25891 linkage: std.builtin.GlobalLinkage = .strong,
2589225892 is_thread_local: bool = false,
2589325893} {
2589425894 const mod = sema.mod;
......@@ -25938,7 +25938,7 @@ fn resolveExternOptions(
2593825938 return sema.fail(block, name_src, "extern symbol name cannot be empty", .{});
2593925939 }
2594025940
25941 if (linkage != .Weak and linkage != .Strong) {
25941 if (linkage != .weak and linkage != .strong) {
2594225942 return sema.fail(block, linkage_src, "extern symbol must use strong or weak linkage", .{});
2594325943 }
2594425944
......@@ -25984,7 +25984,7 @@ fn zirBuiltinExtern(
2598425984 else => |e| return e,
2598525985 };
2598625986
25987 if (options.linkage == .Weak and !ty.ptrAllowsZero(mod)) {
25987 if (options.linkage == .weak and !ty.ptrAllowsZero(mod)) {
2598825988 ty = try mod.optionalType(ty.toIntern());
2598925989 }
2599025990 const ptr_info = ty.ptrInfo(mod);
......@@ -26010,7 +26010,7 @@ fn zirBuiltinExtern(
2601026010 .is_extern = true,
2601126011 .is_const = ptr_info.flags.is_const,
2601226012 .is_threadlocal = options.is_thread_local,
26013 .is_weak_linkage = options.linkage == .Weak,
26013 .is_weak_linkage = options.linkage == .weak,
2601426014 } }),
2601526015 ),
2601626016 }, options.name);
......@@ -26328,15 +26328,15 @@ fn validateExternType(
2632826328 return sema.validateExternType(ty.intTagType(mod), position);
2632926329 },
2633026330 .Struct, .Union => switch (ty.containerLayout(mod)) {
26331 .Extern => return true,
26332 .Packed => {
26331 .@"extern" => return true,
26332 .@"packed" => {
2633326333 const bit_size = try ty.bitSizeAdvanced(mod, sema);
2633426334 switch (bit_size) {
2633526335 0, 8, 16, 32, 64, 128 => return true,
2633626336 else => return false,
2633726337 }
2633826338 },
26339 .Auto => return !(try sema.typeHasRuntimeBits(ty)),
26339 .auto => return !(try sema.typeHasRuntimeBits(ty)),
2634026340 },
2634126341 .Array => {
2634226342 if (position == .ret_ty or position == .param_ty) return false;
......@@ -26456,7 +26456,7 @@ fn validatePackedType(sema: *Sema, ty: Type) !bool {
2645626456 .Enum,
2645726457 => return true,
2645826458 .Pointer => return !ty.isSlice(mod) and !try sema.typeRequiresComptime(ty),
26459 .Struct, .Union => return ty.containerLayout(mod) == .Packed,
26459 .Struct, .Union => return ty.containerLayout(mod) == .@"packed",
2646026460 }
2646126461}
2646226462
......@@ -27596,7 +27596,7 @@ fn structFieldPtrByIndex(
2759627596 else
2759727597 try sema.typeAbiAlignment(Type.fromInterned(struct_ptr_ty_info.child));
2759827598
27599 if (struct_type.layout == .Packed) {
27599 if (struct_type.layout == .@"packed") {
2760027600 comptime assert(Type.packed_struct_layout_version == 2);
2760127601
2760227602 var running_bits: u16 = 0;
......@@ -27641,7 +27641,7 @@ fn structFieldPtrByIndex(
2764127641 ptr_ty_data.packed_offset = .{ .host_size = 0, .bit_offset = 0 };
2764227642 }
2764327643 }
27644 } else if (struct_type.layout == .Extern) {
27644 } else if (struct_type.layout == .@"extern") {
2764527645 // For extern structs, field alignment might be bigger than type's
2764627646 // natural alignment. Eg, in `extern struct { x: u32, y: u16 }` the
2764727647 // second field is aligned as u32.
......@@ -27846,7 +27846,7 @@ fn unionFieldPtr(
2784627846 .is_const = union_ptr_info.flags.is_const,
2784727847 .is_volatile = union_ptr_info.flags.is_volatile,
2784827848 .address_space = union_ptr_info.flags.address_space,
27849 .alignment = if (union_obj.getLayout(ip) == .Auto) blk: {
27849 .alignment = if (union_obj.getLayout(ip) == .auto) blk: {
2785027850 const union_align = if (union_ptr_info.flags.alignment != .none)
2785127851 union_ptr_info.flags.alignment
2785227852 else
......@@ -27875,7 +27875,7 @@ fn unionFieldPtr(
2787527875
2787627876 if (try sema.resolveDefinedValue(block, src, union_ptr)) |union_ptr_val| ct: {
2787727877 switch (union_obj.getLayout(ip)) {
27878 .Auto => if (!initializing) {
27878 .auto => if (!initializing) {
2787927879 const union_val = (try sema.pointerDeref(block, src, union_ptr_val, union_ptr_ty)) orelse
2788027880 break :ct;
2788127881 if (union_val.isUndef(mod)) {
......@@ -27899,7 +27899,7 @@ fn unionFieldPtr(
2789927899 return sema.failWithOwnedErrorMsg(block, msg);
2790027900 }
2790127901 },
27902 .Packed, .Extern => {},
27902 .@"packed", .@"extern" => {},
2790327903 }
2790427904 return Air.internedToRef((try mod.intern(.{ .ptr = .{
2790527905 .ty = ptr_field_ty.toIntern(),
......@@ -27911,7 +27911,7 @@ fn unionFieldPtr(
2791127911 }
2791227912
2791327913 try sema.requireRuntimeBlock(block, src, null);
27914 if (!initializing and union_obj.getLayout(ip) == .Auto and block.wantSafety() and
27914 if (!initializing and union_obj.getLayout(ip) == .auto and block.wantSafety() and
2791527915 union_ty.unionTagTypeSafety(mod) != null and union_obj.field_types.len > 1)
2791627916 {
2791727917 const wanted_tag_val = try mod.enumValueFieldIndex(Type.fromInterned(union_obj.enum_tag_ty), enum_field_index);
......@@ -27954,7 +27954,7 @@ fn unionFieldVal(
2795427954 const field_tag = try mod.enumValueFieldIndex(Type.fromInterned(union_obj.enum_tag_ty), enum_field_index);
2795527955 const tag_matches = un.tag == field_tag.toIntern();
2795627956 switch (union_obj.getLayout(ip)) {
27957 .Auto => {
27957 .auto => {
2795827958 if (tag_matches) {
2795927959 return Air.internedToRef(un.val);
2796027960 } else {
......@@ -27971,7 +27971,7 @@ fn unionFieldVal(
2797127971 return sema.failWithOwnedErrorMsg(block, msg);
2797227972 }
2797327973 },
27974 .Packed, .Extern => |layout| {
27974 .@"packed", .@"extern" => |layout| {
2797527975 if (tag_matches) {
2797627976 return Air.internedToRef(un.val);
2797727977 } else {
......@@ -27989,7 +27989,7 @@ fn unionFieldVal(
2798927989 }
2799027990
2799127991 try sema.requireRuntimeBlock(block, src, null);
27992 if (union_obj.getLayout(ip) == .Auto and block.wantSafety() and
27992 if (union_obj.getLayout(ip) == .auto and block.wantSafety() and
2799327993 union_ty.unionTagTypeSafety(mod) != null and union_obj.field_types.len > 1)
2799427994 {
2799527995 const wanted_tag_val = try mod.enumValueFieldIndex(Type.fromInterned(union_obj.enum_tag_ty), enum_field_index);
......@@ -30961,7 +30961,7 @@ fn beginComptimePtrMutation(
3096130961
3096230962 const tag_type = base_child_ty.unionTagTypeHypothetical(mod);
3096330963 const hypothetical_tag = try mod.enumValueFieldIndex(tag_type, field_index);
30964 if (layout == .Auto or (payload.tag != null and hypothetical_tag.eql(payload.tag.?, tag_type, mod))) {
30964 if (layout == .auto or (payload.tag != null and hypothetical_tag.eql(payload.tag.?, tag_type, mod))) {
3096530965 // We need to set the active field of the union.
3096630966 payload.tag = hypothetical_tag;
3096730967
......@@ -30988,7 +30988,7 @@ fn beginComptimePtrMutation(
3098830988 .pointee = .{ .reinterpret = .{
3098930989 .val_ptr = val_ptr,
3099030990 .byte_offset = 0,
30991 .write_packed = layout == .Packed,
30991 .write_packed = layout == .@"packed",
3099230992 } },
3099330993 .ty = parent.ty,
3099430994 };
......@@ -31395,7 +31395,7 @@ fn beginComptimePtrLoad(
3139531395
3139631396 if (container_ty.hasWellDefinedLayout(mod)) {
3139731397 const struct_obj = mod.typeToStruct(container_ty);
31398 if (struct_obj != null and struct_obj.?.layout == .Packed) {
31398 if (struct_obj != null and struct_obj.?.layout == .@"packed") {
3139931399 // packed structs are not byte addressable
3140031400 deref.parent = null;
3140131401 } else if (deref.parent) |*parent| {
......@@ -31551,7 +31551,7 @@ fn bitCastUnionFieldVal(
3155131551
3155231552 // Reading a larger value means we need to reinterpret from undefined bytes.
3155331553 const offset = switch (layout) {
31554 .Extern => offset: {
31554 .@"extern" => offset: {
3155531555 if (field_size > old_size) @memset(buffer[old_size..], 0xaa);
3155631556 val.writeToMemory(old_ty, mod, buffer) catch |err| switch (err) {
3155731557 error.OutOfMemory => return error.OutOfMemory,
......@@ -31561,7 +31561,7 @@ fn bitCastUnionFieldVal(
3156131561 };
3156231562 break :offset 0;
3156331563 },
31564 .Packed => offset: {
31564 .@"packed" => offset: {
3156531565 if (field_size > old_size) {
3156631566 const min_size = @max(old_size, 1);
3156731567 switch (endian) {
......@@ -31577,7 +31577,7 @@ fn bitCastUnionFieldVal(
3157731577
3157831578 break :offset if (endian == .big) buffer.len - field_size else 0;
3157931579 },
31580 .Auto => unreachable,
31580 .auto => unreachable,
3158131581 };
3158231582
3158331583 return Value.readFromMemory(field_ty, mod, buffer[offset..], sema.arena) catch |err| switch (err) {
......@@ -33506,7 +33506,7 @@ fn cmpNumeric(
3350633506 };
3350733507 const casted_lhs = try sema.coerce(block, dest_ty, lhs, lhs_src);
3350833508 const casted_rhs = try sema.coerce(block, dest_ty, rhs, rhs_src);
33509 return block.addBinOp(Air.Inst.Tag.fromCmpOp(op, block.float_mode == .Optimized), casted_lhs, casted_rhs);
33509 return block.addBinOp(Air.Inst.Tag.fromCmpOp(op, block.float_mode == .optimized), casted_lhs, casted_rhs);
3351033510 }
3351133511 // For mixed unsigned integer sizes, implicit cast both operands to the larger integer.
3351233512 // For mixed signed and unsigned integers, implicit cast both operands to a signed
......@@ -33651,7 +33651,7 @@ fn cmpNumeric(
3365133651 const casted_lhs = try sema.coerce(block, dest_ty, lhs, lhs_src);
3365233652 const casted_rhs = try sema.coerce(block, dest_ty, rhs, rhs_src);
3365333653
33654 return block.addBinOp(Air.Inst.Tag.fromCmpOp(op, block.float_mode == .Optimized), casted_lhs, casted_rhs);
33654 return block.addBinOp(Air.Inst.Tag.fromCmpOp(op, block.float_mode == .optimized), casted_lhs, casted_rhs);
3365533655}
3365633656
3365733657/// Asserts that LHS value is an int or comptime int and not undefined, and
......@@ -35608,7 +35608,7 @@ pub fn resolveStructAlignment(
3560835608 const target = mod.getTarget();
3560935609
3561035610 assert(struct_type.flagsPtr(ip).alignment == .none);
35611 assert(struct_type.layout != .Packed);
35611 assert(struct_type.layout != .@"packed");
3561235612
3561335613 if (struct_type.flagsPtr(ip).field_types_wip) {
3561435614 // We'll guess "pointer-aligned", if the struct has an
......@@ -35661,7 +35661,7 @@ fn resolveStructLayout(sema: *Sema, ty: Type) CompileError!void {
3566135661
3566235662 try sema.resolveTypeFields(ty);
3566335663
35664 if (struct_type.layout == .Packed) {
35664 if (struct_type.layout == .@"packed") {
3566535665 try semaBackingIntType(mod, struct_type);
3566635666 return;
3566735667 }
......@@ -36625,11 +36625,11 @@ fn semaStructFields(
3662536625 const fields_len, const small, var extra_index = structZirInfo(zir, zir_index);
3662636626
3662736627 if (fields_len == 0) switch (struct_type.layout) {
36628 .Packed => {
36628 .@"packed" => {
3662936629 try semaBackingIntType(mod, struct_type);
3663036630 return;
3663136631 },
36632 .Auto, .Extern => {
36632 .auto, .@"extern" => {
3663336633 struct_type.size(ip).* = 0;
3663436634 struct_type.flagsPtr(ip).layout_resolved = true;
3663536635 return;
......@@ -36810,7 +36810,7 @@ fn semaStructFields(
3681036810 return sema.failWithOwnedErrorMsg(&block_scope, msg);
3681136811 }
3681236812 switch (struct_type.layout) {
36813 .Extern => if (!try sema.validateExternType(field_ty, .struct_field)) {
36813 .@"extern" => if (!try sema.validateExternType(field_ty, .struct_field)) {
3681436814 const msg = msg: {
3681536815 const ty_src = mod.fieldSrcLoc(decl_index, .{
3681636816 .index = field_i,
......@@ -36826,7 +36826,7 @@ fn semaStructFields(
3682636826 };
3682736827 return sema.failWithOwnedErrorMsg(&block_scope, msg);
3682836828 },
36829 .Packed => if (!try sema.validatePackedType(field_ty)) {
36829 .@"packed" => if (!try sema.validatePackedType(field_ty)) {
3683036830 const msg = msg: {
3683136831 const ty_src = mod.fieldSrcLoc(decl_index, .{
3683236832 .index = field_i,
......@@ -37350,7 +37350,7 @@ fn semaUnionFields(mod: *Module, arena: Allocator, union_type: InternPool.Loaded
3735037350 return sema.failWithOwnedErrorMsg(&block_scope, msg);
3735137351 }
3735237352 const layout = union_type.getLayout(ip);
37353 if (layout == .Extern and
37353 if (layout == .@"extern" and
3735437354 !try sema.validateExternType(field_ty, .union_field))
3735537355 {
3735637356 const msg = msg: {
......@@ -37367,7 +37367,7 @@ fn semaUnionFields(mod: *Module, arena: Allocator, union_type: InternPool.Loaded
3736737367 break :msg msg;
3736837368 };
3736937369 return sema.failWithOwnedErrorMsg(&block_scope, msg);
37370 } else if (layout == .Packed and !try sema.validatePackedType(field_ty)) {
37370 } else if (layout == .@"packed" and !try sema.validatePackedType(field_ty)) {
3737137371 const msg = msg: {
3737237372 const ty_src = mod.fieldSrcLoc(union_type.decl, .{
3737337373 .index = field_i,
......@@ -38286,9 +38286,9 @@ fn structFieldAlignment(
3828638286 return explicit_alignment;
3828738287 const mod = sema.mod;
3828838288 switch (layout) {
38289 .Packed => return .none,
38290 .Auto => if (mod.getTarget().ofmt != .c) return sema.typeAbiAlignment(field_ty),
38291 .Extern => {},
38289 .@"packed" => return .none,
38290 .auto => if (mod.getTarget().ofmt != .c) return sema.typeAbiAlignment(field_ty),
38291 .@"extern" => {},
3829238292 }
3829338293 // extern
3829438294 const ty_abi_align = try sema.typeAbiAlignment(field_ty);
src/Value.zig+18-18
......@@ -676,8 +676,8 @@ pub fn writeToMemory(val: Value, ty: Type, mod: *Module, buffer: []u8) error{
676676 .Struct => {
677677 const struct_type = mod.typeToStruct(ty) orelse return error.IllDefinedMemoryLayout;
678678 switch (struct_type.layout) {
679 .Auto => return error.IllDefinedMemoryLayout,
680 .Extern => for (0..struct_type.field_types.len) |i| {
679 .auto => return error.IllDefinedMemoryLayout,
680 .@"extern" => for (0..struct_type.field_types.len) |i| {
681681 const off: usize = @intCast(ty.structFieldOffset(i, mod));
682682 const field_val = switch (val.ip_index) {
683683 .none => switch (val.tag()) {
......@@ -701,7 +701,7 @@ pub fn writeToMemory(val: Value, ty: Type, mod: *Module, buffer: []u8) error{
701701 const field_ty = Type.fromInterned(struct_type.field_types.get(ip)[i]);
702702 try writeToMemory(field_val, field_ty, mod, buffer[off..]);
703703 },
704 .Packed => {
704 .@"packed" => {
705705 const byte_count = (@as(usize, @intCast(ty.bitSize(mod))) + 7) / 8;
706706 return writeToPackedMemory(val, ty, mod, buffer[0..byte_count], 0);
707707 },
......@@ -724,8 +724,8 @@ pub fn writeToMemory(val: Value, ty: Type, mod: *Module, buffer: []u8) error{
724724 bigint.writeTwosComplement(buffer[0..byte_count], endian);
725725 },
726726 .Union => switch (ty.containerLayout(mod)) {
727 .Auto => return error.IllDefinedMemoryLayout, // Sema is supposed to have emitted a compile error already
728 .Extern => {
727 .auto => return error.IllDefinedMemoryLayout, // Sema is supposed to have emitted a compile error already
728 .@"extern" => {
729729 if (val.unionTag(mod)) |union_tag| {
730730 const union_obj = mod.typeToUnion(ty).?;
731731 const field_index = mod.unionTagFieldIndex(union_obj, union_tag).?;
......@@ -739,7 +739,7 @@ pub fn writeToMemory(val: Value, ty: Type, mod: *Module, buffer: []u8) error{
739739 return writeToMemory(val.unionValue(mod), backing_ty, mod, buffer[0..byte_count]);
740740 }
741741 },
742 .Packed => {
742 .@"packed" => {
743743 const backing_ty = try ty.unionBackingType(mod);
744744 const byte_count: usize = @intCast(backing_ty.abiSize(mod));
745745 return writeToPackedMemory(val, ty, mod, buffer[0..byte_count], 0);
......@@ -841,7 +841,7 @@ pub fn writeToPackedMemory(
841841 const struct_type = ip.loadStructType(ty.toIntern());
842842 // Sema is supposed to have emitted a compile error already in the case of Auto,
843843 // and Extern is handled in non-packed writeToMemory.
844 assert(struct_type.layout == .Packed);
844 assert(struct_type.layout == .@"packed");
845845 var bits: u16 = 0;
846846 for (0..struct_type.field_types.len) |i| {
847847 const field_val = switch (val.ip_index) {
......@@ -866,8 +866,8 @@ pub fn writeToPackedMemory(
866866 .Union => {
867867 const union_obj = mod.typeToUnion(ty).?;
868868 switch (union_obj.getLayout(ip)) {
869 .Auto, .Extern => unreachable, // Handled in non-packed writeToMemory
870 .Packed => {
869 .auto, .@"extern" => unreachable, // Handled in non-packed writeToMemory
870 .@"packed" => {
871871 if (val.unionTag(mod)) |union_tag| {
872872 const field_index = mod.unionTagFieldIndex(union_obj, union_tag).?;
873873 const field_type = Type.fromInterned(union_obj.field_types.get(ip)[field_index]);
......@@ -991,8 +991,8 @@ pub fn readFromMemory(
991991 .Struct => {
992992 const struct_type = mod.typeToStruct(ty).?;
993993 switch (struct_type.layout) {
994 .Auto => unreachable, // Sema is supposed to have emitted a compile error already
995 .Extern => {
994 .auto => unreachable, // Sema is supposed to have emitted a compile error already
995 .@"extern" => {
996996 const field_types = struct_type.field_types;
997997 const field_vals = try arena.alloc(InternPool.Index, field_types.len);
998998 for (field_vals, 0..) |*field_val, i| {
......@@ -1006,7 +1006,7 @@ pub fn readFromMemory(
10061006 .storage = .{ .elems = field_vals },
10071007 } })));
10081008 },
1009 .Packed => {
1009 .@"packed" => {
10101010 const byte_count = (@as(usize, @intCast(ty.bitSize(mod))) + 7) / 8;
10111011 return readFromPackedMemory(ty, mod, buffer[0..byte_count], 0, arena);
10121012 },
......@@ -1025,8 +1025,8 @@ pub fn readFromMemory(
10251025 } })));
10261026 },
10271027 .Union => switch (ty.containerLayout(mod)) {
1028 .Auto => return error.IllDefinedMemoryLayout,
1029 .Extern => {
1028 .auto => return error.IllDefinedMemoryLayout,
1029 .@"extern" => {
10301030 const union_size = ty.abiSize(mod);
10311031 const array_ty = try mod.arrayType(.{ .len = union_size, .child = .u8_type });
10321032 const val = try (try readFromMemory(array_ty, mod, buffer, arena)).intern(array_ty, mod);
......@@ -1036,7 +1036,7 @@ pub fn readFromMemory(
10361036 .val = val,
10371037 } })));
10381038 },
1039 .Packed => {
1039 .@"packed" => {
10401040 const byte_count = (@as(usize, @intCast(ty.bitSize(mod))) + 7) / 8;
10411041 return readFromPackedMemory(ty, mod, buffer[0..byte_count], 0, arena);
10421042 },
......@@ -1177,8 +1177,8 @@ pub fn readFromPackedMemory(
11771177 } })));
11781178 },
11791179 .Union => switch (ty.containerLayout(mod)) {
1180 .Auto, .Extern => unreachable, // Handled by non-packed readFromMemory
1181 .Packed => {
1180 .auto, .@"extern" => unreachable, // Handled by non-packed readFromMemory
1181 .@"packed" => {
11821182 const backing_ty = try ty.unionBackingType(mod);
11831183 const val = (try readFromPackedMemory(backing_ty, mod, buffer, bit_offset, arena)).toIntern();
11841184 return Value.fromInterned((try mod.intern(.{ .un = .{
......@@ -4064,7 +4064,7 @@ fn dbHelper(self: *Value, tag_to_payload_map: *map: {
40644064 .alignment = 0,
40654065 };
40664066 break :map @Type(.{ .Struct = .{
4067 .layout = .Extern,
4067 .layout = .@"extern",
40684068 .fields = &fields,
40694069 .decls = &.{},
40704070 .is_tuple = false,
src/arch/aarch64/CodeGen.zig+4-4
......@@ -815,10 +815,10 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
815815 .call_never_tail => try self.airCall(inst, .never_tail),
816816 .call_never_inline => try self.airCall(inst, .never_inline),
817817
818 .atomic_store_unordered => try self.airAtomicStore(inst, .Unordered),
819 .atomic_store_monotonic => try self.airAtomicStore(inst, .Monotonic),
820 .atomic_store_release => try self.airAtomicStore(inst, .Release),
821 .atomic_store_seq_cst => try self.airAtomicStore(inst, .SeqCst),
818 .atomic_store_unordered => try self.airAtomicStore(inst, .unordered),
819 .atomic_store_monotonic => try self.airAtomicStore(inst, .monotonic),
820 .atomic_store_release => try self.airAtomicStore(inst, .release),
821 .atomic_store_seq_cst => try self.airAtomicStore(inst, .seq_cst),
822822
823823 .struct_field_ptr_index_0 => try self.airStructFieldPtrIndex(inst, 0),
824824 .struct_field_ptr_index_1 => try self.airStructFieldPtrIndex(inst, 1),
src/arch/aarch64/abi.zig+2-2
......@@ -21,7 +21,7 @@ pub fn classifyType(ty: Type, mod: *Module) Class {
2121 var maybe_float_bits: ?u16 = null;
2222 switch (ty.zigTypeTag(mod)) {
2323 .Struct => {
24 if (ty.containerLayout(mod) == .Packed) return .byval;
24 if (ty.containerLayout(mod) == .@"packed") return .byval;
2525 const float_count = countFloats(ty, mod, &maybe_float_bits);
2626 if (float_count <= sret_float_count) return .{ .float_array = float_count };
2727
......@@ -31,7 +31,7 @@ pub fn classifyType(ty: Type, mod: *Module) Class {
3131 return .integer;
3232 },
3333 .Union => {
34 if (ty.containerLayout(mod) == .Packed) return .byval;
34 if (ty.containerLayout(mod) == .@"packed") return .byval;
3535 const float_count = countFloats(ty, mod, &maybe_float_bits);
3636 if (float_count <= sret_float_count) return .{ .float_array = float_count };
3737
src/arch/arm/CodeGen.zig+4-4
......@@ -801,10 +801,10 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
801801 .call_never_tail => try self.airCall(inst, .never_tail),
802802 .call_never_inline => try self.airCall(inst, .never_inline),
803803
804 .atomic_store_unordered => try self.airAtomicStore(inst, .Unordered),
805 .atomic_store_monotonic => try self.airAtomicStore(inst, .Monotonic),
806 .atomic_store_release => try self.airAtomicStore(inst, .Release),
807 .atomic_store_seq_cst => try self.airAtomicStore(inst, .SeqCst),
804 .atomic_store_unordered => try self.airAtomicStore(inst, .unordered),
805 .atomic_store_monotonic => try self.airAtomicStore(inst, .monotonic),
806 .atomic_store_release => try self.airAtomicStore(inst, .release),
807 .atomic_store_seq_cst => try self.airAtomicStore(inst, .seq_cst),
808808
809809 .struct_field_ptr_index_0 => try self.airStructFieldPtrIndex(inst, 0),
810810 .struct_field_ptr_index_1 => try self.airStructFieldPtrIndex(inst, 1),
src/arch/arm/abi.zig+2-2
......@@ -33,7 +33,7 @@ pub fn classifyType(ty: Type, mod: *Module, ctx: Context) Class {
3333 switch (ty.zigTypeTag(mod)) {
3434 .Struct => {
3535 const bit_size = ty.bitSize(mod);
36 if (ty.containerLayout(mod) == .Packed) {
36 if (ty.containerLayout(mod) == .@"packed") {
3737 if (bit_size > 64) return .memory;
3838 return .byval;
3939 }
......@@ -56,7 +56,7 @@ pub fn classifyType(ty: Type, mod: *Module, ctx: Context) Class {
5656 .Union => {
5757 const bit_size = ty.bitSize(mod);
5858 const union_obj = mod.typeToUnion(ty).?;
59 if (union_obj.getLayout(ip) == .Packed) {
59 if (union_obj.getLayout(ip) == .@"packed") {
6060 if (bit_size > 64) return .memory;
6161 return .byval;
6262 }
src/arch/riscv64/CodeGen.zig+4-4
......@@ -634,10 +634,10 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
634634 .call_never_tail => try self.airCall(inst, .never_tail),
635635 .call_never_inline => try self.airCall(inst, .never_inline),
636636
637 .atomic_store_unordered => try self.airAtomicStore(inst, .Unordered),
638 .atomic_store_monotonic => try self.airAtomicStore(inst, .Monotonic),
639 .atomic_store_release => try self.airAtomicStore(inst, .Release),
640 .atomic_store_seq_cst => try self.airAtomicStore(inst, .SeqCst),
637 .atomic_store_unordered => try self.airAtomicStore(inst, .unordered),
638 .atomic_store_monotonic => try self.airAtomicStore(inst, .monotonic),
639 .atomic_store_release => try self.airAtomicStore(inst, .release),
640 .atomic_store_seq_cst => try self.airAtomicStore(inst, .seq_cst),
641641
642642 .struct_field_ptr_index_0 => try self.airStructFieldPtrIndex(inst, 0),
643643 .struct_field_ptr_index_1 => try self.airStructFieldPtrIndex(inst, 1),
src/arch/riscv64/abi.zig+2-2
......@@ -15,7 +15,7 @@ pub fn classifyType(ty: Type, mod: *Module) Class {
1515 switch (ty.zigTypeTag(mod)) {
1616 .Struct => {
1717 const bit_size = ty.bitSize(mod);
18 if (ty.containerLayout(mod) == .Packed) {
18 if (ty.containerLayout(mod) == .@"packed") {
1919 if (bit_size > max_byval_size) return .memory;
2020 return .byval;
2121 }
......@@ -44,7 +44,7 @@ pub fn classifyType(ty: Type, mod: *Module) Class {
4444 },
4545 .Union => {
4646 const bit_size = ty.bitSize(mod);
47 if (ty.containerLayout(mod) == .Packed) {
47 if (ty.containerLayout(mod) == .@"packed") {
4848 if (bit_size > max_byval_size) return .memory;
4949 return .byval;
5050 }
src/arch/wasm/CodeGen.zig+7-7
......@@ -1018,7 +1018,7 @@ fn typeToValtype(ty: Type, mod: *Module) wasm.Valtype {
10181018 .unrolled => wasm.Valtype.i32,
10191019 },
10201020 .Union => switch (ty.containerLayout(mod)) {
1021 .Packed => {
1021 .@"packed" => {
10221022 const int_ty = mod.intType(.unsigned, @as(u16, @intCast(ty.bitSize(mod)))) catch @panic("out of memory");
10231023 return typeToValtype(int_ty, mod);
10241024 },
......@@ -1737,7 +1737,7 @@ fn isByRef(ty: Type, mod: *Module) bool {
17371737 => return ty.hasRuntimeBitsIgnoreComptime(mod),
17381738 .Union => {
17391739 if (mod.typeToUnion(ty)) |union_obj| {
1740 if (union_obj.getLayout(ip) == .Packed) {
1740 if (union_obj.getLayout(ip) == .@"packed") {
17411741 return ty.abiSize(mod) > 8;
17421742 }
17431743 }
......@@ -3097,7 +3097,7 @@ fn lowerParentPtr(func: *CodeGen, ptr_val: Value, offset: u32) InnerError!WValue
30973097 break :blk parent_ty.structFieldOffset(field_index, mod);
30983098 },
30993099 .Union => switch (parent_ty.containerLayout(mod)) {
3100 .Packed => 0,
3100 .@"packed" => 0,
31013101 else => blk: {
31023102 const layout: Module.UnionLayout = parent_ty.unionGetLayout(mod);
31033103 if (layout.payload_size == 0) break :blk 0;
......@@ -3358,7 +3358,7 @@ fn lowerConstant(func: *CodeGen, val: Value, ty: Type) InnerError!WValue {
33583358 const struct_type = ip.loadStructType(ty.toIntern());
33593359 // non-packed structs are not handled in this function because they
33603360 // are by-ref types.
3361 assert(struct_type.layout == .Packed);
3361 assert(struct_type.layout == .@"packed");
33623362 var buf: [8]u8 = .{0} ** 8; // zero the buffer so we do not read 0xaa as integer
33633363 val.writeToPackedMemory(ty, mod, &buf, 0) catch unreachable;
33643364 const backing_int_ty = Type.fromInterned(struct_type.backingIntType(ip).*);
......@@ -3890,7 +3890,7 @@ fn structFieldPtr(
38903890 const struct_ptr_ty_info = struct_ptr_ty.ptrInfo(mod);
38913891
38923892 const offset = switch (struct_ty.containerLayout(mod)) {
3893 .Packed => switch (struct_ty.zigTypeTag(mod)) {
3893 .@"packed" => switch (struct_ty.zigTypeTag(mod)) {
38943894 .Struct => offset: {
38953895 if (result_ty.ptrInfo(mod).packed_offset.host_size != 0) {
38963896 break :offset @as(u32, 0);
......@@ -3928,7 +3928,7 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
39283928 if (!field_ty.hasRuntimeBitsIgnoreComptime(mod)) return func.finishAir(inst, .none, &.{struct_field.struct_operand});
39293929
39303930 const result = switch (struct_ty.containerLayout(mod)) {
3931 .Packed => switch (struct_ty.zigTypeTag(mod)) {
3931 .@"packed" => switch (struct_ty.zigTypeTag(mod)) {
39323932 .Struct => result: {
39333933 const packed_struct = mod.typeToPackedStruct(struct_ty).?;
39343934 const offset = mod.structPackedFieldBitOffset(packed_struct, field_index);
......@@ -5321,7 +5321,7 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
53215321 break :result_value result;
53225322 },
53235323 .Struct => switch (result_ty.containerLayout(mod)) {
5324 .Packed => {
5324 .@"packed" => {
53255325 if (isByRef(result_ty, mod)) {
53265326 return func.fail("TODO: airAggregateInit for packed structs larger than 64 bits", .{});
53275327 }
src/arch/wasm/abi.zig+3-3
......@@ -29,7 +29,7 @@ pub fn classifyType(ty: Type, mod: *Module) [2]Class {
2929 switch (ty.zigTypeTag(mod)) {
3030 .Struct => {
3131 const struct_type = mod.typeToStruct(ty).?;
32 if (struct_type.layout == .Packed) {
32 if (struct_type.layout == .@"packed") {
3333 if (ty.bitSize(mod) <= 64) return direct;
3434 return .{ .direct, .direct };
3535 }
......@@ -70,7 +70,7 @@ pub fn classifyType(ty: Type, mod: *Module) [2]Class {
7070 },
7171 .Union => {
7272 const union_obj = mod.typeToUnion(ty).?;
73 if (union_obj.getLayout(ip) == .Packed) {
73 if (union_obj.getLayout(ip) == .@"packed") {
7474 if (ty.bitSize(mod) <= 64) return direct;
7575 return .{ .direct, .direct };
7676 }
......@@ -113,7 +113,7 @@ pub fn scalarType(ty: Type, mod: *Module) Type {
113113 },
114114 .Union => {
115115 const union_obj = mod.typeToUnion(ty).?;
116 if (union_obj.getLayout(ip) != .Packed) {
116 if (union_obj.getLayout(ip) != .@"packed") {
117117 const layout = mod.getUnionLayout(union_obj);
118118 if (layout.payload_size == 0 and layout.tag_size != 0) {
119119 return scalarType(ty.unionTagTypeSafety(mod).?, mod);
src/arch/x86_64/CodeGen.zig+13-13
......@@ -2111,10 +2111,10 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
21112111 .call_never_tail => try self.airCall(inst, .never_tail),
21122112 .call_never_inline => try self.airCall(inst, .never_inline),
21132113
2114 .atomic_store_unordered => try self.airAtomicStore(inst, .Unordered),
2115 .atomic_store_monotonic => try self.airAtomicStore(inst, .Monotonic),
2116 .atomic_store_release => try self.airAtomicStore(inst, .Release),
2117 .atomic_store_seq_cst => try self.airAtomicStore(inst, .SeqCst),
2114 .atomic_store_unordered => try self.airAtomicStore(inst, .unordered),
2115 .atomic_store_monotonic => try self.airAtomicStore(inst, .monotonic),
2116 .atomic_store_release => try self.airAtomicStore(inst, .release),
2117 .atomic_store_seq_cst => try self.airAtomicStore(inst, .seq_cst),
21182118
21192119 .struct_field_ptr_index_0 => try self.airStructFieldPtrIndex(inst, 0),
21202120 .struct_field_ptr_index_1 => try self.airStructFieldPtrIndex(inst, 1),
......@@ -7962,8 +7962,8 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
79627962
79637963 const src_mcv = try self.resolveInst(operand);
79647964 const field_off: u32 = switch (container_ty.containerLayout(mod)) {
7965 .Auto, .Extern => @intCast(container_ty.structFieldOffset(index, mod) * 8),
7966 .Packed => if (mod.typeToStruct(container_ty)) |struct_type|
7965 .auto, .@"extern" => @intCast(container_ty.structFieldOffset(index, mod) * 8),
7966 .@"packed" => if (mod.typeToStruct(container_ty)) |struct_type|
79677967 mod.structPackedFieldBitOffset(struct_type, index)
79687968 else
79697969 0,
......@@ -11977,9 +11977,9 @@ fn airFrameAddress(self: *Self, inst: Air.Inst.Index) !void {
1197711977fn airFence(self: *Self, inst: Air.Inst.Index) !void {
1197811978 const order = self.air.instructions.items(.data)[@intFromEnum(inst)].fence;
1197911979 switch (order) {
11980 .Unordered, .Monotonic => unreachable,
11981 .Acquire, .Release, .AcqRel => {},
11982 .SeqCst => try self.asmOpOnly(.{ ._, .mfence }),
11980 .unordered, .monotonic => unreachable,
11981 .acquire, .release, .acq_rel => {},
11982 .seq_cst => try self.asmOpOnly(.{ ._, .mfence }),
1198311983 }
1198411984 self.finishAirBookkeeping();
1198511985}
......@@ -15747,9 +15747,9 @@ fn atomicOp(
1574715747 .Xor => .xor,
1574815748 else => unreachable,
1574915749 } else switch (order) {
15750 .Unordered, .Monotonic, .Release, .AcqRel => .mov,
15751 .Acquire => unreachable,
15752 .SeqCst => .xchg,
15750 .unordered, .monotonic, .release, .acq_rel => .mov,
15751 .acquire => unreachable,
15752 .seq_cst => .xchg,
1575315753 };
1575415754
1575515755 const dst_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp);
......@@ -17979,7 +17979,7 @@ fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
1797917979 switch (result_ty.zigTypeTag(mod)) {
1798017980 .Struct => {
1798117981 const frame_index = try self.allocFrameIndex(FrameAlloc.initSpill(result_ty, mod));
17982 if (result_ty.containerLayout(mod) == .Packed) {
17982 if (result_ty.containerLayout(mod) == .@"packed") {
1798317983 const struct_type = mod.typeToStruct(result_ty).?;
1798417984 try self.genInlineMemset(
1798517985 .{ .lea_frame = .{ .index = frame_index } },
src/arch/x86_64/Emit.zig+2-2
......@@ -110,7 +110,7 @@ pub fn emitMir(emit: *Emit) Error!void {
110110 const is_obj_or_static_lib = switch (emit.lower.output_mode) {
111111 .Exe => false,
112112 .Obj => true,
113 .Lib => emit.lower.link_mode == .Static,
113 .Lib => emit.lower.link_mode == .static,
114114 };
115115 const atom = elf_file.symbol(data.atom_index).atom(elf_file).?;
116116 const sym_index = elf_file.zigObjectPtr().?.symbol(data.sym_index);
......@@ -158,7 +158,7 @@ pub fn emitMir(emit: *Emit) Error!void {
158158 const is_obj_or_static_lib = switch (emit.lower.output_mode) {
159159 .Exe => false,
160160 .Obj => true,
161 .Lib => emit.lower.link_mode == .Static,
161 .Lib => emit.lower.link_mode == .static,
162162 };
163163 const atom = macho_file.getSymbol(data.atom_index).getAtom(macho_file).?;
164164 const sym_index = macho_file.getZigObject().?.symbols.items[data.sym_index];
src/arch/x86_64/Lower.zig+1-1
......@@ -329,7 +329,7 @@ fn emit(lower: *Lower, prefix: Prefix, mnemonic: Mnemonic, ops: []const Operand)
329329 const is_obj_or_static_lib = switch (lower.output_mode) {
330330 .Exe => false,
331331 .Obj => true,
332 .Lib => lower.link_mode == .Static,
332 .Lib => lower.link_mode == .static,
333333 };
334334
335335 const emit_prefix = prefix;
src/arch/x86_64/abi.zig+3-3
......@@ -42,7 +42,7 @@ pub fn classifyWindows(ty: Type, mod: *Module) Class {
4242 1, 2, 4, 8 => return .integer,
4343 else => switch (ty.zigTypeTag(mod)) {
4444 .Int => return .win_i128,
45 .Struct, .Union => if (ty.containerLayout(mod) == .Packed) {
45 .Struct, .Union => if (ty.containerLayout(mod) == .@"packed") {
4646 return .win_i128;
4747 } else {
4848 return .memory;
......@@ -238,7 +238,7 @@ pub fn classifySystemV(ty: Type, mod: *Module, ctx: Context) [8]Class {
238238 // separately.".
239239 const struct_type = mod.typeToStruct(ty).?;
240240 const ty_size = ty.abiSize(mod);
241 if (struct_type.layout == .Packed) {
241 if (struct_type.layout == .@"packed") {
242242 assert(ty_size <= 16);
243243 result[0] = .integer;
244244 if (ty_size > 8) result[1] = .integer;
......@@ -356,7 +356,7 @@ pub fn classifySystemV(ty: Type, mod: *Module, ctx: Context) [8]Class {
356356 // separately.".
357357 const union_obj = mod.typeToUnion(ty).?;
358358 const ty_size = mod.unionAbiSize(union_obj);
359 if (union_obj.getLayout(ip) == .Packed) {
359 if (union_obj.getLayout(ip) == .@"packed") {
360360 assert(ty_size <= 16);
361361 result[0] = .integer;
362362 if (ty_size > 8) result[1] = .integer;
src/codegen.zig+4-4
......@@ -513,7 +513,7 @@ pub fn generateSymbol(
513513 .struct_type => {
514514 const struct_type = ip.loadStructType(typed_value.ty.toIntern());
515515 switch (struct_type.layout) {
516 .Packed => {
516 .@"packed" => {
517517 const abi_size = math.cast(usize, typed_value.ty.abiSize(mod)) orelse
518518 return error.Overflow;
519519 const current_pos = code.items.len;
......@@ -550,7 +550,7 @@ pub fn generateSymbol(
550550 bits += @as(u16, @intCast(Type.fromInterned(field_ty).bitSize(mod)));
551551 }
552552 },
553 .Auto, .Extern => {
553 .auto, .@"extern" => {
554554 const struct_begin = code.items.len;
555555 const field_types = struct_type.field_types.get(ip);
556556 const offsets = struct_type.offsets.get(ip);
......@@ -736,11 +736,11 @@ fn lowerParentPtr(
736736 .anon_struct_type,
737737 .union_type,
738738 => switch (Type.fromInterned(base_ty).containerLayout(mod)) {
739 .Auto, .Extern => @intCast(Type.fromInterned(base_ty).structFieldOffset(
739 .auto, .@"extern" => @intCast(Type.fromInterned(base_ty).structFieldOffset(
740740 @intCast(field.index),
741741 mod,
742742 )),
743 .Packed => if (mod.typeToStruct(Type.fromInterned(base_ty))) |struct_obj|
743 .@"packed" => if (mod.typeToStruct(Type.fromInterned(base_ty))) |struct_obj|
744744 if (Type.fromInterned(ptr.ty).ptrInfo(mod).packed_offset.host_size == 0)
745745 @divExact(Type.fromInterned(base_ptr_ty).ptrInfo(mod)
746746 .packed_offset.bit_offset + mod.structPackedFieldBitOffset(
src/codegen/c.zig+28-28
......@@ -890,7 +890,7 @@ pub const DeclGen = struct {
890890 return writer.writeAll(" }");
891891 },
892892 .Struct => switch (ty.containerLayout(mod)) {
893 .Auto, .Extern => {
893 .auto, .@"extern" => {
894894 if (!location.isInitializer()) {
895895 try writer.writeByte('(');
896896 try dg.renderType(writer, ty);
......@@ -912,7 +912,7 @@ pub const DeclGen = struct {
912912
913913 return writer.writeByte('}');
914914 },
915 .Packed => return writer.print("{x}", .{try dg.fmtIntLiteral(ty, Value.undef, .Other)}),
915 .@"packed" => return writer.print("{x}", .{try dg.fmtIntLiteral(ty, Value.undef, .Other)}),
916916 },
917917 .Union => {
918918 if (!location.isInitializer()) {
......@@ -1379,7 +1379,7 @@ pub const DeclGen = struct {
13791379 .struct_type => {
13801380 const struct_type = ip.loadStructType(ty.toIntern());
13811381 switch (struct_type.layout) {
1382 .Auto, .Extern => {
1382 .auto, .@"extern" => {
13831383 if (!location.isInitializer()) {
13841384 try writer.writeByte('(');
13851385 try dg.renderType(writer, ty);
......@@ -1408,7 +1408,7 @@ pub const DeclGen = struct {
14081408 }
14091409 try writer.writeByte('}');
14101410 },
1411 .Packed => {
1411 .@"packed" => {
14121412 const int_info = ty.intInfo(mod);
14131413
14141414 const bits = Type.smallestUnsignedBits(int_info.bits - 1);
......@@ -1517,7 +1517,7 @@ pub const DeclGen = struct {
15171517 if (un.tag == .none) {
15181518 const backing_ty = try ty.unionBackingType(mod);
15191519 switch (union_obj.getLayout(ip)) {
1520 .Packed => {
1520 .@"packed" => {
15211521 if (!location.isInitializer()) {
15221522 try writer.writeByte('(');
15231523 try dg.renderType(writer, backing_ty);
......@@ -1525,7 +1525,7 @@ pub const DeclGen = struct {
15251525 }
15261526 try dg.renderValue(writer, backing_ty, Value.fromInterned(un.val), initializer_type);
15271527 },
1528 .Extern => {
1528 .@"extern" => {
15291529 if (location == .StaticInitializer) {
15301530 return dg.fail("TODO: C backend: implement extern union backing type rendering in static initializers", .{});
15311531 }
......@@ -1551,7 +1551,7 @@ pub const DeclGen = struct {
15511551 const field_index = mod.unionTagFieldIndex(union_obj, Value.fromInterned(un.tag)).?;
15521552 const field_ty = Type.fromInterned(union_obj.field_types.get(ip)[field_index]);
15531553 const field_name = union_obj.loadTagType(ip).names.get(ip)[field_index];
1554 if (union_obj.getLayout(ip) == .Packed) {
1554 if (union_obj.getLayout(ip) == .@"packed") {
15551555 if (field_ty.hasRuntimeBits(mod)) {
15561556 if (field_ty.isPtrAtRuntime(mod)) {
15571557 try writer.writeByte('(');
......@@ -1999,7 +1999,7 @@ pub const DeclGen = struct {
19991999 try fwd.writeAll(if (is_global) "zig_extern " else "static ");
20002000 const maybe_exports = dg.module.decl_exports.get(decl_index);
20012001 const export_weak_linkage = if (maybe_exports) |exports|
2002 exports.items[0].opts.linkage == .Weak
2002 exports.items[0].opts.linkage == .weak
20032003 else
20042004 false;
20052005 if (variable.is_weak_linkage or export_weak_linkage) try fwd.writeAll("zig_weak_linkage ");
......@@ -2689,7 +2689,7 @@ fn genExports(o: *Object) !void {
26892689 const is_variable_const = switch (ip.indexToKey(tv.val.toIntern())) {
26902690 .func => return for (exports.items[1..], 1..) |@"export", i| {
26912691 try fwd.writeAll("zig_extern ");
2692 if (@"export".opts.linkage == .Weak) try fwd.writeAll("zig_weak_linkage_fn ");
2692 if (@"export".opts.linkage == .weak) try fwd.writeAll("zig_weak_linkage_fn ");
26932693 try o.dg.renderFunctionSignature(
26942694 fwd,
26952695 decl_index,
......@@ -2707,7 +2707,7 @@ fn genExports(o: *Object) !void {
27072707 };
27082708 for (exports.items[1..]) |@"export"| {
27092709 try fwd.writeAll("zig_extern ");
2710 if (@"export".opts.linkage == .Weak) try fwd.writeAll("zig_weak_linkage ");
2710 if (@"export".opts.linkage == .weak) try fwd.writeAll("zig_weak_linkage ");
27112711 const export_name = ip.stringToSlice(@"export".opts.name);
27122712 try o.dg.renderTypeAndName(
27132713 fwd,
......@@ -2842,7 +2842,7 @@ pub fn genFunc(f: *Function) !void {
28422842 try fwd_decl_writer.writeAll(if (is_global) "zig_extern " else "static ");
28432843
28442844 if (mod.decl_exports.get(decl_index)) |exports|
2845 if (exports.items[0].opts.linkage == .Weak) try fwd_decl_writer.writeAll("zig_weak_linkage_fn ");
2845 if (exports.items[0].opts.linkage == .weak) try fwd_decl_writer.writeAll("zig_weak_linkage_fn ");
28462846 try o.dg.renderFunctionSignature(fwd_decl_writer, decl_index, .forward, .{ .export_index = 0 });
28472847 try fwd_decl_writer.writeAll(";\n");
28482848 try genExports(o);
......@@ -3278,10 +3278,10 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail,
32783278
32793279 .int_from_ptr => try airIntFromPtr(f, inst),
32803280
3281 .atomic_store_unordered => try airAtomicStore(f, inst, toMemoryOrder(.Unordered)),
3282 .atomic_store_monotonic => try airAtomicStore(f, inst, toMemoryOrder(.Monotonic)),
3283 .atomic_store_release => try airAtomicStore(f, inst, toMemoryOrder(.Release)),
3284 .atomic_store_seq_cst => try airAtomicStore(f, inst, toMemoryOrder(.SeqCst)),
3281 .atomic_store_unordered => try airAtomicStore(f, inst, toMemoryOrder(.unordered)),
3282 .atomic_store_monotonic => try airAtomicStore(f, inst, toMemoryOrder(.monotonic)),
3283 .atomic_store_release => try airAtomicStore(f, inst, toMemoryOrder(.release)),
3284 .atomic_store_seq_cst => try airAtomicStore(f, inst, toMemoryOrder(.seq_cst)),
32853285
32863286 .struct_field_ptr_index_0 => try airStructFieldPtrIndex(f, inst, 0),
32873287 .struct_field_ptr_index_1 => try airStructFieldPtrIndex(f, inst, 1),
......@@ -5497,7 +5497,7 @@ fn fieldLocation(
54975497 .Union => {
54985498 const union_obj = mod.typeToUnion(container_ty).?;
54995499 return switch (union_obj.getLayout(ip)) {
5500 .Auto, .Extern => {
5500 .auto, .@"extern" => {
55015501 const field_ty = Type.fromInterned(union_obj.field_types.get(ip)[field_index]);
55025502 if (!field_ty.hasRuntimeBitsIgnoreComptime(mod))
55035503 return if (container_ty.unionTagTypeSafety(mod) != null and
......@@ -5511,7 +5511,7 @@ fn fieldLocation(
55115511 else
55125512 .{ .identifier = ip.stringToSlice(field_name) } };
55135513 },
5514 .Packed => .begin,
5514 .@"packed" => .begin,
55155515 };
55165516 },
55175517 .Pointer => switch (container_ty.ptrSize(mod)) {
......@@ -5671,11 +5671,11 @@ fn airStructFieldVal(f: *Function, inst: Air.Inst.Index) !CValue {
56715671
56725672 const field_name: CValue = switch (mod.intern_pool.indexToKey(struct_ty.ip_index)) {
56735673 .struct_type => switch (struct_ty.containerLayout(mod)) {
5674 .Auto, .Extern => if (struct_ty.isSimpleTuple(mod))
5674 .auto, .@"extern" => if (struct_ty.isSimpleTuple(mod))
56755675 .{ .field = extra.field_index }
56765676 else
56775677 .{ .identifier = ip.stringToSlice(struct_ty.legacyStructFieldName(extra.field_index, mod)) },
5678 .Packed => {
5678 .@"packed" => {
56795679 const struct_type = mod.typeToStruct(struct_ty).?;
56805680 const int_info = struct_ty.intInfo(mod);
56815681
......@@ -5740,7 +5740,7 @@ fn airStructFieldVal(f: *Function, inst: Air.Inst.Index) !CValue {
57405740
57415741 .union_type => field_name: {
57425742 const union_obj = ip.loadUnionType(struct_ty.toIntern());
5743 if (union_obj.flagsPtr(ip).layout == .Packed) {
5743 if (union_obj.flagsPtr(ip).layout == .@"packed") {
57445744 const operand_lval = if (struct_byval == .constant) blk: {
57455745 const operand_local = try f.allocLocal(inst, struct_ty);
57465746 try f.writeCValue(writer, operand_local, .Other);
......@@ -7081,7 +7081,7 @@ fn airAggregateInit(f: *Function, inst: Air.Inst.Index) !CValue {
70817081 }
70827082 },
70837083 .Struct => switch (inst_ty.containerLayout(mod)) {
7084 .Auto, .Extern => for (resolved_elements, 0..) |element, field_index| {
7084 .auto, .@"extern" => for (resolved_elements, 0..) |element, field_index| {
70857085 if (inst_ty.structFieldIsComptime(field_index, mod)) continue;
70867086 const field_ty = inst_ty.structFieldType(field_index, mod);
70877087 if (!field_ty.hasRuntimeBitsIgnoreComptime(mod)) continue;
......@@ -7095,7 +7095,7 @@ fn airAggregateInit(f: *Function, inst: Air.Inst.Index) !CValue {
70957095 try f.writeCValue(writer, element, .Other);
70967096 try a.end(f, writer);
70977097 },
7098 .Packed => {
7098 .@"packed" => {
70997099 try f.writeCValue(writer, local, .Other);
71007100 try writer.writeAll(" = ");
71017101 const int_info = inst_ty.intInfo(mod);
......@@ -7181,7 +7181,7 @@ fn airUnionInit(f: *Function, inst: Air.Inst.Index) !CValue {
71817181
71827182 const writer = f.object.writer();
71837183 const local = try f.allocLocal(inst, union_ty);
7184 if (union_obj.getLayout(ip) == .Packed) {
7184 if (union_obj.getLayout(ip) == .@"packed") {
71857185 try f.writeCValue(writer, local, .Other);
71867186 try writer.writeAll(" = ");
71877187 try f.writeCValue(writer, payload, .Initializer);
......@@ -7482,11 +7482,11 @@ fn airCVaCopy(f: *Function, inst: Air.Inst.Index) !CValue {
74827482fn toMemoryOrder(order: std.builtin.AtomicOrder) [:0]const u8 {
74837483 return switch (order) {
74847484 // Note: unordered is actually even less atomic than relaxed
7485 .Unordered, .Monotonic => "zig_memory_order_relaxed",
7486 .Acquire => "zig_memory_order_acquire",
7487 .Release => "zig_memory_order_release",
7488 .AcqRel => "zig_memory_order_acq_rel",
7489 .SeqCst => "zig_memory_order_seq_cst",
7485 .unordered, .monotonic => "zig_memory_order_relaxed",
7486 .acquire => "zig_memory_order_acquire",
7487 .release => "zig_memory_order_release",
7488 .acq_rel => "zig_memory_order_acq_rel",
7489 .seq_cst => "zig_memory_order_seq_cst",
74907490 };
74917491}
74927492
src/codegen/c/type.zig+1-1
......@@ -1495,7 +1495,7 @@ pub const CType = extern union {
14951495 }
14961496 },
14971497
1498 .Struct, .Union => |zig_ty_tag| if (ty.containerLayout(mod) == .Packed) {
1498 .Struct, .Union => |zig_ty_tag| if (ty.containerLayout(mod) == .@"packed") {
14991499 if (mod.typeToPackedStruct(ty)) |packed_struct| {
15001500 try self.initType(Type.fromInterned(packed_struct.backingIntType(ip).*), kind, lookup);
15011501 } else {
src/codegen/llvm.zig+28-28
......@@ -1278,7 +1278,7 @@ pub const Object = struct {
12781278
12791279 const reloc_mode: llvm.RelocMode = if (pic)
12801280 .PIC
1281 else if (self.module.comp.config.link_mode == .Dynamic)
1281 else if (self.module.comp.config.link_mode == .dynamic)
12821282 llvm.RelocMode.DynamicNoPIC
12831283 else
12841284 .Static;
......@@ -1873,10 +1873,10 @@ pub const Object = struct {
18731873 if (comp.config.dll_export_fns)
18741874 global_index.setDllStorageClass(.dllexport, &o.builder);
18751875 global_index.setLinkage(switch (exports[0].opts.linkage) {
1876 .Internal => unreachable,
1877 .Strong => .external,
1878 .Weak => .weak_odr,
1879 .LinkOnce => .linkonce_odr,
1876 .internal => unreachable,
1877 .strong => .external,
1878 .weak => .weak_odr,
1879 .link_once => .linkonce_odr,
18801880 }, &o.builder);
18811881 global_index.setVisibility(switch (exports[0].opts.visibility) {
18821882 .default => .default,
......@@ -3327,7 +3327,7 @@ pub const Object = struct {
33273327
33283328 const struct_type = ip.loadStructType(t.toIntern());
33293329
3330 if (struct_type.layout == .Packed) {
3330 if (struct_type.layout == .@"packed") {
33313331 const int_ty = try o.lowerType(Type.fromInterned(struct_type.backingIntType(ip).*));
33323332 try o.type_map.put(o.gpa, t.toIntern(), int_ty);
33333333 return int_ty;
......@@ -3477,7 +3477,7 @@ pub const Object = struct {
34773477 const union_obj = ip.loadUnionType(t.toIntern());
34783478 const layout = mod.getUnionLayout(union_obj);
34793479
3480 if (union_obj.flagsPtr(ip).layout == .Packed) {
3480 if (union_obj.flagsPtr(ip).layout == .@"packed") {
34813481 const int_ty = try o.builder.intType(@intCast(t.bitSize(mod)));
34823482 try o.type_map.put(o.gpa, t.toIntern(), int_ty);
34833483 return int_ty;
......@@ -4038,7 +4038,7 @@ pub const Object = struct {
40384038 const struct_type = ip.loadStructType(ty.toIntern());
40394039 assert(struct_type.haveLayout(ip));
40404040 const struct_ty = try o.lowerType(ty);
4041 if (struct_type.layout == .Packed) {
4041 if (struct_type.layout == .@"packed") {
40424042 comptime assert(Type.packed_struct_layout_version == 2);
40434043 var running_int = try o.builder.intConst(struct_ty, 0);
40444044 var running_bits: u16 = 0;
......@@ -4154,7 +4154,7 @@ pub const Object = struct {
41544154 const payload = if (un.tag != .none) p: {
41554155 const field_index = mod.unionTagFieldIndex(union_obj, Value.fromInterned(un.tag)).?;
41564156 const field_ty = Type.fromInterned(union_obj.field_types.get(ip)[field_index]);
4157 if (container_layout == .Packed) {
4157 if (container_layout == .@"packed") {
41584158 if (!field_ty.hasRuntimeBits(mod)) return o.builder.intConst(union_ty, 0);
41594159 const small_int_val = try o.builder.castConst(
41604160 if (field_ty.isPtrAtRuntime(mod)) .ptrtoint else .bitcast,
......@@ -4190,7 +4190,7 @@ pub const Object = struct {
41904190 } else p: {
41914191 assert(layout.tag_size == 0);
41924192 const union_val = try o.lowerValue(un.val);
4193 if (container_layout == .Packed) {
4193 if (container_layout == .@"packed") {
41944194 const bitcast_val = try o.builder.castConst(
41954195 .bitcast,
41964196 union_val,
......@@ -4324,7 +4324,7 @@ pub const Object = struct {
43244324 const field_index: u32 = @intCast(field_ptr.index);
43254325 switch (parent_ty.zigTypeTag(mod)) {
43264326 .Union => {
4327 if (parent_ty.containerLayout(mod) == .Packed) {
4327 if (parent_ty.containerLayout(mod) == .@"packed") {
43284328 return parent_ptr;
43294329 }
43304330
......@@ -6531,7 +6531,7 @@ pub const FuncGen = struct {
65316531 assert(!isByRef(field_ty, mod));
65326532 switch (struct_ty.zigTypeTag(mod)) {
65336533 .Struct => switch (struct_ty.containerLayout(mod)) {
6534 .Packed => {
6534 .@"packed" => {
65356535 const struct_type = mod.typeToStruct(struct_ty).?;
65366536 const bit_offset = mod.structPackedFieldBitOffset(struct_type, field_index);
65376537 const containing_int = struct_llvm_val;
......@@ -6558,7 +6558,7 @@ pub const FuncGen = struct {
65586558 },
65596559 },
65606560 .Union => {
6561 assert(struct_ty.containerLayout(mod) == .Packed);
6561 assert(struct_ty.containerLayout(mod) == .@"packed");
65626562 const containing_int = struct_llvm_val;
65636563 const elem_llvm_ty = try o.lowerType(field_ty);
65646564 if (field_ty.zigTypeTag(mod) == .Float or field_ty.zigTypeTag(mod) == .Vector) {
......@@ -6581,7 +6581,7 @@ pub const FuncGen = struct {
65816581 switch (struct_ty.zigTypeTag(mod)) {
65826582 .Struct => {
65836583 const layout = struct_ty.containerLayout(mod);
6584 assert(layout != .Packed);
6584 assert(layout != .@"packed");
65856585 const struct_llvm_ty = try o.lowerType(struct_ty);
65866586 const llvm_field_index = o.llvmFieldIndex(struct_ty, field_index).?;
65876587 const field_ptr =
......@@ -9995,7 +9995,7 @@ pub const FuncGen = struct {
99959995 return running_int;
99969996 }
99979997
9998 assert(result_ty.containerLayout(mod) != .Packed);
9998 assert(result_ty.containerLayout(mod) != .@"packed");
99999999
1000010000 if (isByRef(result_ty, mod)) {
1000110001 // TODO in debug builds init to undef so that the padding will be 0xaa
......@@ -10080,7 +10080,7 @@ pub const FuncGen = struct {
1008010080 const layout = union_ty.unionGetLayout(mod);
1008110081 const union_obj = mod.typeToUnion(union_ty).?;
1008210082
10083 if (union_obj.getLayout(ip) == .Packed) {
10083 if (union_obj.getLayout(ip) == .@"packed") {
1008410084 const big_bits = union_ty.bitSize(mod);
1008510085 const int_llvm_ty = try o.builder.intType(@intCast(big_bits));
1008610086 const field_ty = Type.fromInterned(union_obj.field_types.get(ip)[extra.field_index]);
......@@ -10420,7 +10420,7 @@ pub const FuncGen = struct {
1042010420 const struct_ty = struct_ptr_ty.childType(mod);
1042110421 switch (struct_ty.zigTypeTag(mod)) {
1042210422 .Struct => switch (struct_ty.containerLayout(mod)) {
10423 .Packed => {
10423 .@"packed" => {
1042410424 const result_ty = self.typeOfIndex(inst);
1042510425 const result_ty_info = result_ty.ptrInfo(mod);
1042610426 const struct_ptr_ty_info = struct_ptr_ty.ptrInfo(mod);
......@@ -10462,7 +10462,7 @@ pub const FuncGen = struct {
1046210462 },
1046310463 .Union => {
1046410464 const layout = struct_ty.unionGetLayout(mod);
10465 if (layout.payload_size == 0 or struct_ty.containerLayout(mod) == .Packed) return struct_ptr;
10465 if (layout.payload_size == 0 or struct_ty.containerLayout(mod) == .@"packed") return struct_ptr;
1046610466 const payload_index = @intFromBool(layout.tag_align.compare(.gte, layout.payload_align));
1046710467 const union_llvm_ty = try o.lowerType(struct_ty);
1046810468 return self.wip.gepStruct(union_llvm_ty, struct_ptr, payload_index, "");
......@@ -10801,12 +10801,12 @@ pub const FuncGen = struct {
1080110801
1080210802fn toLlvmAtomicOrdering(atomic_order: std.builtin.AtomicOrder) Builder.AtomicOrdering {
1080310803 return switch (atomic_order) {
10804 .Unordered => .unordered,
10805 .Monotonic => .monotonic,
10806 .Acquire => .acquire,
10807 .Release => .release,
10808 .AcqRel => .acq_rel,
10809 .SeqCst => .seq_cst,
10804 .unordered => .unordered,
10805 .monotonic => .monotonic,
10806 .acquire => .acquire,
10807 .release => .release,
10808 .acq_rel => .acq_rel,
10809 .seq_cst => .seq_cst,
1081010810 };
1081110811}
1081210812
......@@ -11572,7 +11572,7 @@ fn isByRef(ty: Type, mod: *Module) bool {
1157211572 };
1157311573
1157411574 // Packed structs are represented to LLVM as integers.
11575 if (struct_type.layout == .Packed) return false;
11575 if (struct_type.layout == .@"packed") return false;
1157611576
1157711577 const field_types = struct_type.field_types.get(ip);
1157811578 var it = struct_type.iterateRuntimeOrder(ip);
......@@ -11586,7 +11586,7 @@ fn isByRef(ty: Type, mod: *Module) bool {
1158611586 return false;
1158711587 },
1158811588 .Union => switch (ty.containerLayout(mod)) {
11589 .Packed => return false,
11589 .@"packed" => return false,
1159011590 else => return ty.hasRuntimeBits(mod),
1159111591 },
1159211592 .ErrorUnion => {
......@@ -11624,8 +11624,8 @@ fn isScalar(mod: *Module, ty: Type) bool {
1162411624 .Vector,
1162511625 => true,
1162611626
11627 .Struct => ty.containerLayout(mod) == .Packed,
11628 .Union => ty.containerLayout(mod) == .Packed,
11627 .Struct => ty.containerLayout(mod) == .@"packed",
11628 .Union => ty.containerLayout(mod) == .@"packed",
1162911629 else => false,
1163011630 };
1163111631}
src/codegen/llvm/Builder.zig+1-1
......@@ -8398,7 +8398,7 @@ pub const Metadata = enum(u32) {
83988398 fmt_str = fmt_str ++ ")\n";
83998399
84008400 var fmt_args: @Type(.{ .Struct = .{
8401 .layout = .Auto,
8401 .layout = .auto,
84028402 .fields = &fields,
84038403 .decls = &.{},
84048404 .is_tuple = false,
src/codegen/llvm/bitcode_writer.zig+2-2
......@@ -415,8 +415,8 @@ fn BufType(comptime T: type, comptime min_len: usize) type {
415415 .Enum => |info| info.tag_type,
416416 .Bool => u1,
417417 .Struct => |info| switch (info.layout) {
418 .Auto, .Extern => @compileError("Unsupported type: " ++ @typeName(T)),
419 .Packed => std.meta.Int(.unsigned, @bitSizeOf(T)),
418 .auto, .@"extern" => @compileError("Unsupported type: " ++ @typeName(T)),
419 .@"packed" => std.meta.Int(.unsigned, @bitSizeOf(T)),
420420 },
421421 else => @compileError("Unsupported type: " ++ @typeName(T)),
422422 })));
src/codegen/spirv.zig+8-8
......@@ -979,7 +979,7 @@ const DeclGen = struct {
979979 },
980980 .struct_type => {
981981 const struct_type = mod.typeToStruct(ty).?;
982 if (struct_type.layout == .Packed) {
982 if (struct_type.layout == .@"packed") {
983983 return self.todo("packed struct constants", .{});
984984 }
985985
......@@ -1275,7 +1275,7 @@ const DeclGen = struct {
12751275 const ip = &mod.intern_pool;
12761276 const union_obj = mod.typeToUnion(ty).?;
12771277
1278 if (union_obj.getLayout(ip) == .Packed) {
1278 if (union_obj.getLayout(ip) == .@"packed") {
12791279 return self.todo("packed union types", .{});
12801280 }
12811281
......@@ -1532,7 +1532,7 @@ const DeclGen = struct {
15321532 else => unreachable,
15331533 };
15341534
1535 if (struct_type.layout == .Packed) {
1535 if (struct_type.layout == .@"packed") {
15361536 return try self.resolveType(Type.fromInterned(struct_type.backingIntType(ip).*), .direct);
15371537 }
15381538
......@@ -3904,7 +3904,7 @@ const DeclGen = struct {
39043904 const union_ty = mod.typeToUnion(ty).?;
39053905 const tag_ty = Type.fromInterned(union_ty.enum_tag_ty);
39063906
3907 if (union_ty.getLayout(ip) == .Packed) {
3907 if (union_ty.getLayout(ip) == .@"packed") {
39083908 unreachable; // TODO
39093909 }
39103910
......@@ -3984,11 +3984,11 @@ const DeclGen = struct {
39843984
39853985 switch (object_ty.zigTypeTag(mod)) {
39863986 .Struct => switch (object_ty.containerLayout(mod)) {
3987 .Packed => unreachable, // TODO
3987 .@"packed" => unreachable, // TODO
39883988 else => return try self.extractField(field_ty, object_id, field_index),
39893989 },
39903990 .Union => switch (object_ty.containerLayout(mod)) {
3991 .Packed => unreachable, // TODO
3991 .@"packed" => unreachable, // TODO
39923992 else => {
39933993 // Store, ptr-elem-ptr, pointer-cast, load
39943994 const layout = self.unionLayout(object_ty);
......@@ -4058,13 +4058,13 @@ const DeclGen = struct {
40584058 const object_ty = object_ptr_ty.childType(mod);
40594059 switch (object_ty.zigTypeTag(mod)) {
40604060 .Struct => switch (object_ty.containerLayout(mod)) {
4061 .Packed => unreachable, // TODO
4061 .@"packed" => unreachable, // TODO
40624062 else => {
40634063 return try self.accessChain(result_ty_ref, object_ptr, &.{field_index});
40644064 },
40654065 },
40664066 .Union => switch (object_ty.containerLayout(mod)) {
4067 .Packed => unreachable, // TODO
4067 .@"packed" => unreachable, // TODO
40684068 else => {
40694069 const layout = self.unionLayout(object_ty);
40704070 if (!layout.has_payload) {
src/codegen/spirv/Section.zig+2-2
......@@ -154,7 +154,7 @@ pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand)
154154 }
155155 },
156156 .Struct => |info| {
157 if (info.layout == .Packed) {
157 if (info.layout == .@"packed") {
158158 section.writeWord(@as(Word, @bitCast(operand)));
159159 } else {
160160 section.writeExtendedMask(Operand, operand);
......@@ -288,7 +288,7 @@ fn operandSize(comptime Operand: type, operand: Operand) usize {
288288 }
289289 break :blk total;
290290 },
291 .Struct => |info| if (info.layout == .Packed) 1 else extendedMaskSize(Operand, operand),
291 .Struct => |info| if (info.layout == .@"packed") 1 else extendedMaskSize(Operand, operand),
292292 .Union => extendedUnionSize(Operand, operand),
293293 else => unreachable,
294294 },
src/crash_report.zig+2-2
......@@ -376,7 +376,7 @@ const PanicSwitch = struct {
376376 };
377377 state.* = new_state;
378378
379 _ = panicking.fetchAdd(1, .SeqCst);
379 _ = panicking.fetchAdd(1, .seq_cst);
380380
381381 state.recover_stage = .release_ref_count;
382382
......@@ -458,7 +458,7 @@ const PanicSwitch = struct {
458458 noinline fn releaseRefCount(state: *volatile PanicState) noreturn {
459459 state.recover_stage = .abort;
460460
461 if (panicking.fetchSub(1, .SeqCst) != 1) {
461 if (panicking.fetchSub(1, .seq_cst) != 1) {
462462 // Another thread is panicking, wait for the last one to finish
463463 // and call abort()
464464
src/glibc.zig+1-1
......@@ -1084,7 +1084,7 @@ fn buildSharedLib(
10841084 const strip = comp.compilerRtStrip();
10851085 const config = try Compilation.Config.resolve(.{
10861086 .output_mode = .Lib,
1087 .link_mode = .Dynamic,
1087 .link_mode = .dynamic,
10881088 .resolved_target = comp.root_mod.resolved_target,
10891089 .is_test = false,
10901090 .have_zcu = false,
src/libcxx.zig+2-2
......@@ -115,7 +115,7 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void {
115115
116116 const root_name = "c++";
117117 const output_mode = .Lib;
118 const link_mode = .Static;
118 const link_mode = .static;
119119 const target = comp.root_mod.resolved_target.result;
120120 const basename = try std.zig.binNameAlloc(arena, .{
121121 .root_name = root_name,
......@@ -327,7 +327,7 @@ pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) !void {
327327
328328 const root_name = "c++abi";
329329 const output_mode = .Lib;
330 const link_mode = .Static;
330 const link_mode = .static;
331331 const target = comp.root_mod.resolved_target.result;
332332 const basename = try std.zig.binNameAlloc(arena, .{
333333 .root_name = root_name,
src/libtsan.zig+1-1
......@@ -27,7 +27,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) BuildError!v
2727
2828 const root_name = "tsan";
2929 const output_mode = .Lib;
30 const link_mode = .Static;
30 const link_mode = .static;
3131 const target = comp.getTarget();
3232 const basename = try std.zig.binNameAlloc(arena, .{
3333 .root_name = root_name,
src/libunwind.zig+1-1
......@@ -62,7 +62,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void {
6262 });
6363
6464 const root_name = "unwind";
65 const link_mode = .Static;
65 const link_mode = .static;
6666 const target = comp.root_mod.resolved_target.result;
6767 const basename = try std.zig.binNameAlloc(arena, .{
6868 .root_name = root_name,
src/link.zig+6-6
......@@ -287,8 +287,8 @@ pub const File = struct {
287287 switch (output_mode) {
288288 .Obj => return,
289289 .Lib => switch (link_mode) {
290 .Static => return,
291 .Dynamic => {},
290 .static => return,
291 .dynamic => {},
292292 },
293293 .Exe => {},
294294 }
......@@ -582,7 +582,7 @@ pub const File = struct {
582582 const use_lld = build_options.have_llvm and comp.config.use_lld;
583583 const output_mode = comp.config.output_mode;
584584 const link_mode = comp.config.link_mode;
585 if (use_lld and output_mode == .Lib and link_mode == .Static) {
585 if (use_lld and output_mode == .Lib and link_mode == .static) {
586586 return base.linkAsArchive(arena, prog_node);
587587 }
588588 switch (base.tag) {
......@@ -957,8 +957,8 @@ pub const File = struct {
957957 const executable_mode = if (builtin.target.os.tag == .windows) 0 else 0o777;
958958 switch (effectiveOutputMode(use_lld, output_mode)) {
959959 .Lib => return switch (link_mode) {
960 .Dynamic => executable_mode,
961 .Static => fs.File.default_mode,
960 .dynamic => executable_mode,
961 .static => fs.File.default_mode,
962962 },
963963 .Exe => return executable_mode,
964964 .Obj => return fs.File.default_mode,
......@@ -966,7 +966,7 @@ pub const File = struct {
966966 }
967967
968968 pub fn isStatic(self: File) bool {
969 return self.comp.config.link_mode == .Static;
969 return self.comp.config.link_mode == .static;
970970 }
971971
972972 pub fn isObject(self: File) bool {
src/link/Coff.zig+6-6
......@@ -1599,11 +1599,11 @@ pub fn updateExports(
15991599 }
16001600 }
16011601
1602 if (exp.opts.linkage == .LinkOnce) {
1602 if (exp.opts.linkage == .link_once) {
16031603 try mod.failed_exports.putNoClobber(gpa, exp, try Module.ErrorMsg.create(
16041604 gpa,
16051605 exp.getSrcLoc(mod),
1606 "Unimplemented: GlobalLinkage.LinkOnce",
1606 "Unimplemented: GlobalLinkage.link_once",
16071607 .{},
16081608 ));
16091609 continue;
......@@ -1633,11 +1633,11 @@ pub fn updateExports(
16331633 sym.type = atom.getSymbol(self).type;
16341634
16351635 switch (exp.opts.linkage) {
1636 .Strong => {
1636 .strong => {
16371637 sym.storage_class = .EXTERNAL;
16381638 },
1639 .Internal => @panic("TODO Internal"),
1640 .Weak => @panic("TODO WeakExternal"),
1639 .internal => @panic("TODO Internal"),
1640 .weak => @panic("TODO WeakExternal"),
16411641 else => unreachable,
16421642 }
16431643
......@@ -2275,7 +2275,7 @@ fn writeHeader(self: *Coff) !void {
22752275 .p32 => flags.@"32BIT_MACHINE" = 1,
22762276 .p64 => flags.LARGE_ADDRESS_AWARE = 1,
22772277 }
2278 if (self.base.comp.config.output_mode == .Lib and self.base.comp.config.link_mode == .Dynamic) {
2278 if (self.base.comp.config.output_mode == .Lib and self.base.comp.config.link_mode == .dynamic) {
22792279 flags.DLL = 1;
22802280 }
22812281
src/link/Coff/lld.zig+5-5
......@@ -45,7 +45,7 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node)
4545 defer sub_prog_node.end();
4646
4747 const is_lib = comp.config.output_mode == .Lib;
48 const is_dyn_lib = comp.config.link_mode == .Dynamic and is_lib;
48 const is_dyn_lib = comp.config.link_mode == .dynamic and is_lib;
4949 const is_exe_or_dyn_lib = is_dyn_lib or comp.config.output_mode == .Exe;
5050 const link_in_crt = comp.config.link_libc and is_exe_or_dyn_lib;
5151 const target = comp.root_mod.resolved_target.result;
......@@ -411,16 +411,16 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node)
411411 try argv.append(try comp.get_libc_crt_file(arena, "mingwex.lib"));
412412 } else {
413413 const lib_str = switch (comp.config.link_mode) {
414 .Dynamic => "",
415 .Static => "lib",
414 .dynamic => "",
415 .static => "lib",
416416 };
417417 const d_str = switch (optimize_mode) {
418418 .Debug => "d",
419419 else => "",
420420 };
421421 switch (comp.config.link_mode) {
422 .Static => try argv.append(try allocPrint(arena, "libcmt{s}.lib", .{d_str})),
423 .Dynamic => try argv.append(try allocPrint(arena, "msvcrt{s}.lib", .{d_str})),
422 .static => try argv.append(try allocPrint(arena, "libcmt{s}.lib", .{d_str})),
423 .dynamic => try argv.append(try allocPrint(arena, "msvcrt{s}.lib", .{d_str})),
424424 }
425425
426426 try argv.append(try allocPrint(arena, "{s}vcruntime{s}.lib", .{ lib_str, d_str }));
src/link/Dwarf.zig+1-1
......@@ -317,7 +317,7 @@ pub const DeclState = struct {
317317 try ty.print(dbg_info_buffer.writer(), mod);
318318 try dbg_info_buffer.append(0);
319319
320 if (struct_type.layout == .Packed) {
320 if (struct_type.layout == .@"packed") {
321321 log.debug("TODO implement .debug_info for packed structs", .{});
322322 break :blk;
323323 }
src/link/Elf.zig+26-26
......@@ -262,7 +262,7 @@ pub fn createEmpty(
262262 .sparc64 => 0x2000,
263263 else => 0x1000,
264264 };
265 const is_dyn_lib = output_mode == .Lib and link_mode == .Dynamic;
265 const is_dyn_lib = output_mode == .Lib and link_mode == .dynamic;
266266 const default_sym_version: elf.Elf64_Versym = if (is_dyn_lib or comp.config.rdynamic)
267267 elf.VER_NDX_GLOBAL
268268 else
......@@ -349,7 +349,7 @@ pub fn createEmpty(
349349 }
350350
351351 const is_obj = output_mode == .Obj;
352 const is_obj_or_ar = is_obj or (output_mode == .Lib and link_mode == .Static);
352 const is_obj_or_ar = is_obj or (output_mode == .Lib and link_mode == .static);
353353
354354 // What path should this ELF linker code output to?
355355 // If using LLD to link, this code should produce an object file so that it
......@@ -1180,10 +1180,10 @@ pub fn flushModule(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node)
11801180
11811181 success: {
11821182 if (!self.base.isStatic()) {
1183 if (try self.accessLibPath(arena, &test_path, &checked_paths, lc.crt_dir.?, lib_name, .Dynamic))
1183 if (try self.accessLibPath(arena, &test_path, &checked_paths, lc.crt_dir.?, lib_name, .dynamic))
11841184 break :success;
11851185 }
1186 if (try self.accessLibPath(arena, &test_path, &checked_paths, lc.crt_dir.?, lib_name, .Static))
1186 if (try self.accessLibPath(arena, &test_path, &checked_paths, lc.crt_dir.?, lib_name, .static))
11871187 break :success;
11881188
11891189 try self.reportMissingLibraryError(
......@@ -1211,8 +1211,8 @@ pub fn flushModule(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node)
12111211 });
12121212 } else if (target.isMusl()) {
12131213 const path = try comp.get_libc_crt_file(arena, switch (link_mode) {
1214 .Static => "libc.a",
1215 .Dynamic => "libc.so",
1214 .static => "libc.a",
1215 .dynamic => "libc.so",
12161216 });
12171217 try system_libs.append(.{ .path = path });
12181218 } else {
......@@ -1628,7 +1628,7 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {
16281628 // libc dep
16291629 if (comp.config.link_libc) {
16301630 if (self.base.comp.libc_installation != null) {
1631 const needs_grouping = link_mode == .Static;
1631 const needs_grouping = link_mode == .static;
16321632 if (needs_grouping) try argv.append("--start-group");
16331633 try argv.appendSlice(target_util.libcFullLinkFlags(target));
16341634 if (needs_grouping) try argv.append("--end-group");
......@@ -1642,8 +1642,8 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {
16421642 try argv.append(try comp.get_libc_crt_file(arena, "libc_nonshared.a"));
16431643 } else if (target.isMusl()) {
16441644 try argv.append(try comp.get_libc_crt_file(arena, switch (link_mode) {
1645 .Static => "libc.a",
1646 .Dynamic => "libc.so",
1645 .static => "libc.a",
1646 .dynamic => "libc.so",
16471647 }));
16481648 }
16491649 }
......@@ -1797,10 +1797,10 @@ fn parseLdScript(self: *Elf, lib: SystemLib) ParseError!void {
17971797 // Maybe we should hoist search-strategy all the way here?
17981798 for (self.lib_dirs) |lib_dir| {
17991799 if (!self.base.isStatic()) {
1800 if (try self.accessLibPath(arena, &test_path, &checked_paths, lib_dir, lib_name, .Dynamic))
1800 if (try self.accessLibPath(arena, &test_path, &checked_paths, lib_dir, lib_name, .dynamic))
18011801 break :success;
18021802 }
1803 if (try self.accessLibPath(arena, &test_path, &checked_paths, lib_dir, lib_name, .Static))
1803 if (try self.accessLibPath(arena, &test_path, &checked_paths, lib_dir, lib_name, .static))
18041804 break :success;
18051805 }
18061806 } else {
......@@ -1858,8 +1858,8 @@ fn accessLibPath(
18581858 test_path.clearRetainingCapacity();
18591859 const prefix = if (link_mode != null) "lib" else "";
18601860 const suffix = if (link_mode) |mode| switch (mode) {
1861 .Static => target.staticLibSuffix(),
1862 .Dynamic => target.dynamicLibSuffix(),
1861 .static => target.staticLibSuffix(),
1862 .dynamic => target.dynamicLibSuffix(),
18631863 } else "";
18641864 try test_path.writer().print("{s}" ++ sep ++ "{s}{s}{s}", .{
18651865 lib_dir_path,
......@@ -2150,10 +2150,10 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi
21502150 const is_obj = output_mode == .Obj;
21512151 const is_lib = output_mode == .Lib;
21522152 const link_mode = comp.config.link_mode;
2153 const is_dyn_lib = link_mode == .Dynamic and is_lib;
2153 const is_dyn_lib = link_mode == .dynamic and is_lib;
21542154 const is_exe_or_dyn_lib = is_dyn_lib or output_mode == .Exe;
21552155 const have_dynamic_linker = comp.config.link_libc and
2156 link_mode == .Dynamic and is_exe_or_dyn_lib;
2156 link_mode == .dynamic and is_exe_or_dyn_lib;
21572157 const target = comp.root_mod.resolved_target.result;
21582158 const compiler_rt_path: ?[]const u8 = blk: {
21592159 if (comp.compiler_rt_lib) |x| break :blk x.full_object_path;
......@@ -2463,7 +2463,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi
24632463 try argv.append(arg);
24642464 }
24652465
2466 if (link_mode == .Static) {
2466 if (link_mode == .static) {
24672467 if (target.cpu.arch.isArmOrThumb()) {
24682468 try argv.append("-Bstatic");
24692469 } else {
......@@ -2647,7 +2647,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi
26472647 comp.link_error_flags.missing_libc = false;
26482648 if (comp.config.link_libc) {
26492649 if (comp.libc_installation != null) {
2650 const needs_grouping = link_mode == .Static;
2650 const needs_grouping = link_mode == .static;
26512651 if (needs_grouping) try argv.append("--start-group");
26522652 try argv.appendSlice(target_util.libcFullLinkFlags(target));
26532653 if (needs_grouping) try argv.append("--end-group");
......@@ -2661,8 +2661,8 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi
26612661 try argv.append(try comp.get_libc_crt_file(arena, "libc_nonshared.a"));
26622662 } else if (target.isMusl()) {
26632663 try argv.append(try comp.get_libc_crt_file(arena, switch (link_mode) {
2664 .Static => "libc.a",
2665 .Dynamic => "libc.so",
2664 .static => "libc.a",
2665 .dynamic => "libc.so",
26662666 }));
26672667 } else {
26682668 comp.link_error_flags.missing_libc = true;
......@@ -2928,8 +2928,8 @@ pub fn writeElfHeader(self: *Elf) !void {
29282928 .Exe => if (comp.config.pie) .DYN else .EXEC,
29292929 .Obj => .REL,
29302930 .Lib => switch (link_mode) {
2931 .Static => @as(elf.ET, .REL),
2932 .Dynamic => .DYN,
2931 .static => @as(elf.ET, .REL),
2932 .dynamic => .DYN,
29332933 },
29342934 };
29352935 mem.writeInt(u16, hdr_buf[index..][0..2], @intFromEnum(elf_type), endian);
......@@ -3216,7 +3216,7 @@ fn allocateLinkerDefinedSymbols(self: *Elf) void {
32163216
32173217 // __rela_iplt_start, __rela_iplt_end
32183218 if (self.rela_dyn_section_index) |shndx| blk: {
3219 if (link_mode != .Static or comp.config.pie) break :blk;
3219 if (link_mode != .static or comp.config.pie) break :blk;
32203220 const shdr = &self.shdrs.items[shndx];
32213221 const end_addr = shdr.sh_addr + shdr.sh_size;
32223222 const start_addr = end_addr - self.calcNumIRelativeRelocs() * @sizeOf(elf.Elf64_Rela);
......@@ -5061,12 +5061,12 @@ const CsuObjects = struct {
50615061 } = switch (comp.config.output_mode) {
50625062 .Obj => return CsuObjects{},
50635063 .Lib => switch (comp.config.link_mode) {
5064 .Dynamic => .dynamic_lib,
5065 .Static => return CsuObjects{},
5064 .dynamic => .dynamic_lib,
5065 .static => return CsuObjects{},
50665066 },
50675067 .Exe => switch (comp.config.link_mode) {
5068 .Dynamic => if (comp.config.pie) .dynamic_pie else .dynamic_exe,
5069 .Static => if (comp.config.pie) .static_pie else .static_exe,
5068 .dynamic => if (comp.config.pie) .dynamic_pie else .dynamic_exe,
5069 .static => if (comp.config.pie) .static_pie else .static_exe,
50705070 },
50715071 };
50725072
src/link/Elf/ZigObject.zig+4-4
......@@ -1436,10 +1436,10 @@ pub fn updateExports(
14361436 }
14371437 }
14381438 const stb_bits: u8 = switch (exp.opts.linkage) {
1439 .Internal => elf.STB_LOCAL,
1440 .Strong => elf.STB_GLOBAL,
1441 .Weak => elf.STB_WEAK,
1442 .LinkOnce => {
1439 .internal => elf.STB_LOCAL,
1440 .strong => elf.STB_GLOBAL,
1441 .weak => elf.STB_WEAK,
1442 .link_once => {
14431443 try mod.failed_exports.ensureUnusedCapacity(mod.gpa, 1);
14441444 mod.failed_exports.putAssumeCapacityNoClobber(exp, try Module.ErrorMsg.create(
14451445 gpa,
src/link/MachO/ZigObject.zig+5-5
......@@ -1216,11 +1216,11 @@ pub fn updateExports(
12161216 continue;
12171217 }
12181218 }
1219 if (exp.opts.linkage == .LinkOnce) {
1219 if (exp.opts.linkage == .link_once) {
12201220 try mod.failed_exports.putNoClobber(mod.gpa, exp, try Module.ErrorMsg.create(
12211221 gpa,
12221222 exp.getSrcLoc(mod),
1223 "Unimplemented: GlobalLinkage.LinkOnce",
1223 "Unimplemented: GlobalLinkage.link_once",
12241224 .{},
12251225 ));
12261226 continue;
......@@ -1242,12 +1242,12 @@ pub fn updateExports(
12421242 self.symtab.items(.atom)[global_nlist_index] = self.symtab.items(.atom)[nlist_idx];
12431243
12441244 switch (exp.opts.linkage) {
1245 .Internal => {
1245 .internal => {
12461246 // Symbol should be hidden, or in MachO lingo, private extern.
12471247 global_nlist.n_type |= macho.N_PEXT;
12481248 },
1249 .Strong => {},
1250 .Weak => {
1249 .strong => {},
1250 .weak => {
12511251 // Weak linkage is specified as part of n_desc field.
12521252 // Symbol's n_type is like for a symbol with strong linkage.
12531253 global_nlist.n_desc |= macho.N_WEAK_DEF;
src/link/MachO/load_commands.zig+1-1
......@@ -222,7 +222,7 @@ pub fn writeDylibLC(ctx: WriteDylibLCCtx, writer: anytype) !void {
222222pub fn writeDylibIdLC(macho_file: *MachO, writer: anytype) !void {
223223 const comp = macho_file.base.comp;
224224 const gpa = comp.gpa;
225 assert(comp.config.output_mode == .Lib and comp.config.link_mode == .Dynamic);
225 assert(comp.config.output_mode == .Lib and comp.config.link_mode == .dynamic);
226226 const emit = macho_file.base.emit;
227227 const install_name = macho_file.install_name orelse
228228 try emit.directory.join(gpa, &.{emit.sub_path});
src/link/Wasm.zig+3-3
......@@ -2518,7 +2518,7 @@ pub fn flushModule(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node)
25182518 // When the target os is WASI, we allow linking with WASI-LIBC
25192519 if (target.os.tag == .wasi) {
25202520 const is_exe_or_dyn_lib = output_mode == .Exe or
2521 (output_mode == .Lib and link_mode == .Dynamic);
2521 (output_mode == .Lib and link_mode == .dynamic);
25222522 if (is_exe_or_dyn_lib) {
25232523 for (comp.wasi_emulated_libs) |crt_file| {
25242524 try positionals.append(try comp.get_libc_crt_file(
......@@ -3549,7 +3549,7 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) !vo
35493549 try argv.append("--allow-undefined");
35503550 }
35513551
3552 if (comp.config.output_mode == .Lib and comp.config.link_mode == .Dynamic) {
3552 if (comp.config.output_mode == .Lib and comp.config.link_mode == .dynamic) {
35533553 try argv.append("--shared");
35543554 }
35553555 if (comp.config.pie) {
......@@ -3569,7 +3569,7 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) !vo
35693569
35703570 if (target.os.tag == .wasi) {
35713571 const is_exe_or_dyn_lib = comp.config.output_mode == .Exe or
3572 (comp.config.output_mode == .Lib and comp.config.link_mode == .Dynamic);
3572 (comp.config.output_mode == .Lib and comp.config.link_mode == .dynamic);
35733573 if (is_exe_or_dyn_lib) {
35743574 for (comp.wasi_emulated_libs) |crt_file| {
35753575 try argv.append(try comp.get_libc_crt_file(
src/link/Wasm/ZigObject.zig+4-4
......@@ -896,14 +896,14 @@ pub fn updateExports(
896896 sym.name = export_name;
897897
898898 switch (exp.opts.linkage) {
899 .Internal => {
899 .internal => {
900900 sym.setFlag(.WASM_SYM_VISIBILITY_HIDDEN);
901901 },
902 .Weak => {
902 .weak => {
903903 sym.setFlag(.WASM_SYM_BINDING_WEAK);
904904 },
905 .Strong => {}, // symbols are strong by default
906 .LinkOnce => {
905 .strong => {}, // symbols are strong by default
906 .link_once => {
907907 try mod.failed_exports.putNoClobber(gpa, exp, try Module.ErrorMsg.create(
908908 gpa,
909909 decl.srcLoc(mod),
src/main.zig+35-35
......@@ -755,8 +755,8 @@ const SystemLib = struct {
755755 fn fallbackMode(this: SystemLib) std.builtin.LinkMode {
756756 assert(this.search_strategy != .no_fallback);
757757 return switch (this.preferred_mode) {
758 .Dynamic => .Static,
759 .Static => .Dynamic,
758 .dynamic => .static,
759 .static => .dynamic,
760760 };
761761 }
762762};
......@@ -892,7 +892,7 @@ fn buildOutputType(
892892 var entitlements: ?[]const u8 = null;
893893 var pagezero_size: ?u64 = null;
894894 var lib_search_strategy: SystemLib.SearchStrategy = .paths_first;
895 var lib_preferred_mode: std.builtin.LinkMode = .Dynamic;
895 var lib_preferred_mode: std.builtin.LinkMode = .dynamic;
896896 var headerpad_size: ?u32 = null;
897897 var headerpad_max_install_names: bool = false;
898898 var dead_strip_dylibs: bool = false;
......@@ -1166,22 +1166,22 @@ fn buildOutputType(
11661166 };
11671167 } else if (mem.eql(u8, arg, "-search_paths_first")) {
11681168 lib_search_strategy = .paths_first;
1169 lib_preferred_mode = .Dynamic;
1169 lib_preferred_mode = .dynamic;
11701170 } else if (mem.eql(u8, arg, "-search_paths_first_static")) {
11711171 lib_search_strategy = .paths_first;
1172 lib_preferred_mode = .Static;
1172 lib_preferred_mode = .static;
11731173 } else if (mem.eql(u8, arg, "-search_dylibs_first")) {
11741174 lib_search_strategy = .mode_first;
1175 lib_preferred_mode = .Dynamic;
1175 lib_preferred_mode = .dynamic;
11761176 } else if (mem.eql(u8, arg, "-search_static_first")) {
11771177 lib_search_strategy = .mode_first;
1178 lib_preferred_mode = .Static;
1178 lib_preferred_mode = .static;
11791179 } else if (mem.eql(u8, arg, "-search_dylibs_only")) {
11801180 lib_search_strategy = .no_fallback;
1181 lib_preferred_mode = .Dynamic;
1181 lib_preferred_mode = .dynamic;
11821182 } else if (mem.eql(u8, arg, "-search_static_only")) {
11831183 lib_search_strategy = .no_fallback;
1184 lib_preferred_mode = .Static;
1184 lib_preferred_mode = .static;
11851185 } else if (mem.eql(u8, arg, "-headerpad")) {
11861186 const next_arg = args_iter.nextOrFatal();
11871187 headerpad_size = std.fmt.parseUnsigned(u32, eatIntPrefix(next_arg, 16), 16) catch |err| {
......@@ -1478,12 +1478,12 @@ fn buildOutputType(
14781478 emit_implib = .no;
14791479 emit_implib_arg_provided = true;
14801480 } else if (mem.eql(u8, arg, "-dynamic")) {
1481 create_module.opts.link_mode = .Dynamic;
1482 lib_preferred_mode = .Dynamic;
1481 create_module.opts.link_mode = .dynamic;
1482 lib_preferred_mode = .dynamic;
14831483 lib_search_strategy = .mode_first;
14841484 } else if (mem.eql(u8, arg, "-static")) {
1485 create_module.opts.link_mode = .Static;
1486 lib_preferred_mode = .Static;
1485 create_module.opts.link_mode = .static;
1486 lib_preferred_mode = .static;
14871487 lib_search_strategy = .no_fallback;
14881488 } else if (mem.eql(u8, arg, "-fdll-export-fns")) {
14891489 create_module.opts.dll_export_fns = true;
......@@ -1904,7 +1904,7 @@ fn buildOutputType(
19041904 },
19051905 .nostdlib_cpp => create_module.opts.ensure_libcpp_on_non_freestanding = false,
19061906 .shared => {
1907 create_module.opts.link_mode = .Dynamic;
1907 create_module.opts.link_mode = .dynamic;
19081908 is_shared_lib = true;
19091909 },
19101910 .rdynamic => create_module.opts.rdynamic = true,
......@@ -1961,20 +1961,20 @@ fn buildOutputType(
19611961 mem.eql(u8, linker_arg, "-call_shared"))
19621962 {
19631963 lib_search_strategy = .no_fallback;
1964 lib_preferred_mode = .Dynamic;
1964 lib_preferred_mode = .dynamic;
19651965 } else if (mem.eql(u8, linker_arg, "-Bstatic") or
19661966 mem.eql(u8, linker_arg, "-dn") or
19671967 mem.eql(u8, linker_arg, "-non_shared") or
19681968 mem.eql(u8, linker_arg, "-static"))
19691969 {
19701970 lib_search_strategy = .no_fallback;
1971 lib_preferred_mode = .Static;
1971 lib_preferred_mode = .static;
19721972 } else if (mem.eql(u8, linker_arg, "-search_paths_first")) {
19731973 lib_search_strategy = .paths_first;
1974 lib_preferred_mode = .Dynamic;
1974 lib_preferred_mode = .dynamic;
19751975 } else if (mem.eql(u8, linker_arg, "-search_dylibs_first")) {
19761976 lib_search_strategy = .mode_first;
1977 lib_preferred_mode = .Dynamic;
1977 lib_preferred_mode = .dynamic;
19781978 } else {
19791979 try linker_args.append(linker_arg);
19801980 }
......@@ -3033,7 +3033,7 @@ fn buildOutputType(
30333033
30343034 const is_exe_or_dyn_lib = switch (create_module.resolved_options.output_mode) {
30353035 .Obj => false,
3036 .Lib => create_module.resolved_options.link_mode == .Dynamic,
3036 .Lib => create_module.resolved_options.link_mode == .dynamic,
30373037 .Exe => true,
30383038 };
30393039 // Note that cmake when targeting Windows will try to execute
......@@ -3770,8 +3770,8 @@ fn createModule(
37703770 )) {
37713771 const path = try arena.dupe(u8, test_path.items);
37723772 switch (info.preferred_mode) {
3773 .Static => try create_module.link_objects.append(arena, .{ .path = path }),
3774 .Dynamic => try create_module.resolved_system_libs.append(arena, .{
3773 .static => try create_module.link_objects.append(arena, .{ .path = path }),
3774 .dynamic => try create_module.resolved_system_libs.append(arena, .{
37753775 .name = lib_name,
37763776 .lib = .{
37773777 .needed = info.needed,
......@@ -3804,8 +3804,8 @@ fn createModule(
38043804 )) {
38053805 const path = try arena.dupe(u8, test_path.items);
38063806 switch (info.fallbackMode()) {
3807 .Static => try create_module.link_objects.append(arena, .{ .path = path }),
3808 .Dynamic => try create_module.resolved_system_libs.append(arena, .{
3807 .static => try create_module.link_objects.append(arena, .{ .path = path }),
3808 .dynamic => try create_module.resolved_system_libs.append(arena, .{
38093809 .name = lib_name,
38103810 .lib = .{
38113811 .needed = info.needed,
......@@ -3838,8 +3838,8 @@ fn createModule(
38383838 )) {
38393839 const path = try arena.dupe(u8, test_path.items);
38403840 switch (info.preferred_mode) {
3841 .Static => try create_module.link_objects.append(arena, .{ .path = path }),
3842 .Dynamic => try create_module.resolved_system_libs.append(arena, .{
3841 .static => try create_module.link_objects.append(arena, .{ .path = path }),
3842 .dynamic => try create_module.resolved_system_libs.append(arena, .{
38433843 .name = lib_name,
38443844 .lib = .{
38453845 .needed = info.needed,
......@@ -3862,8 +3862,8 @@ fn createModule(
38623862 )) {
38633863 const path = try arena.dupe(u8, test_path.items);
38643864 switch (info.fallbackMode()) {
3865 .Static => try create_module.link_objects.append(arena, .{ .path = path }),
3866 .Dynamic => try create_module.resolved_system_libs.append(arena, .{
3865 .static => try create_module.link_objects.append(arena, .{ .path = path }),
3866 .dynamic => try create_module.resolved_system_libs.append(arena, .{
38673867 .name = lib_name,
38683868 .lib = .{
38693869 .needed = info.needed,
......@@ -4145,8 +4145,8 @@ fn progressThread(progress: *std.Progress, server: *const Server, reset: *std.Th
41454145 buf.appendSlice("... ") catch {};
41464146 }
41474147 need_ellipse = false;
4148 const eti = @atomicLoad(usize, &node.unprotected_estimated_total_items, .Monotonic);
4149 const completed_items = @atomicLoad(usize, &node.unprotected_completed_items, .Monotonic);
4148 const eti = @atomicLoad(usize, &node.unprotected_estimated_total_items, .monotonic);
4149 const completed_items = @atomicLoad(usize, &node.unprotected_completed_items, .monotonic);
41504150 const current_item = completed_items + 1;
41514151 if (node.name.len != 0 or eti > 0) {
41524152 if (node.name.len != 0) {
......@@ -4163,7 +4163,7 @@ fn progressThread(progress: *std.Progress, server: *const Server, reset: *std.Th
41634163 need_ellipse = false;
41644164 }
41654165 }
4166 maybe_node = @atomicLoad(?*std.Progress.Node, &node.recently_updated_child, .Acquire);
4166 maybe_node = @atomicLoad(?*std.Progress.Node, &node.recently_updated_child, .acquire);
41674167 }
41684168 }
41694169
......@@ -6842,7 +6842,7 @@ fn accessLibPath(
68426842) !bool {
68436843 const sep = fs.path.sep_str;
68446844
6845 if (target.isDarwin() and link_mode == .Dynamic) tbd: {
6845 if (target.isDarwin() and link_mode == .dynamic) tbd: {
68466846 // Prefer .tbd over .dylib.
68476847 test_path.clearRetainingCapacity();
68486848 try test_path.writer().print("{s}" ++ sep ++ "lib{s}.tbd", .{ lib_dir_path, lib_name });
......@@ -6863,8 +6863,8 @@ fn accessLibPath(
68636863 target.libPrefix(),
68646864 lib_name,
68656865 switch (link_mode) {
6866 .Static => target.staticLibSuffix(),
6867 .Dynamic => target.dynamicLibSuffix(),
6866 .static => target.staticLibSuffix(),
6867 .dynamic => target.dynamicLibSuffix(),
68686868 },
68696869 });
68706870 try checked_paths.writer().print("\n {s}", .{test_path.items});
......@@ -6879,7 +6879,7 @@ fn accessLibPath(
68796879
68806880 // In the case of Darwin, the main check will be .dylib, so here we
68816881 // additionally check for .so files.
6882 if (target.isDarwin() and link_mode == .Dynamic) so: {
6882 if (target.isDarwin() and link_mode == .dynamic) so: {
68836883 test_path.clearRetainingCapacity();
68846884 try test_path.writer().print("{s}" ++ sep ++ "lib{s}.so", .{ lib_dir_path, lib_name });
68856885 try checked_paths.writer().print("\n {s}", .{test_path.items});
......@@ -6894,7 +6894,7 @@ fn accessLibPath(
68946894
68956895 // In the case of MinGW, the main check will be .lib but we also need to
68966896 // look for `libfoo.a`.
6897 if (target.isMinGW() and link_mode == .Static) mingw: {
6897 if (target.isMinGW() and link_mode == .static) mingw: {
68986898 test_path.clearRetainingCapacity();
68996899 try test_path.writer().print("{s}" ++ sep ++ "lib{s}.a", .{
69006900 lib_dir_path, lib_name,
src/musl.zig+1-1
......@@ -207,7 +207,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
207207 const strip = comp.compilerRtStrip();
208208 const config = try Compilation.Config.resolve(.{
209209 .output_mode = .Lib,
210 .link_mode = .Dynamic,
210 .link_mode = .dynamic,
211211 .resolved_target = comp.root_mod.resolved_target,
212212 .is_test = false,
213213 .have_zcu = false,
src/print_air.zig+4-4
......@@ -303,10 +303,10 @@ const Writer = struct {
303303 .fence => try w.writeFence(s, inst),
304304 .atomic_load => try w.writeAtomicLoad(s, inst),
305305 .prefetch => try w.writePrefetch(s, inst),
306 .atomic_store_unordered => try w.writeAtomicStore(s, inst, .Unordered),
307 .atomic_store_monotonic => try w.writeAtomicStore(s, inst, .Monotonic),
308 .atomic_store_release => try w.writeAtomicStore(s, inst, .Release),
309 .atomic_store_seq_cst => try w.writeAtomicStore(s, inst, .SeqCst),
306 .atomic_store_unordered => try w.writeAtomicStore(s, inst, .unordered),
307 .atomic_store_monotonic => try w.writeAtomicStore(s, inst, .monotonic),
308 .atomic_store_release => try w.writeAtomicStore(s, inst, .release),
309 .atomic_store_seq_cst => try w.writeAtomicStore(s, inst, .seq_cst),
310310 .atomic_rmw => try w.writeAtomicRmw(s, inst),
311311 .field_parent_ptr => try w.writeFieldParentPtr(s, inst),
312312 .wasm_memory_size => try w.writeWasmMemorySize(s, inst),
src/print_zir.zig+1-1
......@@ -1440,7 +1440,7 @@ const Writer = struct {
14401440 if (small.has_backing_int) {
14411441 const backing_int_body_len = self.code.extra[extra_index];
14421442 extra_index += 1;
1443 try stream.writeAll("Packed(");
1443 try stream.writeAll("packed(");
14441444 if (backing_int_body_len == 0) {
14451445 const backing_int_ref: Zir.Inst.Ref = @enumFromInt(self.code.extra[extra_index]);
14461446 extra_index += 1;
src/type.zig+19-19
......@@ -741,12 +741,12 @@ pub const Type = struct {
741741 .struct_type => {
742742 const struct_type = ip.loadStructType(ty.toIntern());
743743 // Struct with no fields have a well-defined layout of no bits.
744 return struct_type.layout != .Auto or struct_type.field_types.len == 0;
744 return struct_type.layout != .auto or struct_type.field_types.len == 0;
745745 },
746746 .union_type => {
747747 const union_type = ip.loadUnionType(ty.toIntern());
748748 return switch (union_type.flagsPtr(ip).runtime_tag) {
749 .none, .safety => union_type.flagsPtr(ip).layout != .Auto,
749 .none, .safety => union_type.flagsPtr(ip).layout != .auto,
750750 .tagged => false,
751751 };
752752 },
......@@ -1027,7 +1027,7 @@ pub const Type = struct {
10271027 },
10281028 .struct_type => {
10291029 const struct_type = ip.loadStructType(ty.toIntern());
1030 if (struct_type.layout == .Packed) {
1030 if (struct_type.layout == .@"packed") {
10311031 switch (strat) {
10321032 .sema => |sema| try sema.resolveTypeLayout(ty),
10331033 .lazy => if (struct_type.backingIntType(ip).* == .none) return .{
......@@ -1407,7 +1407,7 @@ pub const Type = struct {
14071407 switch (strat) {
14081408 .sema => |sema| try sema.resolveTypeLayout(ty),
14091409 .lazy => switch (struct_type.layout) {
1410 .Packed => {
1410 .@"packed" => {
14111411 if (struct_type.backingIntType(ip).* == .none) return .{
14121412 .val = Value.fromInterned((try mod.intern(.{ .int = .{
14131413 .ty = .comptime_int_type,
......@@ -1415,7 +1415,7 @@ pub const Type = struct {
14151415 } }))),
14161416 };
14171417 },
1418 .Auto, .Extern => {
1418 .auto, .@"extern" => {
14191419 if (!struct_type.haveLayout(ip)) return .{
14201420 .val = Value.fromInterned((try mod.intern(.{ .int = .{
14211421 .ty = .comptime_int_type,
......@@ -1427,10 +1427,10 @@ pub const Type = struct {
14271427 .eager => {},
14281428 }
14291429 switch (struct_type.layout) {
1430 .Packed => return .{
1430 .@"packed" => return .{
14311431 .scalar = Type.fromInterned(struct_type.backingIntType(ip).*).abiSize(mod),
14321432 },
1433 .Auto, .Extern => {
1433 .auto, .@"extern" => {
14341434 assert(struct_type.haveLayout(ip));
14351435 return .{ .scalar = struct_type.size(ip).* };
14361436 },
......@@ -1656,7 +1656,7 @@ pub const Type = struct {
16561656 },
16571657 .struct_type => {
16581658 const struct_type = ip.loadStructType(ty.toIntern());
1659 const is_packed = struct_type.layout == .Packed;
1659 const is_packed = struct_type.layout == .@"packed";
16601660 if (opt_sema) |sema| {
16611661 try sema.resolveTypeFields(ty);
16621662 if (is_packed) try sema.resolveTypeLayout(ty);
......@@ -1674,7 +1674,7 @@ pub const Type = struct {
16741674
16751675 .union_type => {
16761676 const union_type = ip.loadUnionType(ty.toIntern());
1677 const is_packed = ty.containerLayout(mod) == .Packed;
1677 const is_packed = ty.containerLayout(mod) == .@"packed";
16781678 if (opt_sema) |sema| {
16791679 try sema.resolveTypeFields(ty);
16801680 if (is_packed) try sema.resolveTypeLayout(ty);
......@@ -1987,9 +1987,9 @@ pub const Type = struct {
19871987 /// Asserts the type is either an extern or packed union.
19881988 pub fn unionBackingType(ty: Type, mod: *Module) !Type {
19891989 return switch (ty.containerLayout(mod)) {
1990 .Extern => try mod.arrayType(.{ .len = ty.abiSize(mod), .child = .u8_type }),
1991 .Packed => try mod.intType(.unsigned, @intCast(ty.bitSize(mod))),
1992 .Auto => unreachable,
1990 .@"extern" => try mod.arrayType(.{ .len = ty.abiSize(mod), .child = .u8_type }),
1991 .@"packed" => try mod.intType(.unsigned, @intCast(ty.bitSize(mod))),
1992 .auto => unreachable,
19931993 };
19941994 }
19951995
......@@ -2003,7 +2003,7 @@ pub const Type = struct {
20032003 const ip = &mod.intern_pool;
20042004 return switch (ip.indexToKey(ty.toIntern())) {
20052005 .struct_type => ip.loadStructType(ty.toIntern()).layout,
2006 .anon_struct_type => .Auto,
2006 .anon_struct_type => .auto,
20072007 .union_type => ip.loadUnionType(ty.toIntern()).flagsPtr(ip).layout,
20082008 else => unreachable,
20092009 };
......@@ -2177,7 +2177,7 @@ pub const Type = struct {
21772177 pub fn isAbiInt(ty: Type, mod: *Module) bool {
21782178 return switch (ty.zigTypeTag(mod)) {
21792179 .Int, .Enum, .ErrorSet => true,
2180 .Struct => ty.containerLayout(mod) == .Packed,
2180 .Struct => ty.containerLayout(mod) == .@"packed",
21812181 else => false,
21822182 };
21832183 }
......@@ -2690,7 +2690,7 @@ pub const Type = struct {
26902690 const struct_type = ip.loadStructType(ty.toIntern());
26912691 // packed structs cannot be comptime-only because they have a well-defined
26922692 // memory layout and every field has a well-defined bit pattern.
2693 if (struct_type.layout == .Packed)
2693 if (struct_type.layout == .@"packed")
26942694 return false;
26952695
26962696 // A struct with no fields is not comptime-only.
......@@ -3051,7 +3051,7 @@ pub const Type = struct {
30513051 switch (ip.indexToKey(ty.toIntern())) {
30523052 .struct_type => {
30533053 const struct_type = ip.loadStructType(ty.toIntern());
3054 assert(struct_type.layout != .Packed);
3054 assert(struct_type.layout != .@"packed");
30553055 const explicit_align = struct_type.fieldAlign(ip, index);
30563056 const field_ty = Type.fromInterned(struct_type.field_types.get(ip)[index]);
30573057 return mod.structFieldAlignment(explicit_align, field_ty, struct_type.layout);
......@@ -3132,7 +3132,7 @@ pub const Type = struct {
31323132 .struct_type => {
31333133 const struct_type = ip.loadStructType(ty.toIntern());
31343134 assert(struct_type.haveLayout(ip));
3135 assert(struct_type.layout != .Packed);
3135 assert(struct_type.layout != .@"packed");
31363136 return struct_type.offsets.get(ip)[index];
31373137 },
31383138
......@@ -3208,7 +3208,7 @@ pub const Type = struct {
32083208 return switch (ip.indexToKey(ty.toIntern())) {
32093209 .struct_type => {
32103210 const struct_type = ip.loadStructType(ty.toIntern());
3211 if (struct_type.layout == .Packed) return false;
3211 if (struct_type.layout == .@"packed") return false;
32123212 if (struct_type.decl == .none) return false;
32133213 return struct_type.flagsPtr(ip).is_tuple;
32143214 },
......@@ -3230,7 +3230,7 @@ pub const Type = struct {
32303230 return switch (ip.indexToKey(ty.toIntern())) {
32313231 .struct_type => {
32323232 const struct_type = ip.loadStructType(ty.toIntern());
3233 if (struct_type.layout == .Packed) return false;
3233 if (struct_type.layout == .@"packed") return false;
32343234 if (struct_type.decl == .none) return false;
32353235 return struct_type.flagsPtr(ip).is_tuple;
32363236 },
test/behavior/atomics.zig+59-59
......@@ -22,18 +22,18 @@ test "cmpxchg" {
2222
2323fn testCmpxchg() !void {
2424 var x: i32 = 1234;
25 if (@cmpxchgWeak(i32, &x, 99, 5678, .SeqCst, .SeqCst)) |x1| {
25 if (@cmpxchgWeak(i32, &x, 99, 5678, .seq_cst, .seq_cst)) |x1| {
2626 try expect(x1 == 1234);
2727 } else {
2828 @panic("cmpxchg should have failed");
2929 }
3030
31 while (@cmpxchgWeak(i32, &x, 1234, 5678, .SeqCst, .SeqCst)) |x1| {
31 while (@cmpxchgWeak(i32, &x, 1234, 5678, .seq_cst, .seq_cst)) |x1| {
3232 try expect(x1 == 1234);
3333 }
3434 try expect(x == 5678);
3535
36 try expect(@cmpxchgStrong(i32, &x, 5678, 42, .SeqCst, .SeqCst) == null);
36 try expect(@cmpxchgStrong(i32, &x, 5678, 42, .seq_cst, .seq_cst) == null);
3737 try expect(x == 42);
3838}
3939
......@@ -43,7 +43,7 @@ test "fence" {
4343 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
4444
4545 var x: i32 = 1234;
46 @fence(.SeqCst);
46 @fence(.seq_cst);
4747 x = 5678;
4848}
4949
......@@ -60,18 +60,18 @@ test "atomicrmw and atomicload" {
6060}
6161
6262fn testAtomicRmw(ptr: *u8) !void {
63 const prev_value = @atomicRmw(u8, ptr, .Xchg, 42, .SeqCst);
63 const prev_value = @atomicRmw(u8, ptr, .Xchg, 42, .seq_cst);
6464 try expect(prev_value == 200);
6565 comptime {
6666 var x: i32 = 1234;
6767 const y: i32 = 12345;
68 try expect(@atomicLoad(i32, &x, .SeqCst) == 1234);
69 try expect(@atomicLoad(i32, &y, .SeqCst) == 12345);
68 try expect(@atomicLoad(i32, &x, .seq_cst) == 1234);
69 try expect(@atomicLoad(i32, &y, .seq_cst) == 12345);
7070 }
7171}
7272
7373fn testAtomicLoad(ptr: *u8) !void {
74 const x = @atomicLoad(u8, ptr, .SeqCst);
74 const x = @atomicLoad(u8, ptr, .seq_cst);
7575 try expect(x == 42);
7676}
7777
......@@ -85,18 +85,18 @@ test "cmpxchg with ptr" {
8585 var data2: i32 = 5678;
8686 var data3: i32 = 9101;
8787 var x: *i32 = &data1;
88 if (@cmpxchgWeak(*i32, &x, &data2, &data3, .SeqCst, .SeqCst)) |x1| {
88 if (@cmpxchgWeak(*i32, &x, &data2, &data3, .seq_cst, .seq_cst)) |x1| {
8989 try expect(x1 == &data1);
9090 } else {
9191 @panic("cmpxchg should have failed");
9292 }
9393
94 while (@cmpxchgWeak(*i32, &x, &data1, &data3, .SeqCst, .SeqCst)) |x1| {
94 while (@cmpxchgWeak(*i32, &x, &data1, &data3, .seq_cst, .seq_cst)) |x1| {
9595 try expect(x1 == &data1);
9696 }
9797 try expect(x == &data3);
9898
99 try expect(@cmpxchgStrong(*i32, &x, &data3, &data2, .SeqCst, .SeqCst) == null);
99 try expect(@cmpxchgStrong(*i32, &x, &data3, &data2, .seq_cst, .seq_cst) == null);
100100 try expect(x == &data2);
101101}
102102
......@@ -108,7 +108,7 @@ test "cmpxchg with ignored result" {
108108
109109 var x: i32 = 1234;
110110
111 _ = @cmpxchgStrong(i32, &x, 1234, 5678, .Monotonic, .Monotonic);
111 _ = @cmpxchgStrong(i32, &x, 1234, 5678, .monotonic, .monotonic);
112112
113113 try expect(5678 == x);
114114}
......@@ -127,18 +127,18 @@ test "128-bit cmpxchg" {
127127
128128fn test_u128_cmpxchg() !void {
129129 var x: u128 align(16) = 1234;
130 if (@cmpxchgWeak(u128, &x, 99, 5678, .SeqCst, .SeqCst)) |x1| {
130 if (@cmpxchgWeak(u128, &x, 99, 5678, .seq_cst, .seq_cst)) |x1| {
131131 try expect(x1 == 1234);
132132 } else {
133133 @panic("cmpxchg should have failed");
134134 }
135135
136 while (@cmpxchgWeak(u128, &x, 1234, 5678, .SeqCst, .SeqCst)) |x1| {
136 while (@cmpxchgWeak(u128, &x, 1234, 5678, .seq_cst, .seq_cst)) |x1| {
137137 try expect(x1 == 1234);
138138 }
139139 try expect(x == 5678);
140140
141 try expect(@cmpxchgStrong(u128, &x, 5678, 42, .SeqCst, .SeqCst) == null);
141 try expect(@cmpxchgStrong(u128, &x, 5678, 42, .seq_cst, .seq_cst) == null);
142142 try expect(x == 42);
143143}
144144
......@@ -155,7 +155,7 @@ test "cmpxchg on a global variable" {
155155 return error.SkipZigTest;
156156 }
157157
158 _ = @cmpxchgWeak(u32, &a_global_variable, 1234, 42, .Acquire, .Monotonic);
158 _ = @cmpxchgWeak(u32, &a_global_variable, 1234, 42, .acquire, .monotonic);
159159 try expect(a_global_variable == 42);
160160}
161161
......@@ -168,12 +168,12 @@ test "atomic load and rmw with enum" {
168168 const Value = enum(u8) { a, b, c };
169169 var x = Value.a;
170170
171 try expect(@atomicLoad(Value, &x, .SeqCst) != .b);
171 try expect(@atomicLoad(Value, &x, .seq_cst) != .b);
172172
173 _ = @atomicRmw(Value, &x, .Xchg, .c, .SeqCst);
174 try expect(@atomicLoad(Value, &x, .SeqCst) == .c);
175 try expect(@atomicLoad(Value, &x, .SeqCst) != .a);
176 try expect(@atomicLoad(Value, &x, .SeqCst) != .b);
173 _ = @atomicRmw(Value, &x, .Xchg, .c, .seq_cst);
174 try expect(@atomicLoad(Value, &x, .seq_cst) == .c);
175 try expect(@atomicLoad(Value, &x, .seq_cst) != .a);
176 try expect(@atomicLoad(Value, &x, .seq_cst) != .b);
177177}
178178
179179test "atomic store" {
......@@ -183,10 +183,10 @@ test "atomic store" {
183183 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
184184
185185 var x: u32 = 0;
186 @atomicStore(u32, &x, 1, .SeqCst);
187 try expect(@atomicLoad(u32, &x, .SeqCst) == 1);
188 @atomicStore(u32, &x, 12345678, .SeqCst);
189 try expect(@atomicLoad(u32, &x, .SeqCst) == 12345678);
186 @atomicStore(u32, &x, 1, .seq_cst);
187 try expect(@atomicLoad(u32, &x, .seq_cst) == 1);
188 @atomicStore(u32, &x, 12345678, .seq_cst);
189 try expect(@atomicLoad(u32, &x, .seq_cst) == 12345678);
190190}
191191
192192test "atomic store comptime" {
......@@ -201,10 +201,10 @@ test "atomic store comptime" {
201201
202202fn testAtomicStore() !void {
203203 var x: u32 = 0;
204 @atomicStore(u32, &x, 1, .SeqCst);
205 try expect(@atomicLoad(u32, &x, .SeqCst) == 1);
206 @atomicStore(u32, &x, 12345678, .SeqCst);
207 try expect(@atomicLoad(u32, &x, .SeqCst) == 12345678);
204 @atomicStore(u32, &x, 1, .seq_cst);
205 try expect(@atomicLoad(u32, &x, .seq_cst) == 1);
206 @atomicStore(u32, &x, 12345678, .seq_cst);
207 try expect(@atomicLoad(u32, &x, .seq_cst) == 12345678);
208208}
209209
210210test "atomicrmw with floats" {
......@@ -224,15 +224,15 @@ test "atomicrmw with floats" {
224224fn testAtomicRmwFloat() !void {
225225 var x: f32 = 0;
226226 try expect(x == 0);
227 _ = @atomicRmw(f32, &x, .Xchg, 1, .SeqCst);
227 _ = @atomicRmw(f32, &x, .Xchg, 1, .seq_cst);
228228 try expect(x == 1);
229 _ = @atomicRmw(f32, &x, .Add, 5, .SeqCst);
229 _ = @atomicRmw(f32, &x, .Add, 5, .seq_cst);
230230 try expect(x == 6);
231 _ = @atomicRmw(f32, &x, .Sub, 2, .SeqCst);
231 _ = @atomicRmw(f32, &x, .Sub, 2, .seq_cst);
232232 try expect(x == 4);
233 _ = @atomicRmw(f32, &x, .Max, 13, .SeqCst);
233 _ = @atomicRmw(f32, &x, .Max, 13, .seq_cst);
234234 try expect(x == 13);
235 _ = @atomicRmw(f32, &x, .Min, 42, .SeqCst);
235 _ = @atomicRmw(f32, &x, .Min, 42, .seq_cst);
236236 try expect(x == 13);
237237}
238238
......@@ -266,46 +266,46 @@ fn testAtomicRmwInt(comptime signedness: std.builtin.Signedness, comptime N: usi
266266 const int = std.meta.Int(signedness, N);
267267
268268 var x: int = 1;
269 var res = @atomicRmw(int, &x, .Xchg, 3, .SeqCst);
269 var res = @atomicRmw(int, &x, .Xchg, 3, .seq_cst);
270270 try expect(x == 3 and res == 1);
271271
272 res = @atomicRmw(int, &x, .Add, 3, .SeqCst);
272 res = @atomicRmw(int, &x, .Add, 3, .seq_cst);
273273 var y: int = 3;
274274 try expect(res == y);
275275 y = y + 3;
276276 try expect(x == y);
277277
278 res = @atomicRmw(int, &x, .Sub, 1, .SeqCst);
278 res = @atomicRmw(int, &x, .Sub, 1, .seq_cst);
279279 try expect(res == y);
280280 y = y - 1;
281281 try expect(x == y);
282282
283 res = @atomicRmw(int, &x, .And, 4, .SeqCst);
283 res = @atomicRmw(int, &x, .And, 4, .seq_cst);
284284 try expect(res == y);
285285 y = y & 4;
286286 try expect(x == y);
287287
288 res = @atomicRmw(int, &x, .Nand, 4, .SeqCst);
288 res = @atomicRmw(int, &x, .Nand, 4, .seq_cst);
289289 try expect(res == y);
290290 y = ~(y & 4);
291291 try expect(x == y);
292292
293 res = @atomicRmw(int, &x, .Or, 6, .SeqCst);
293 res = @atomicRmw(int, &x, .Or, 6, .seq_cst);
294294 try expect(res == y);
295295 y = y | 6;
296296 try expect(x == y);
297297
298 res = @atomicRmw(int, &x, .Xor, 2, .SeqCst);
298 res = @atomicRmw(int, &x, .Xor, 2, .seq_cst);
299299 try expect(res == y);
300300 y = y ^ 2;
301301 try expect(x == y);
302302
303 res = @atomicRmw(int, &x, .Max, 1, .SeqCst);
303 res = @atomicRmw(int, &x, .Max, 1, .seq_cst);
304304 try expect(res == y);
305305 y = @max(y, 1);
306306 try expect(x == y);
307307
308 res = @atomicRmw(int, &x, .Min, 1, .SeqCst);
308 res = @atomicRmw(int, &x, .Min, 1, .seq_cst);
309309 try expect(res == y);
310310 y = @min(y, 1);
311311 try expect(x == y);
......@@ -333,53 +333,53 @@ fn testAtomicRmwInt128(comptime signedness: std.builtin.Signedness) !void {
333333 const replacement: int = 0x00000000_00000005_00000000_00000003;
334334
335335 var x: int align(16) = initial;
336 var res = @atomicRmw(int, &x, .Xchg, replacement, .SeqCst);
336 var res = @atomicRmw(int, &x, .Xchg, replacement, .seq_cst);
337337 try expect(x == replacement and res == initial);
338338
339339 var operator: int = 0x00000001_00000000_20000000_00000000;
340 res = @atomicRmw(int, &x, .Add, operator, .SeqCst);
340 res = @atomicRmw(int, &x, .Add, operator, .seq_cst);
341341 var y: int = replacement;
342342 try expect(res == y);
343343 y = y + operator;
344344 try expect(x == y);
345345
346346 operator = 0x00000000_10000000_00000000_20000000;
347 res = @atomicRmw(int, &x, .Sub, operator, .SeqCst);
347 res = @atomicRmw(int, &x, .Sub, operator, .seq_cst);
348348 try expect(res == y);
349349 y = y - operator;
350350 try expect(x == y);
351351
352352 operator = 0x12345678_87654321_12345678_87654321;
353 res = @atomicRmw(int, &x, .And, operator, .SeqCst);
353 res = @atomicRmw(int, &x, .And, operator, .seq_cst);
354354 try expect(res == y);
355355 y = y & operator;
356356 try expect(x == y);
357357
358358 operator = 0x00000000_10000000_00000000_20000000;
359 res = @atomicRmw(int, &x, .Nand, operator, .SeqCst);
359 res = @atomicRmw(int, &x, .Nand, operator, .seq_cst);
360360 try expect(res == y);
361361 y = ~(y & operator);
362362 try expect(x == y);
363363
364364 operator = 0x12340000_56780000_67890000_98760000;
365 res = @atomicRmw(int, &x, .Or, operator, .SeqCst);
365 res = @atomicRmw(int, &x, .Or, operator, .seq_cst);
366366 try expect(res == y);
367367 y = y | operator;
368368 try expect(x == y);
369369
370370 operator = 0x0a0b0c0d_0e0f0102_03040506_0708090a;
371 res = @atomicRmw(int, &x, .Xor, operator, .SeqCst);
371 res = @atomicRmw(int, &x, .Xor, operator, .seq_cst);
372372 try expect(res == y);
373373 y = y ^ operator;
374374 try expect(x == y);
375375
376376 operator = 0x00000000_10000000_00000000_20000000;
377 res = @atomicRmw(int, &x, .Max, operator, .SeqCst);
377 res = @atomicRmw(int, &x, .Max, operator, .seq_cst);
378378 try expect(res == y);
379379 y = @max(y, operator);
380380 try expect(x == y);
381381
382 res = @atomicRmw(int, &x, .Min, operator, .SeqCst);
382 res = @atomicRmw(int, &x, .Min, operator, .seq_cst);
383383 try expect(res == y);
384384 y = @min(y, operator);
385385 try expect(x == y);
......@@ -405,13 +405,13 @@ test "atomics with different types" {
405405
406406fn testAtomicsWithType(comptime T: type, a: T, b: T) !void {
407407 var x: T = b;
408 @atomicStore(T, &x, a, .SeqCst);
408 @atomicStore(T, &x, a, .seq_cst);
409409 try expect(x == a);
410 try expect(@atomicLoad(T, &x, .SeqCst) == a);
411 try expect(@atomicRmw(T, &x, .Xchg, b, .SeqCst) == a);
412 try expect(@cmpxchgStrong(T, &x, b, a, .SeqCst, .SeqCst) == null);
410 try expect(@atomicLoad(T, &x, .seq_cst) == a);
411 try expect(@atomicRmw(T, &x, .Xchg, b, .seq_cst) == a);
412 try expect(@cmpxchgStrong(T, &x, b, a, .seq_cst, .seq_cst) == null);
413413 if (@sizeOf(T) != 0)
414 try expect(@cmpxchgStrong(T, &x, b, a, .SeqCst, .SeqCst).? == a);
414 try expect(@cmpxchgStrong(T, &x, b, a, .seq_cst, .seq_cst).? == a);
415415}
416416
417417test "return @atomicStore, using it as a void value" {
......@@ -425,12 +425,12 @@ test "return @atomicStore, using it as a void value" {
425425 value: usize,
426426
427427 pub fn store(self: *A, value: usize) void {
428 return @atomicStore(usize, &self.value, value, .Unordered);
428 return @atomicStore(usize, &self.value, value, .unordered);
429429 }
430430
431431 pub fn store2(self: *A, value: usize) void {
432432 return switch (value) {
433 else => @atomicStore(usize, &self.value, value, .Unordered),
433 else => @atomicStore(usize, &self.value, value, .unordered),
434434 };
435435 }
436436 };
test/behavior/builtin_functions_returning_void_or_noreturn.zig+3-3
......@@ -14,10 +14,10 @@ test {
1414 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1515
1616 var val: u8 = undefined;
17 try testing.expectEqual({}, @atomicStore(u8, &val, 0, .Unordered));
17 try testing.expectEqual({}, @atomicStore(u8, &val, 0, .unordered));
1818 try testing.expectEqual(void, @TypeOf(@breakpoint()));
1919 try testing.expectEqual({}, @export(x, .{ .name = "x" }));
20 try testing.expectEqual({}, @fence(.Acquire));
20 try testing.expectEqual({}, @fence(.acquire));
2121 try testing.expectEqual({}, @memcpy(@as([*]u8, @ptrFromInt(1))[0..0], @as([*]u8, @ptrFromInt(1))[0..0]));
2222 try testing.expectEqual({}, @memset(@as([*]u8, @ptrFromInt(1))[0..0], undefined));
2323 try testing.expectEqual(noreturn, @TypeOf(if (true) @panic("") else {}));
......@@ -25,6 +25,6 @@ test {
2525 try testing.expectEqual({}, @setAlignStack(16));
2626 try testing.expectEqual({}, @setCold(true));
2727 try testing.expectEqual({}, @setEvalBranchQuota(0));
28 try testing.expectEqual({}, @setFloatMode(.Optimized));
28 try testing.expectEqual({}, @setFloatMode(.optimized));
2929 try testing.expectEqual({}, @setRuntimeSafety(true));
3030}
test/behavior/export_builtin.zig+2-2
......@@ -25,7 +25,7 @@ test "exporting with internal linkage" {
2525 const S = struct {
2626 fn foo() callconv(.C) void {}
2727 comptime {
28 @export(foo, .{ .name = "exporting_with_internal_linkage_foo", .linkage = .Internal });
28 @export(foo, .{ .name = "exporting_with_internal_linkage_foo", .linkage = .internal });
2929 }
3030 };
3131 S.foo();
......@@ -41,7 +41,7 @@ test "exporting using field access" {
4141 const x: u32 = 5;
4242 };
4343 comptime {
44 @export(Inner.x, .{ .name = "foo", .linkage = .Internal });
44 @export(Inner.x, .{ .name = "foo", .linkage = .internal });
4545 }
4646 };
4747
test/behavior/floatop.zig+1-1
......@@ -1511,7 +1511,7 @@ test "eval @setFloatMode at compile-time" {
15111511}
15121512
15131513fn fnWithFloatMode() f32 {
1514 @setFloatMode(std.builtin.FloatMode.Strict);
1514 @setFloatMode(std.builtin.FloatMode.strict);
15151515 return 1234.0;
15161516}
15171517
test/behavior/tuple.zig+3-3
......@@ -135,7 +135,7 @@ test "array-like initializer for tuple types" {
135135 const T = @Type(.{
136136 .Struct = .{
137137 .is_tuple = true,
138 .layout = .Auto,
138 .layout = .auto,
139139 .decls = &.{},
140140 .fields = &.{
141141 .{
......@@ -323,7 +323,7 @@ test "zero sized struct in tuple handled correctly" {
323323 data: @Type(.{
324324 .Struct = .{
325325 .is_tuple = true,
326 .layout = .Auto,
326 .layout = .auto,
327327 .decls = &.{},
328328 .fields = &.{.{
329329 .name = "0",
......@@ -471,7 +471,7 @@ test "coerce anon tuple to tuple" {
471471
472472test "empty tuple type" {
473473 const S = @Type(.{ .Struct = .{
474 .layout = .Auto,
474 .layout = .auto,
475475 .fields = &.{},
476476 .decls = &.{},
477477 .is_tuple = true,
test/behavior/tuple_declarations.zig+1-1
......@@ -12,7 +12,7 @@ test "tuple declaration type info" {
1212 const T = struct { comptime u32 align(2) = 1, []const u8 };
1313 const info = @typeInfo(T).Struct;
1414
15 try expect(info.layout == .Auto);
15 try expect(info.layout == .auto);
1616 try expect(info.backing_integer == null);
1717 try expect(info.fields.len == 2);
1818 try expect(info.decls.len == 0);
test/behavior/type.zig+19-19
......@@ -263,7 +263,7 @@ test "Type.Struct" {
263263
264264 const A = @Type(@typeInfo(struct { x: u8, y: u32 }));
265265 const infoA = @typeInfo(A).Struct;
266 try testing.expectEqual(Type.ContainerLayout.Auto, infoA.layout);
266 try testing.expectEqual(Type.ContainerLayout.auto, infoA.layout);
267267 try testing.expectEqualSlices(u8, "x", infoA.fields[0].name);
268268 try testing.expectEqual(u8, infoA.fields[0].type);
269269 try testing.expectEqual(@as(?*const anyopaque, null), infoA.fields[0].default_value);
......@@ -281,7 +281,7 @@ test "Type.Struct" {
281281
282282 const B = @Type(@typeInfo(extern struct { x: u8, y: u32 = 5 }));
283283 const infoB = @typeInfo(B).Struct;
284 try testing.expectEqual(Type.ContainerLayout.Extern, infoB.layout);
284 try testing.expectEqual(Type.ContainerLayout.@"extern", infoB.layout);
285285 try testing.expectEqualSlices(u8, "x", infoB.fields[0].name);
286286 try testing.expectEqual(u8, infoB.fields[0].type);
287287 try testing.expectEqual(@as(?*const anyopaque, null), infoB.fields[0].default_value);
......@@ -293,7 +293,7 @@ test "Type.Struct" {
293293
294294 const C = @Type(@typeInfo(packed struct { x: u8 = 3, y: u32 = 5 }));
295295 const infoC = @typeInfo(C).Struct;
296 try testing.expectEqual(Type.ContainerLayout.Packed, infoC.layout);
296 try testing.expectEqual(Type.ContainerLayout.@"packed", infoC.layout);
297297 try testing.expectEqualSlices(u8, "x", infoC.fields[0].name);
298298 try testing.expectEqual(u8, infoC.fields[0].type);
299299 try testing.expectEqual(@as(u8, 3), @as(*const u8, @ptrCast(infoC.fields[0].default_value.?)).*);
......@@ -306,7 +306,7 @@ test "Type.Struct" {
306306 // anon structs
307307 const D = @Type(@typeInfo(@TypeOf(.{ .x = 3, .y = 5 })));
308308 const infoD = @typeInfo(D).Struct;
309 try testing.expectEqual(Type.ContainerLayout.Auto, infoD.layout);
309 try testing.expectEqual(Type.ContainerLayout.auto, infoD.layout);
310310 try testing.expectEqualSlices(u8, "x", infoD.fields[0].name);
311311 try testing.expectEqual(comptime_int, infoD.fields[0].type);
312312 try testing.expectEqual(@as(comptime_int, 3), @as(*const comptime_int, @ptrCast(infoD.fields[0].default_value.?)).*);
......@@ -319,7 +319,7 @@ test "Type.Struct" {
319319 // tuples
320320 const E = @Type(@typeInfo(@TypeOf(.{ 1, 2 })));
321321 const infoE = @typeInfo(E).Struct;
322 try testing.expectEqual(Type.ContainerLayout.Auto, infoE.layout);
322 try testing.expectEqual(Type.ContainerLayout.auto, infoE.layout);
323323 try testing.expectEqualSlices(u8, "0", infoE.fields[0].name);
324324 try testing.expectEqual(comptime_int, infoE.fields[0].type);
325325 try testing.expectEqual(@as(comptime_int, 1), @as(*const comptime_int, @ptrCast(infoE.fields[0].default_value.?)).*);
......@@ -332,14 +332,14 @@ test "Type.Struct" {
332332 // empty struct
333333 const F = @Type(@typeInfo(struct {}));
334334 const infoF = @typeInfo(F).Struct;
335 try testing.expectEqual(Type.ContainerLayout.Auto, infoF.layout);
335 try testing.expectEqual(Type.ContainerLayout.auto, infoF.layout);
336336 try testing.expect(infoF.fields.len == 0);
337337 try testing.expectEqual(@as(bool, false), infoF.is_tuple);
338338
339339 // empty tuple
340340 const G = @Type(@typeInfo(@TypeOf(.{})));
341341 const infoG = @typeInfo(G).Struct;
342 try testing.expectEqual(Type.ContainerLayout.Auto, infoG.layout);
342 try testing.expectEqual(Type.ContainerLayout.auto, infoG.layout);
343343 try testing.expect(infoG.fields.len == 0);
344344 try testing.expectEqual(@as(bool, true), infoG.is_tuple);
345345}
......@@ -386,7 +386,7 @@ test "Type.Union" {
386386
387387 const Untagged = @Type(.{
388388 .Union = .{
389 .layout = .Extern,
389 .layout = .@"extern",
390390 .tag_type = null,
391391 .fields = &.{
392392 .{ .name = "int", .type = i32, .alignment = @alignOf(f32) },
......@@ -402,7 +402,7 @@ test "Type.Union" {
402402
403403 const PackedUntagged = @Type(.{
404404 .Union = .{
405 .layout = .Packed,
405 .layout = .@"packed",
406406 .tag_type = null,
407407 .fields = &.{
408408 .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
......@@ -429,7 +429,7 @@ test "Type.Union" {
429429 });
430430 const Tagged = @Type(.{
431431 .Union = .{
432 .layout = .Auto,
432 .layout = .auto,
433433 .tag_type = Tag,
434434 .fields = &.{
435435 .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
......@@ -457,7 +457,7 @@ test "Type.Union from Type.Enum" {
457457 });
458458 const T = @Type(.{
459459 .Union = .{
460 .layout = .Auto,
460 .layout = .auto,
461461 .tag_type = Tag,
462462 .fields = &.{
463463 .{ .name = "working_as_expected", .type = u32, .alignment = @alignOf(u32) },
......@@ -472,7 +472,7 @@ test "Type.Union from regular enum" {
472472 const E = enum { working_as_expected };
473473 const T = @Type(.{
474474 .Union = .{
475 .layout = .Auto,
475 .layout = .auto,
476476 .tag_type = E,
477477 .fields = &.{
478478 .{ .name = "working_as_expected", .type = u32, .alignment = @alignOf(u32) },
......@@ -487,7 +487,7 @@ test "Type.Union from empty regular enum" {
487487 const E = enum {};
488488 const U = @Type(.{
489489 .Union = .{
490 .layout = .Auto,
490 .layout = .auto,
491491 .tag_type = E,
492492 .fields = &.{},
493493 .decls = &.{},
......@@ -507,7 +507,7 @@ test "Type.Union from empty Type.Enum" {
507507 });
508508 const U = @Type(.{
509509 .Union = .{
510 .layout = .Auto,
510 .layout = .auto,
511511 .tag_type = E,
512512 .fields = &.{},
513513 .decls = &.{},
......@@ -553,7 +553,7 @@ test "reified struct field name from optional payload" {
553553 const m_name: ?[1:0]u8 = "a".*;
554554 if (m_name) |*name| {
555555 const T = @Type(.{ .Struct = .{
556 .layout = .Auto,
556 .layout = .auto,
557557 .fields = &.{.{
558558 .name = name,
559559 .type = u8,
......@@ -575,7 +575,7 @@ test "reified union uses @alignOf" {
575575 fn CreateUnion(comptime T: type) type {
576576 return @Type(.{
577577 .Union = .{
578 .layout = .Auto,
578 .layout = .auto,
579579 .tag_type = null,
580580 .fields = &[_]std.builtin.Type.UnionField{
581581 .{
......@@ -597,7 +597,7 @@ test "reified struct uses @alignOf" {
597597 fn NamespacedGlobals(comptime modules: anytype) type {
598598 return @Type(.{
599599 .Struct = .{
600 .layout = .Auto,
600 .layout = .auto,
601601 .is_tuple = false,
602602 .fields = &.{
603603 .{
......@@ -659,7 +659,7 @@ test "empty struct assigned to reified struct field" {
659659 fn NamespacedComponents(comptime modules: anytype) type {
660660 return @Type(.{
661661 .Struct = .{
662 .layout = .Auto,
662 .layout = .auto,
663663 .is_tuple = false,
664664 .fields = &.{.{
665665 .name = "components",
......@@ -721,7 +721,7 @@ test "struct field names sliced at comptime from larger string" {
721721
722722 const T = @Type(.{
723723 .Struct = .{
724 .layout = .Auto,
724 .layout = .auto,
725725 .is_tuple = false,
726726 .fields = fields,
727727 .decls = &.{},
test/behavior/type_info.zig+4-4
......@@ -250,7 +250,7 @@ test "type info: union info" {
250250fn testUnion() !void {
251251 const typeinfo_info = @typeInfo(Type);
252252 try expect(typeinfo_info == .Union);
253 try expect(typeinfo_info.Union.layout == .Auto);
253 try expect(typeinfo_info.Union.layout == .auto);
254254 try expect(typeinfo_info.Union.tag_type.? == TypeId);
255255 try expect(typeinfo_info.Union.fields.len == 24);
256256 try expect(typeinfo_info.Union.fields[4].type == @TypeOf(@typeInfo(u8).Int));
......@@ -264,7 +264,7 @@ fn testUnion() !void {
264264 const notag_union_info = @typeInfo(TestNoTagUnion);
265265 try expect(notag_union_info == .Union);
266266 try expect(notag_union_info.Union.tag_type == null);
267 try expect(notag_union_info.Union.layout == .Auto);
267 try expect(notag_union_info.Union.layout == .auto);
268268 try expect(notag_union_info.Union.fields.len == 2);
269269 try expect(notag_union_info.Union.fields[0].alignment == @alignOf(void));
270270 try expect(notag_union_info.Union.fields[1].type == u32);
......@@ -275,7 +275,7 @@ fn testUnion() !void {
275275 };
276276
277277 const extern_union_info = @typeInfo(TestExternUnion);
278 try expect(extern_union_info.Union.layout == .Extern);
278 try expect(extern_union_info.Union.layout == .@"extern");
279279 try expect(extern_union_info.Union.tag_type == null);
280280 try expect(extern_union_info.Union.fields[0].type == *anyopaque);
281281}
......@@ -310,7 +310,7 @@ fn testPackedStruct() !void {
310310 const struct_info = @typeInfo(TestPackedStruct);
311311 try expect(struct_info == .Struct);
312312 try expect(struct_info.Struct.is_tuple == false);
313 try expect(struct_info.Struct.layout == .Packed);
313 try expect(struct_info.Struct.layout == .@"packed");
314314 try expect(struct_info.Struct.backing_integer == u128);
315315 try expect(struct_info.Struct.fields.len == 4);
316316 try expect(struct_info.Struct.fields[0].alignment == 0);
test/cases/compile_errors/atomic_orderings_of_atomicStore_Acquire_or_AcqRel.zig+2-2
......@@ -1,10 +1,10 @@
11export fn entry() void {
22 var x: u32 = 0;
3 @atomicStore(u32, &x, 1, .Acquire);
3 @atomicStore(u32, &x, 1, .acquire);
44}
55
66// error
77// backend=stage2
88// target=native
99//
10// :3:31: error: @atomicStore atomic ordering must not be Acquire or AcqRel
10// :3:31: error: @atomicStore atomic ordering must not be acquire or acq_rel
test/cases/compile_errors/atomic_orderings_of_cmpxchg-failure_stricter_than_success.zig+1-1
......@@ -1,7 +1,7 @@
11const AtomicOrder = @import("std").builtin.AtomicOrder;
22export fn f() void {
33 var x: i32 = 1234;
4 while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {}
4 while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.monotonic, AtomicOrder.seq_cst)) {}
55}
66
77// error
test/cases/compile_errors/atomic_orderings_of_cmpxchg-success_Monotonic_or_stricter.zig+2-2
......@@ -1,11 +1,11 @@
11const AtomicOrder = @import("std").builtin.AtomicOrder;
22export fn f() void {
33 var x: i32 = 1234;
4 while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {}
4 while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.unordered, AtomicOrder.unordered)) {}
55}
66
77// error
88// backend=stage2
99// target=native
1010//
11// :4:58: error: success atomic ordering must be Monotonic or stricter
11// :4:58: error: success atomic ordering must be monotonic or stricter
test/cases/compile_errors/atomic_orderings_of_fence_Acquire_or_stricter.zig+2-2
......@@ -1,9 +1,9 @@
11export fn entry() void {
2 @fence(.Monotonic);
2 @fence(.monotonic);
33}
44
55// error
66// backend=stage2
77// target=native
88//
9// :2:13: error: atomic ordering must be Acquire or stricter
9// :2:13: error: atomic ordering must be acquire or stricter
test/cases/compile_errors/atomicrmw_with_bool_op_not_.Xchg.zig+1-1
......@@ -1,6 +1,6 @@
11export fn entry() void {
22 var x = false;
3 _ = @atomicRmw(bool, &x, .Add, true, .SeqCst);
3 _ = @atomicRmw(bool, &x, .Add, true, .seq_cst);
44}
55
66// error
test/cases/compile_errors/atomicrmw_with_enum_op_not_.Xchg.zig+1-1
......@@ -6,7 +6,7 @@ export fn entry() void {
66 d,
77 };
88 var x: E = .a;
9 _ = @atomicRmw(E, &x, .Add, .b, .SeqCst);
9 _ = @atomicRmw(E, &x, .Add, .b, .seq_cst);
1010}
1111
1212// error
test/cases/compile_errors/atomicrmw_with_float_op_not_.Xchg_.Add_.Sub_.Max_or_.Min.zig+1-1
......@@ -1,6 +1,6 @@
11export fn entry() void {
22 var x: f32 = 0;
3 _ = @atomicRmw(f32, &x, .And, 2, .SeqCst);
3 _ = @atomicRmw(f32, &x, .And, 2, .seq_cst);
44}
55
66// error
test/cases/compile_errors/cmpxchg_with_float.zig+1-1
......@@ -1,6 +1,6 @@
11export fn entry() void {
22 var x: f32 = 0;
3 _ = @cmpxchgWeak(f32, &x, 1, 2, .SeqCst, .SeqCst);
3 _ = @cmpxchgWeak(f32, &x, 1, 2, .seq_cst, .seq_cst);
44}
55
66// error
test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig+1-1
......@@ -1,5 +1,5 @@
11export fn entry() void {
2 _ = @Type(.{ .Struct = .{ .layout = .Packed, .fields = &.{
2 _ = @Type(.{ .Struct = .{ .layout = .@"packed", .fields = &.{
33 .{ .name = "one", .type = u4, .default_value = null, .is_comptime = false, .alignment = 2 },
44 }, .decls = &.{}, .is_tuple = false } });
55}
test/cases/compile_errors/passing_a_not-aligned-enough_pointer_to_cmpxchg.zig+1-1
......@@ -1,7 +1,7 @@
11const AtomicOrder = @import("std").builtin.AtomicOrder;
22export fn entry() bool {
33 var x: i32 align(1) = 1234;
4 while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.SeqCst, AtomicOrder.SeqCst)) {}
4 while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.seq_cst, AtomicOrder.seq_cst)) {}
55 return x == 5678;
66}
77
test/cases/compile_errors/reify_struct.zig+5-5
......@@ -1,6 +1,6 @@
11comptime {
22 @Type(.{ .Struct = .{
3 .layout = .Auto,
3 .layout = .auto,
44 .fields = &.{.{
55 .name = "foo",
66 .type = u32,
......@@ -14,7 +14,7 @@ comptime {
1414}
1515comptime {
1616 @Type(.{ .Struct = .{
17 .layout = .Auto,
17 .layout = .auto,
1818 .fields = &.{.{
1919 .name = "3",
2020 .type = u32,
......@@ -28,7 +28,7 @@ comptime {
2828}
2929comptime {
3030 @Type(.{ .Struct = .{
31 .layout = .Auto,
31 .layout = .auto,
3232 .fields = &.{.{
3333 .name = "0",
3434 .type = u32,
......@@ -42,7 +42,7 @@ comptime {
4242}
4343comptime {
4444 @Type(.{ .Struct = .{
45 .layout = .Extern,
45 .layout = .@"extern",
4646 .fields = &.{.{
4747 .name = "0",
4848 .type = u32,
......@@ -56,7 +56,7 @@ comptime {
5656}
5757comptime {
5858 @Type(.{ .Struct = .{
59 .layout = .Packed,
59 .layout = .@"packed",
6060 .fields = &.{.{
6161 .name = "0",
6262 .type = u32,
test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig+1-1
......@@ -12,7 +12,7 @@ const Tag = @Type(.{
1212});
1313const Tagged = @Type(.{
1414 .Union = .{
15 .layout = .Auto,
15 .layout = .auto,
1616 .tag_type = Tag,
1717 .fields = &.{
1818 .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig+1-1
......@@ -11,7 +11,7 @@ const Tag = @Type(.{
1111});
1212const Tagged = @Type(.{
1313 .Union = .{
14 .layout = .Auto,
14 .layout = .auto,
1515 .tag_type = Tag,
1616 .fields = &.{
1717 .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
test/cases/compile_errors/reify_type_for_tagged_union_with_no_enum_fields.zig+1-1
......@@ -8,7 +8,7 @@ const Tag = @Type(.{
88});
99const Tagged = @Type(.{
1010 .Union = .{
11 .layout = .Auto,
11 .layout = .auto,
1212 .tag_type = Tag,
1313 .fields = &.{
1414 .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
test/cases/compile_errors/reify_type_for_tagged_union_with_no_union_fields.zig+1-1
......@@ -11,7 +11,7 @@ const Tag = @Type(.{
1111});
1212const Tagged = @Type(.{
1313 .Union = .{
14 .layout = .Auto,
14 .layout = .auto,
1515 .tag_type = Tag,
1616 .fields = &.{},
1717 .decls = &.{},
test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig+1-1
......@@ -1,6 +1,6 @@
11const Untagged = @Type(.{
22 .Union = .{
3 .layout = .Auto,
3 .layout = .auto,
44 .tag_type = null,
55 .fields = &.{
66 .{ .name = "foo", .type = opaque {}, .alignment = 1 },
test/cases/compile_errors/reify_type_with_invalid_field_alignment.zig+2-2
......@@ -1,7 +1,7 @@
11comptime {
22 _ = @Type(.{
33 .Union = .{
4 .layout = .Auto,
4 .layout = .auto,
55 .tag_type = null,
66 .fields = &.{
77 .{ .name = "foo", .type = usize, .alignment = 3 },
......@@ -13,7 +13,7 @@ comptime {
1313comptime {
1414 _ = @Type(.{
1515 .Struct = .{
16 .layout = .Auto,
16 .layout = .auto,
1717 .fields = &.{.{
1818 .name = "0",
1919 .type = u32,
test/cases/compile_errors/reify_type_with_undefined.zig+2-2
......@@ -7,7 +7,7 @@ comptime {
77 .fields = undefined,
88 .decls = undefined,
99 .is_tuple = false,
10 .layout = .Auto,
10 .layout = .auto,
1111 },
1212 });
1313}
......@@ -16,7 +16,7 @@ comptime {
1616 const fields: [1]std.builtin.Type.StructField = undefined;
1717 _ = @Type(.{
1818 .Struct = .{
19 .layout = .Auto,
19 .layout = .auto,
2020 .fields = &fields,
2121 .decls = &.{},
2222 .is_tuple = false,
test/link/elf.zig+2-2
......@@ -799,8 +799,8 @@ fn testEmitStaticLib(b: *Build, opts: Options) *Step {
799799 \\}
800800 \\export var strongBar: usize = 100;
801801 \\comptime {
802 \\ @export(weakFoo, .{ .name = "weakFoo", .linkage = .Weak });
803 \\ @export(strongBar, .{ .name = "strongBarAlias", .linkage = .Strong });
802 \\ @export(weakFoo, .{ .name = "weakFoo", .linkage = .weak });
803 \\ @export(strongBar, .{ .name = "strongBarAlias", .linkage = .strong });
804804 \\}
805805 ,
806806 });
test/link/macho.zig+1-1
......@@ -1153,7 +1153,7 @@ fn testReexportsZig(b: *Build, opts: Options) *Step {
11531153 \\ return x;
11541154 \\}
11551155 \\comptime {
1156 \\ @export(foo, .{ .name = "bar", .linkage = .Strong });
1156 \\ @export(foo, .{ .name = "bar", .linkage = .strong });
11571157 \\}
11581158 });
11591159
test/standalone/global_linkage/obj1.zig+2-2
......@@ -2,6 +2,6 @@ var internal_integer: usize = 1;
22var obj1_integer: usize = 421;
33
44comptime {
5 @export(internal_integer, .{ .name = "internal_integer", .linkage = .Internal });
6 @export(obj1_integer, .{ .name = "obj1_integer", .linkage = .Strong });
5 @export(internal_integer, .{ .name = "internal_integer", .linkage = .internal });
6 @export(obj1_integer, .{ .name = "obj1_integer", .linkage = .strong });
77}
test/standalone/global_linkage/obj2.zig+2-2
......@@ -2,6 +2,6 @@ var internal_integer: usize = 2;
22var obj2_integer: usize = 422;
33
44comptime {
5 @export(internal_integer, .{ .name = "internal_integer", .linkage = .Internal });
6 @export(obj2_integer, .{ .name = "obj2_integer", .linkage = .Strong });
5 @export(internal_integer, .{ .name = "internal_integer", .linkage = .internal });
6 @export(obj2_integer, .{ .name = "obj2_integer", .linkage = .strong });
77}
tools/docgen.zig+3-3
......@@ -629,7 +629,7 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc {
629629 } else if (mem.eql(u8, end_tag_name, "link_libc")) {
630630 link_libc = true;
631631 } else if (mem.eql(u8, end_tag_name, "link_mode_dynamic")) {
632 link_mode = .Dynamic;
632 link_mode = .dynamic;
633633 } else if (mem.eql(u8, end_tag_name, "additonal_option")) {
634634 _ = try eatToken(tokenizer, .separator);
635635 const option = try eatToken(tokenizer, .tag_content);
......@@ -1793,11 +1793,11 @@ fn genHtml(
17931793 }
17941794 if (code.link_mode) |link_mode| {
17951795 switch (link_mode) {
1796 .Static => {
1796 .static => {
17971797 try test_args.append("-static");
17981798 try shell_out.print("-static ", .{});
17991799 },
1800 .Dynamic => {
1800 .dynamic => {
18011801 try test_args.append("-dynamic");
18021802 try shell_out.print("-dynamic ", .{});
18031803 },