From aa52bb83271edc626cd931cf9e8dfbcfc90d4cf2 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 7 Jul 2025 11:38:15 -0700 Subject: [PATCH] zig fmt --- lib/std/Build/Module.zig | 2 +- lib/std/Target.zig | 2 +- lib/std/builtin.zig | 4 ++-- lib/std/zig/llvm/Builder.zig | 4 ++-- src/Compilation.zig | 2 +- src/Sema.zig | 2 +- src/Type.zig | 2 +- src/Zcu.zig | 2 +- src/codegen/llvm.zig | 10 +++++----- src/libs/libcxx.zig | 2 +- src/libs/libtsan.zig | 2 +- src/libs/libunwind.zig | 2 +- src/libs/mingw.zig | 2 +- src/link/Dwarf.zig | 2 +- src/main.zig | 12 ++++++------ src/target.zig | 12 ++++++------ test/standalone/stack_iterator/build.zig | 6 +++--- 17 files changed, 35 insertions(+), 35 deletions(-) diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig index d9c098113f..cc57aeb521 100644 --- a/lib/std/Build/Module.zig +++ b/lib/std/Build/Module.zig @@ -572,7 +572,7 @@ pub fn appendZigProcessFlags( try zig_args.append(switch (unwind_tables) { .none => "-fno-unwind-tables", .sync => "-funwind-tables", - .@"async" => "-fasync-unwind-tables", + .async => "-fasync-unwind-tables", }); } diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 18d37e6bf6..c3b37abb7e 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -1691,7 +1691,7 @@ pub const Cpu = struct { pub fn fromCallingConvention(cc: std.builtin.CallingConvention.Tag) []const Arch { return switch (cc) { .auto, - .@"async", + .async, .naked, .@"inline", => unreachable, diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 527fc141c6..548b308cad 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -246,7 +246,7 @@ pub const CallingConvention = union(enum(u8)) { /// The calling convention of a function that can be called with `async` syntax. An `async` call /// of a runtime-known function must target a function with this calling convention. /// Comptime-known functions with other calling conventions may be coerced to this one. - @"async", + async, /// Functions with this calling convention have no prologue or epilogue, making the function /// uncallable in regular Zig code. This can be useful when integrating with assembly. @@ -849,7 +849,7 @@ pub const LinkMode = enum { pub const UnwindTables = enum { none, sync, - @"async", + async, }; /// This data structure is used by the Zig language code generation and diff --git a/lib/std/zig/llvm/Builder.zig b/lib/std/zig/llvm/Builder.zig index ff661aa1c7..0e25af08c6 100644 --- a/lib/std/zig/llvm/Builder.zig +++ b/lib/std/zig/llvm/Builder.zig @@ -1521,9 +1521,9 @@ pub const Attribute = union(Kind) { pub const UwTable = enum(u32) { none, sync, - @"async", + async, - pub const default = UwTable.@"async"; + pub const default = UwTable.async; }; pub const VScaleRange = packed struct(u32) { diff --git a/src/Compilation.zig b/src/Compilation.zig index c954fc76bc..c85fb9608e 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -6466,7 +6466,7 @@ pub fn addCCArgs( try argv.append("-fno-asynchronous-unwind-tables"); try argv.append("-funwind-tables"); }, - .@"async" => try argv.append("-fasynchronous-unwind-tables"), + .async => try argv.append("-fasynchronous-unwind-tables"), } try argv.append("-nostdinc"); diff --git a/src/Sema.zig b/src/Sema.zig index bcb5dbe085..118e3da5a2 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -26687,7 +26687,7 @@ fn explainWhyTypeIsNotExtern( } switch (ty.fnCallingConvention(zcu)) { .auto => try sema.errNote(src_loc, msg, "extern function must specify calling convention", .{}), - .@"async" => try sema.errNote(src_loc, msg, "async function cannot be extern", .{}), + .async => try sema.errNote(src_loc, msg, "async function cannot be extern", .{}), .@"inline" => try sema.errNote(src_loc, msg, "inline function cannot be extern", .{}), else => return, } diff --git a/src/Type.zig b/src/Type.zig index 219ef4a383..333e738b05 100644 --- a/src/Type.zig +++ b/src/Type.zig @@ -382,7 +382,7 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error } } switch (fn_info.cc) { - .auto, .@"async", .naked, .@"inline" => try writer.print("callconv(.{}) ", .{std.zig.fmtId(@tagName(fn_info.cc))}), + .auto, .async, .naked, .@"inline" => try writer.print("callconv(.{}) ", .{std.zig.fmtId(@tagName(fn_info.cc))}), else => try writer.print("callconv({any}) ", .{fn_info.cc}), } } diff --git a/src/Zcu.zig b/src/Zcu.zig index 24e7213753..5ba12056fd 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -4453,7 +4453,7 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.builtin.CallingConvention) union(enu const backend = target_util.zigBackend(target, zcu.comp.config.use_llvm); switch (cc) { .auto, .@"inline" => return .ok, - .@"async" => return .{ .bad_backend = backend }, // nothing supports async currently + .async => return .{ .bad_backend = backend }, // nothing supports async currently .naked => {}, // depends only on backend else => for (cc.archs()) |allowed_arch| { if (allowed_arch == target.cpu.arch) break; diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index d2d6f431d7..827c6b796d 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -2758,7 +2758,7 @@ pub const Object = struct { llvm_arg_i += 1; } - if (fn_info.cc == .@"async") { + if (fn_info.cc == .async) { @panic("TODO: LLVM backend lower async function"); } @@ -2910,7 +2910,7 @@ pub const Object = struct { try attributes.addFnAttr(.nounwind, &o.builder); if (owner_mod.unwind_tables != .none) { try attributes.addFnAttr( - .{ .uwtable = if (owner_mod.unwind_tables == .@"async") .@"async" else .sync }, + .{ .uwtable = if (owner_mod.unwind_tables == .async) .async else .sync }, &o.builder, ); } @@ -11871,7 +11871,7 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const s } return switch (cc_tag) { .@"inline" => unreachable, - .auto, .@"async" => .fastcc, + .auto, .async => .fastcc, .naked => .ccc, .x86_64_sysv => .x86_64_sysvcc, .x86_64_win => .win64cc, @@ -12379,7 +12379,7 @@ const ParamTypeIterator = struct { return .byval; } }, - .@"async" => { + .async => { @panic("TODO implement async function lowering in the LLVM backend"); }, .x86_64_sysv => return it.nextSystemV(ty), @@ -12634,7 +12634,7 @@ fn ccAbiPromoteInt( ) ?std.builtin.Signedness { const target = zcu.getTarget(); switch (cc) { - .auto, .@"inline", .@"async" => return null, + .auto, .@"inline", .async => return null, else => {}, } const int_info = switch (ty.zigTypeTag(zcu)) { diff --git a/src/libs/libcxx.zig b/src/libs/libcxx.zig index f26f27732b..eebbb9cb73 100644 --- a/src/libs/libcxx.zig +++ b/src/libs/libcxx.zig @@ -325,7 +325,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr // See the `-fno-exceptions` logic for WASI. // The old 32-bit x86 variant of SEH doesn't use tables. const unwind_tables: std.builtin.UnwindTables = - if (target.os.tag == .wasi or (target.cpu.arch == .x86 and target.os.tag == .windows)) .none else .@"async"; + if (target.os.tag == .wasi or (target.cpu.arch == .x86 and target.os.tag == .windows)) .none else .async; const config = Compilation.Config.resolve(.{ .output_mode = output_mode, diff --git a/src/libs/libtsan.zig b/src/libs/libtsan.zig index 36ca5faa25..de5a770e30 100644 --- a/src/libs/libtsan.zig +++ b/src/libs/libtsan.zig @@ -48,7 +48,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo const optimize_mode = comp.compilerRtOptMode(); const strip = comp.compilerRtStrip(); const unwind_tables: std.builtin.UnwindTables = - if (target.cpu.arch == .x86 and target.os.tag == .windows) .none else .@"async"; + if (target.cpu.arch == .x86 and target.os.tag == .windows) .none else .async; const link_libcpp = target.os.tag.isDarwin(); const config = Compilation.Config.resolve(.{ diff --git a/src/libs/libunwind.zig b/src/libs/libunwind.zig index 430ff59748..71cc6ccbc0 100644 --- a/src/libs/libunwind.zig +++ b/src/libs/libunwind.zig @@ -29,7 +29,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr const output_mode = .Lib; const target = &comp.root_mod.resolved_target.result; const unwind_tables: std.builtin.UnwindTables = - if (target.cpu.arch == .x86 and target.os.tag == .windows) .none else .@"async"; + if (target.cpu.arch == .x86 and target.os.tag == .windows) .none else .async; const config = Compilation.Config.resolve(.{ .output_mode = output_mode, .resolved_target = comp.root_mod.resolved_target, diff --git a/src/libs/mingw.zig b/src/libs/mingw.zig index c5713b2ff7..00ab86e31f 100644 --- a/src/libs/mingw.zig +++ b/src/libs/mingw.zig @@ -29,7 +29,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre const target = comp.getTarget(); // The old 32-bit x86 variant of SEH doesn't use tables. - const unwind_tables: std.builtin.UnwindTables = if (target.cpu.arch != .x86) .@"async" else .none; + const unwind_tables: std.builtin.UnwindTables = if (target.cpu.arch != .x86) .async else .none; switch (crt_file) { .crt2_o => { diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig index 605d1d23a4..8bdc54fcf0 100644 --- a/src/link/Dwarf.zig +++ b/src/link/Dwarf.zig @@ -3596,7 +3596,7 @@ fn updateLazyType( // For better or worse, we try to match what Clang emits. break :cc switch (func_type.cc) { .@"inline" => .nocall, - .@"async", .auto, .naked => .normal, + .async, .auto, .naked => .normal, .x86_64_sysv => .LLVM_X86_64SysV, .x86_64_win => .LLVM_Win64, .x86_64_regcall_v3_sysv => .LLVM_X86RegCall, diff --git a/src/main.zig b/src/main.zig index aa20b8fae1..f3e8eb9634 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1416,7 +1416,7 @@ fn buildOutputType( } else if (mem.eql(u8, arg, "-funwind-tables")) { mod_opts.unwind_tables = .sync; } else if (mem.eql(u8, arg, "-fasync-unwind-tables")) { - mod_opts.unwind_tables = .@"async"; + mod_opts.unwind_tables = .async; } else if (mem.eql(u8, arg, "-fno-unwind-tables")) { mod_opts.unwind_tables = .none; } else if (mem.eql(u8, arg, "-fstack-check")) { @@ -2035,15 +2035,15 @@ fn buildOutputType( .none => { mod_opts.unwind_tables = .sync; }, - .sync, .@"async" => {}, + .sync, .async => {}, } else { mod_opts.unwind_tables = .sync; }, .no_unwind_tables => mod_opts.unwind_tables = .none, - .asynchronous_unwind_tables => mod_opts.unwind_tables = .@"async", + .asynchronous_unwind_tables => mod_opts.unwind_tables = .async, .no_asynchronous_unwind_tables => if (mod_opts.unwind_tables) |uwt| switch (uwt) { .none, .sync => {}, - .@"async" => { + .async => { mod_opts.unwind_tables = .sync; }, } else { @@ -2951,7 +2951,7 @@ fn buildOutputType( create_module.opts.any_fuzz = true; if (mod_opts.unwind_tables) |uwt| switch (uwt) { .none => {}, - .sync, .@"async" => create_module.opts.any_unwind_tables = true, + .sync, .async => create_module.opts.any_unwind_tables = true, }; if (mod_opts.strip == false) create_module.opts.any_non_stripped = true; @@ -7413,7 +7413,7 @@ fn handleModArg( create_module.opts.any_fuzz = true; if (mod_opts.unwind_tables) |uwt| switch (uwt) { .none => {}, - .sync, .@"async" => create_module.opts.any_unwind_tables = true, + .sync, .async => create_module.opts.any_unwind_tables = true, }; if (mod_opts.strip == false) create_module.opts.any_non_stripped = true; diff --git a/src/target.zig b/src/target.zig index 7852dda7a4..8c33a26939 100644 --- a/src/target.zig +++ b/src/target.zig @@ -483,12 +483,12 @@ pub fn clangSupportsNoImplicitFloatArg(target: *const std.Target) bool { pub fn defaultUnwindTables(target: *const std.Target, libunwind: bool, libtsan: bool) std.builtin.UnwindTables { if (target.os.tag == .windows) { // The old 32-bit x86 variant of SEH doesn't use tables. - return if (target.cpu.arch != .x86) .@"async" else .none; + return if (target.cpu.arch != .x86) .async else .none; } - if (target.os.tag.isDarwin()) return .@"async"; - if (libunwind) return .@"async"; - if (libtsan) return .@"async"; - if (std.debug.Dwarf.abi.supportsUnwinding(target)) return .@"async"; + if (target.os.tag.isDarwin()) return .async; + if (libunwind) return .async; + if (libtsan) return .async; + if (std.debug.Dwarf.abi.supportsUnwinding(target)) return .async; return .none; } @@ -815,7 +815,7 @@ pub fn compilerRtIntAbbrev(bits: u16) []const u8 { pub fn fnCallConvAllowsZigTypes(cc: std.builtin.CallingConvention) bool { return switch (cc) { - .auto, .@"async", .@"inline" => true, + .auto, .async, .@"inline" => true, // For now we want to authorize PTX kernel to use zig objects, even if // we end up exposing the ABI. The goal is to experiment with more // integrated CPU/GPU code. diff --git a/test/standalone/stack_iterator/build.zig b/test/standalone/stack_iterator/build.zig index ee69f33d2e..a036a64ab7 100644 --- a/test/standalone/stack_iterator/build.zig +++ b/test/standalone/stack_iterator/build.zig @@ -29,7 +29,7 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("unwind.zig"), .target = target, .optimize = optimize, - .unwind_tables = if (target.result.os.tag.isDarwin()) .@"async" else null, + .unwind_tables = if (target.result.os.tag.isDarwin()) .async else null, .omit_frame_pointer = false, }), }); @@ -54,7 +54,7 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("unwind.zig"), .target = target, .optimize = optimize, - .unwind_tables = .@"async", + .unwind_tables = .async, .omit_frame_pointer = true, }), // self-hosted lacks omit_frame_pointer support @@ -101,7 +101,7 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("shared_lib_unwind.zig"), .target = target, .optimize = optimize, - .unwind_tables = if (target.result.os.tag.isDarwin()) .@"async" else null, + .unwind_tables = if (target.result.os.tag.isDarwin()) .async else null, .omit_frame_pointer = true, }), // zig objcopy doesn't support incremental binaries