diff --git a/lib/std/c/freebsd.zig b/lib/std/c/freebsd.zig index 7a4b9bf2f8..3afe4e28ad 100644 --- a/lib/std/c/freebsd.zig +++ b/lib/std/c/freebsd.zig @@ -261,7 +261,7 @@ pub const Flock = extern struct { /// Lock owner. pid: pid_t, /// Lock type. - @"type": i16, + type: i16, /// Type of the start member. whence: i16, /// Remote system id or zero for local. @@ -438,7 +438,7 @@ pub const kinfo_file = extern struct { /// A zero value is for the sentinel record at the end of an array. structsize: c_int, /// Descriptor type. - @"type": c_int, + type: c_int, /// Array index. fd: fd_t, /// Reference count. @@ -456,7 +456,7 @@ pub const kinfo_file = extern struct { /// Socket domain. domain: c_int, /// Socket type. - @"type": c_int, + type: c_int, /// Socket protocol. protocol: c_int, /// Socket address. @@ -478,7 +478,7 @@ pub const kinfo_file = extern struct { }, file: extern struct { /// Vnode type. - @"type": i32, + type: i32, // Reserved for future use _spare1: [3]i32, _spare2: [30]u64, diff --git a/lib/std/c/solaris.zig b/lib/std/c/solaris.zig index d45365a2b6..26244b01c9 100644 --- a/lib/std/c/solaris.zig +++ b/lib/std/c/solaris.zig @@ -24,20 +24,20 @@ pub const pthread_mutex_t = extern struct { flag1: u16 = 0, flag2: u8 = 0, ceiling: u8 = 0, - @"type": u16 = 0, + type: u16 = 0, magic: u16 = 0x4d58, lock: u64 = 0, data: u64 = 0, }; pub const pthread_cond_t = extern struct { flag: [4]u8 = [_]u8{0} ** 4, - @"type": u16 = 0, + type: u16 = 0, magic: u16 = 0x4356, data: u64 = 0, }; pub const pthread_rwlock_t = extern struct { readers: i32 = 0, - @"type": u16 = 0, + type: u16 = 0, magic: u16 = 0x5257, mutex: pthread_mutex_t = .{}, readercv: pthread_cond_t = .{}, @@ -50,7 +50,7 @@ pub const pthread_key_t = c_int; pub const sem_t = extern struct { count: u32 = 0, - @"type": u16 = 0, + type: u16 = 0, magic: u16 = 0x534d, __pad1: [3]u64 = [_]u64{0} ** 3, __pad2: [2]u64 = [_]u64{0} ** 2, @@ -1683,7 +1683,7 @@ pub const _SC = struct { pub const procfs = struct { pub const misc_header = extern struct { size: u32, - @"type": enum(u32) { + type: enum(u32) { Pathname, Socketname, Peersockname, @@ -1851,7 +1851,7 @@ pub const lifreq = extern struct { ppa: u32, }, /// One of the IFT types, e.g. IFT_ETHER. - @"type": u32, + type: u32, ifru: extern union { /// Address. addr: sockaddr.storage, diff --git a/lib/std/coff.zig b/lib/std/coff.zig index 6b300276e9..4cfef0a0b3 100644 --- a/lib/std/coff.zig +++ b/lib/std/coff.zig @@ -324,7 +324,7 @@ pub const BaseRelocation = packed struct { offset: u12, /// Stored in the high 4 bits of the WORD, a value that indicates the type of base relocation to be applied. - @"type": BaseRelocationType, + type: BaseRelocationType, }; pub const BaseRelocationType = enum(u4) { @@ -393,7 +393,7 @@ pub const DebugDirectoryEntry = extern struct { time_date_stamp: u32, major_version: u16, minor_version: u16, - @"type": DebugType, + type: DebugType, size_of_data: u32, address_of_raw_data: u32, pointer_to_raw_data: u32, @@ -650,7 +650,7 @@ pub const Symbol = struct { name: [8]u8, value: u32, section_number: SectionNumber, - @"type": SymType, + type: SymType, storage_class: StorageClass, number_of_aux_symbols: u8, @@ -1309,7 +1309,7 @@ pub const Symtab = struct { .name = raw[0..8].*, .value = mem.readIntLittle(u32, raw[8..12]), .section_number = @intToEnum(SectionNumber, mem.readIntLittle(u16, raw[12..14])), - .@"type" = @bitCast(SymType, mem.readIntLittle(u16, raw[14..16])), + .type = @bitCast(SymType, mem.readIntLittle(u16, raw[14..16])), .storage_class = @intToEnum(StorageClass, raw[16]), .number_of_aux_symbols = raw[17], }; diff --git a/lib/std/elf.zig b/lib/std/elf.zig index 74eb181867..2eb89e810a 100644 --- a/lib/std/elf.zig +++ b/lib/std/elf.zig @@ -835,7 +835,7 @@ pub const Elf32_RegInfo = extern struct { pub const Elf_Options = extern struct { kind: u8, size: u8, - @"section": Elf32_Section, + section: Elf32_Section, info: Elf32_Word, }; pub const Elf_Options_Hw = extern struct { diff --git a/lib/std/fs/wasi.zig b/lib/std/fs/wasi.zig index ca766bbd29..2051215dfe 100644 --- a/lib/std/fs/wasi.zig +++ b/lib/std/fs/wasi.zig @@ -80,13 +80,13 @@ pub const Preopen = struct { fd: fd_t, /// Type of the preopen. - @"type": PreopenType, + type: PreopenType, /// Construct new `Preopen` instance. pub fn new(fd: fd_t, preopen_type: PreopenType) Preopen { return Preopen{ .fd = fd, - .@"type" = preopen_type, + .type = preopen_type, }; } }; @@ -125,7 +125,7 @@ pub const PreopenList = struct { /// Release all allocated memory. pub fn deinit(pm: Self) void { for (pm.buffer.items) |preopen| { - switch (preopen.@"type") { + switch (preopen.type) { PreopenType.Dir => |path| pm.buffer.allocator.free(path), } } @@ -161,7 +161,7 @@ pub const PreopenList = struct { // Clear contents if we're being called again for (self.toOwnedSlice()) |preopen| { - switch (preopen.@"type") { + switch (preopen.type) { PreopenType.Dir => |path| self.buffer.allocator.free(path), } } @@ -226,7 +226,7 @@ pub const PreopenList = struct { var best_match: ?PreopenUri = null; for (self.buffer.items) |preopen| { - if (preopen.@"type".getRelativePath(preopen_type)) |rel_path| { + if (preopen.type.getRelativePath(preopen_type)) |rel_path| { if (best_match == null or rel_path.len <= best_match.?.relative_path.len) { best_match = PreopenUri{ .base = preopen, @@ -253,7 +253,7 @@ pub const PreopenList = struct { /// Otherwise, return `null`. pub fn find(self: Self, preopen_type: PreopenType) ?*const Preopen { for (self.buffer.items) |*preopen| { - if (preopen.@"type".eql(preopen_type)) { + if (preopen.type.eql(preopen_type)) { return preopen; } } @@ -280,7 +280,7 @@ test "extracting WASI preopens" { try preopens.populate(null); const preopen = preopens.find(PreopenType{ .Dir = "." }) orelse unreachable; - try std.testing.expect(preopen.@"type".eql(PreopenType{ .Dir = "." })); + try std.testing.expect(preopen.type.eql(PreopenType{ .Dir = "." })); const po_type1 = PreopenType{ .Dir = "/" }; try std.testing.expect(std.mem.eql(u8, po_type1.getRelativePath(.{ .Dir = "/" }).?, "")); diff --git a/lib/std/macho.zig b/lib/std/macho.zig index 11b737a2b7..cb1fca20b2 100644 --- a/lib/std/macho.zig +++ b/lib/std/macho.zig @@ -700,7 +700,7 @@ pub const PROT = struct { /// The format of the relocation entries referenced by the reloff and nreloc /// fields of the section structure for mach object files is described in the /// header file . -pub const @"section" = extern struct { +pub const section = extern struct { /// name of this section sectname: [16]u8, @@ -794,12 +794,12 @@ pub const section_64 = extern struct { } pub fn isZerofill(sect: section_64) bool { - const tt = sect.@"type"(); + const tt = sect.type(); return tt == S_ZEROFILL or tt == S_GB_ZEROFILL or tt == S_THREAD_LOCAL_ZEROFILL; } pub fn isSymbolStubs(sect: section_64) bool { - const tt = sect.@"type"(); + const tt = sect.type(); return tt == S_SYMBOL_STUBS; } @@ -1804,7 +1804,7 @@ pub const CodeDirectory = extern struct { /// Structure of an embedded-signature SuperBlob pub const BlobIndex = extern struct { /// Type of entry - @"type": u32, + type: u32, /// Offset of entry offset: u32, diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index 115c1325ae..f7da87ed5f 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -3310,8 +3310,8 @@ pub const mmsghdr_const = extern struct { pub const epoll_data = extern union { ptr: usize, fd: i32, - @"u32": u32, - @"u64": u64, + u32: u32, + u64: u64, }; pub const epoll_event = switch (builtin.zig_backend) { @@ -5124,7 +5124,7 @@ pub const nlmsghdr = extern struct { len: u32, /// Message content - @"type": NetlinkMessageType, + type: NetlinkMessageType, /// Additional flags flags: u16, @@ -5141,7 +5141,7 @@ pub const ifinfomsg = extern struct { __pad1: u8 = 0, /// ARPHRD_* - @"type": c_ushort, + type: c_ushort, /// Link index index: c_int, @@ -5158,7 +5158,7 @@ pub const rtattr = extern struct { len: c_ushort, /// Type of option - @"type": IFLA, + type: IFLA, pub const ALIGNTO = 4; }; diff --git a/lib/std/os/linux/sparc64.zig b/lib/std/os/linux/sparc64.zig index bd9a5c16ea..948511cbe4 100644 --- a/lib/std/os/linux/sparc64.zig +++ b/lib/std/os/linux/sparc64.zig @@ -435,7 +435,7 @@ pub const fpu_t = extern struct { pub const mcontext_t = extern struct { gregs: gregset_t, fp: greg_t, - @"i7": greg_t, + i7: greg_t, fpregs: fpu_t, }; diff --git a/lib/std/os/wasi.zig b/lib/std/os/wasi.zig index db6b4c930c..308b6cc23d 100644 --- a/lib/std/os/wasi.zig +++ b/lib/std/os/wasi.zig @@ -279,7 +279,7 @@ pub const E = errno_t; pub const event_t = extern struct { userdata: userdata_t, @"error": errno_t, - @"type": eventtype_t, + type: eventtype_t, fd_readwrite: eventfdreadwrite_t, }; diff --git a/lib/std/zig/system/linux.zig b/lib/std/zig/system/linux.zig index ee1e987464..306ae34b23 100644 --- a/lib/std/zig/system/linux.zig +++ b/lib/std/zig/system/linux.zig @@ -84,20 +84,20 @@ const PowerpcCpuinfoImpl = struct { .{ "7410", &Target.powerpc.cpu.@"7400" }, .{ "7447", &Target.powerpc.cpu.@"7400" }, .{ "7455", &Target.powerpc.cpu.@"7450" }, - .{ "G4", &Target.powerpc.cpu.@"g4" }, + .{ "G4", &Target.powerpc.cpu.g4 }, .{ "POWER4", &Target.powerpc.cpu.@"970" }, .{ "PPC970FX", &Target.powerpc.cpu.@"970" }, .{ "PPC970MP", &Target.powerpc.cpu.@"970" }, - .{ "G5", &Target.powerpc.cpu.@"g5" }, - .{ "POWER5", &Target.powerpc.cpu.@"g5" }, - .{ "A2", &Target.powerpc.cpu.@"a2" }, - .{ "POWER6", &Target.powerpc.cpu.@"pwr6" }, - .{ "POWER7", &Target.powerpc.cpu.@"pwr7" }, - .{ "POWER8", &Target.powerpc.cpu.@"pwr8" }, - .{ "POWER8E", &Target.powerpc.cpu.@"pwr8" }, - .{ "POWER8NVL", &Target.powerpc.cpu.@"pwr8" }, - .{ "POWER9", &Target.powerpc.cpu.@"pwr9" }, - .{ "POWER10", &Target.powerpc.cpu.@"pwr10" }, + .{ "G5", &Target.powerpc.cpu.g5 }, + .{ "POWER5", &Target.powerpc.cpu.g5 }, + .{ "A2", &Target.powerpc.cpu.a2 }, + .{ "POWER6", &Target.powerpc.cpu.pwr6 }, + .{ "POWER7", &Target.powerpc.cpu.pwr7 }, + .{ "POWER8", &Target.powerpc.cpu.pwr8 }, + .{ "POWER8E", &Target.powerpc.cpu.pwr8 }, + .{ "POWER8NVL", &Target.powerpc.cpu.pwr8 }, + .{ "POWER9", &Target.powerpc.cpu.pwr9 }, + .{ "POWER10", &Target.powerpc.cpu.pwr10 }, }; fn line_hook(self: *PowerpcCpuinfoImpl, key: []const u8, value: []const u8) !bool { diff --git a/src/AstGen.zig b/src/AstGen.zig index b0200aad4c..7aeb4f6612 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -2868,7 +2868,7 @@ fn deferStmt( .name = ident_name, .inst = remapped_err_code_ref, .token_src = payload_token, - .id_cat = .@"capture", + .id_cat = .capture, }; try gz.addDbgVar(.dbg_var_val, ident_name, remapped_err_code_ref); break :blk &local_val_scope.base; @@ -5353,7 +5353,7 @@ fn orelseCatchExpr( } const err_name = try astgen.identAsString(payload); - try astgen.detectLocalShadowing(scope, err_name, payload, err_str, .@"capture"); + try astgen.detectLocalShadowing(scope, err_name, payload, err_str, .capture); err_val_scope = .{ .parent = &else_scope.base, @@ -5361,7 +5361,7 @@ fn orelseCatchExpr( .name = err_name, .inst = try else_scope.addUnNode(unwrap_code_op, operand, node), .token_src = payload, - .id_cat = .@"capture", + .id_cat = .capture, }; break :blk &err_val_scope.base; }; @@ -5698,14 +5698,14 @@ fn ifExpr( const token_name_str = tree.tokenSlice(token_name_index); if (mem.eql(u8, "_", token_name_str)) break :s &then_scope.base; - try astgen.detectLocalShadowing(&then_scope.base, ident_name, token_name_index, token_name_str, .@"capture"); + try astgen.detectLocalShadowing(&then_scope.base, ident_name, token_name_index, token_name_str, .capture); payload_val_scope = .{ .parent = &then_scope.base, .gen_zir = &then_scope, .name = ident_name, .inst = payload_inst, .token_src = payload_token, - .id_cat = .@"capture", + .id_cat = .capture, }; try then_scope.addDbgVar(.dbg_var_val, ident_name, payload_inst); break :s &payload_val_scope.base; @@ -5724,14 +5724,14 @@ fn ifExpr( break :s &then_scope.base; const payload_inst = try then_scope.addUnNode(tag, cond.inst, if_full.ast.then_expr); const ident_name = try astgen.identAsString(ident_token); - try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token, ident_bytes, .@"capture"); + try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token, ident_bytes, .capture); payload_val_scope = .{ .parent = &then_scope.base, .gen_zir = &then_scope, .name = ident_name, .inst = payload_inst, .token_src = ident_token, - .id_cat = .@"capture", + .id_cat = .capture, }; try then_scope.addDbgVar(.dbg_var_val, ident_name, payload_inst); break :s &payload_val_scope.base; @@ -5775,14 +5775,14 @@ fn ifExpr( const error_token_str = tree.tokenSlice(error_token); if (mem.eql(u8, "_", error_token_str)) break :s &else_scope.base; - try astgen.detectLocalShadowing(&else_scope.base, ident_name, error_token, error_token_str, .@"capture"); + try astgen.detectLocalShadowing(&else_scope.base, ident_name, error_token, error_token_str, .capture); payload_val_scope = .{ .parent = &else_scope.base, .gen_zir = &else_scope, .name = ident_name, .inst = payload_inst, .token_src = error_token, - .id_cat = .@"capture", + .id_cat = .capture, }; try else_scope.addDbgVar(.dbg_var_val, ident_name, payload_inst); break :s &payload_val_scope.base; @@ -6045,14 +6045,14 @@ fn whileExpr( break :s &then_scope.base; const payload_name_loc = payload_token + @boolToInt(payload_is_ref); const ident_name = try astgen.identAsString(payload_name_loc); - try astgen.detectLocalShadowing(&then_scope.base, ident_name, payload_name_loc, ident_bytes, .@"capture"); + try astgen.detectLocalShadowing(&then_scope.base, ident_name, payload_name_loc, ident_bytes, .capture); payload_val_scope = .{ .parent = &then_scope.base, .gen_zir = &then_scope, .name = ident_name, .inst = indexToRef(payload_inst), .token_src = payload_token, - .id_cat = .@"capture", + .id_cat = .capture, }; dbg_var_name = ident_name; dbg_var_inst = indexToRef(payload_inst); @@ -6073,14 +6073,14 @@ fn whileExpr( const ident_bytes = tree.tokenSlice(ident_token); if (mem.eql(u8, "_", ident_bytes)) break :s &then_scope.base; - try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token, ident_bytes, .@"capture"); + try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token, ident_bytes, .capture); payload_val_scope = .{ .parent = &then_scope.base, .gen_zir = &then_scope, .name = ident_name, .inst = indexToRef(payload_inst), .token_src = ident_token, - .id_cat = .@"capture", + .id_cat = .capture, }; dbg_var_name = ident_name; dbg_var_inst = indexToRef(payload_inst); @@ -6154,14 +6154,14 @@ fn whileExpr( const ident_bytes = tree.tokenSlice(error_token); if (mem.eql(u8, ident_bytes, "_")) break :s &else_scope.base; - try astgen.detectLocalShadowing(&else_scope.base, ident_name, error_token, ident_bytes, .@"capture"); + try astgen.detectLocalShadowing(&else_scope.base, ident_name, error_token, ident_bytes, .capture); payload_val_scope = .{ .parent = &else_scope.base, .gen_zir = &else_scope, .name = ident_name, .inst = else_payload_inst, .token_src = error_token, - .id_cat = .@"capture", + .id_cat = .capture, }; try else_scope.addDbgVar(.dbg_var_val, ident_name, else_payload_inst); break :s &payload_val_scope.base; @@ -6326,14 +6326,14 @@ fn forExpr( .lhs = array_ptr, .rhs = index, }); - try astgen.detectLocalShadowing(&then_scope.base, name_str_index, ident, value_name, .@"capture"); + try astgen.detectLocalShadowing(&then_scope.base, name_str_index, ident, value_name, .capture); payload_val_scope = .{ .parent = &then_scope.base, .gen_zir = &then_scope, .name = name_str_index, .inst = payload_inst, .token_src = ident, - .id_cat = .@"capture", + .id_cat = .capture, }; try then_scope.addDbgVar(.dbg_var_val, name_str_index, payload_inst); payload_sub_scope = &payload_val_scope.base; @@ -6672,14 +6672,14 @@ fn switchExpr( }); } const capture_name = try astgen.identAsString(ident); - try astgen.detectLocalShadowing(&case_scope.base, capture_name, ident, ident_slice, .@"capture"); + try astgen.detectLocalShadowing(&case_scope.base, capture_name, ident, ident_slice, .capture); capture_val_scope = .{ .parent = &case_scope.base, .gen_zir = &case_scope, .name = capture_name, .inst = indexToRef(capture_inst), .token_src = payload_token, - .id_cat = .@"capture", + .id_cat = .capture, }; dbg_var_name = capture_name; dbg_var_inst = indexToRef(capture_inst); @@ -10453,7 +10453,7 @@ const Scope = struct { @"local variable", @"loop index capture", @"switch tag capture", - @"capture", + capture, }; /// This is always a `const` local and importantly the `inst` is a value type, not a pointer. diff --git a/src/Autodoc.zig b/src/Autodoc.zig index 4d13416e1f..770a1d319d 100644 --- a/src/Autodoc.zig +++ b/src/Autodoc.zig @@ -660,8 +660,8 @@ const DocData = struct { comptimeExpr: usize, // index in `comptimeExprs` void: struct {}, @"unreachable": struct {}, - @"null": struct {}, - @"undefined": struct {}, + null: struct {}, + undefined: struct {}, @"struct": []FieldVal, bool: bool, @"anytype": struct {}, @@ -4217,7 +4217,7 @@ fn walkRef( ); }, .undef => { - return DocData.WalkResult{ .expr = .@"undefined" }; + return DocData.WalkResult{ .expr = .undefined }; }, .zero => { return DocData.WalkResult{ @@ -4245,7 +4245,7 @@ fn walkRef( }; }, .null_value => { - return DocData.WalkResult{ .expr = .@"null" }; + return DocData.WalkResult{ .expr = .null }; }, .bool_true => { return DocData.WalkResult{ diff --git a/src/InternPool.zig b/src/InternPool.zig index 95947df61b..5e50780315 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -168,9 +168,9 @@ pub const Simple = enum(u32) { null_type, undefined_type, enum_literal_type, - @"undefined", + undefined, void_value, - @"null", + null, bool_true, bool_false, }; diff --git a/src/Sema.zig b/src/Sema.zig index 64b4bf97db..3b362d83c4 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -1716,7 +1716,7 @@ fn analyzeAsType( src: LazySrcLoc, air_inst: Air.Inst.Ref, ) !Type { - const wanted_type = Type.initTag(.@"type"); + const wanted_type = Type.initTag(.type); const coerced_inst = try sema.coerce(block, wanted_type, air_inst, src); const val = try sema.resolveConstValue(block, src, coerced_inst, "types must be comptime-known"); var buffer: Value.ToTypeBuffer = undefined; @@ -2396,9 +2396,9 @@ fn coerceResultPtr( if (try sema.resolveDefinedValue(block, src, new_ptr)) |ptr_val| { return sema.addConstant(ptr_ty, ptr_val); } - if (pointee_ty.eql(Type.@"null", sema.mod)) { + if (pointee_ty.eql(Type.null, sema.mod)) { const opt_ty = sema.typeOf(new_ptr).childType(); - const null_inst = try sema.addConstant(opt_ty, Value.@"null"); + const null_inst = try sema.addConstant(opt_ty, Value.null); _ = try block.addBinOp(.store, new_ptr, null_inst); return Air.Inst.Ref.void_value; } @@ -2691,7 +2691,7 @@ fn zirEnumDecl( enum_obj.* = .{ .owner_decl = new_decl_index, - .tag_ty = Type.@"null", + .tag_ty = Type.null, .tag_ty_inferred = true, .fields = .{}, .values = .{}, @@ -2962,7 +2962,7 @@ fn zirUnionDecl( errdefer mod.abortAnonDecl(new_decl_index); union_obj.* = .{ .owner_decl = new_decl_index, - .tag_ty = Type.initTag(.@"null"), + .tag_ty = Type.initTag(.null), .fields = .{}, .zir_index = inst, .layout = small.layout, @@ -9885,7 +9885,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError .{}, ); } - else_error_ty = Type.@"anyerror"; + else_error_ty = Type.anyerror; } else else_validation: { var maybe_msg: ?*Module.ErrorMsg = null; errdefer if (maybe_msg) |msg| msg.destroy(sema.gpa); @@ -11558,7 +11558,7 @@ fn zirShl( }) else ov_bit; - const zero_ov = try sema.addConstant(Type.@"u1", Value.zero); + const zero_ov = try sema.addConstant(Type.u1, Value.zero); const no_ov = try block.addBinOp(.cmp_eq, any_ov_bit, zero_ov); try sema.addSafetyCheck(block, no_ov, .shl_overflow); @@ -13452,7 +13452,7 @@ fn zirOverflowArithmetic( const ov_ty = tuple_ty.tupleFields().types[1]; // TODO: Remove and use `ov_ty` instead. // This is a temporary type used until overflow arithmetic properly returns `u1` instead of `bool`. - const overflowed_ty = if (dest_ty.zigTypeTag() == .Vector) try Type.vector(sema.arena, dest_ty.vectorLen(), Type.@"bool") else Type.@"bool"; + const overflowed_ty = if (dest_ty.zigTypeTag() == .Vector) try Type.vector(sema.arena, dest_ty.vectorLen(), Type.bool) else Type.bool; const result: struct { /// TODO: Rename to `overflow_bit` and make of type `u1`. @@ -13615,7 +13615,7 @@ fn zirOverflowArithmetic( } fn overflowArithmeticTupleType(sema: *Sema, ty: Type) !Type { - const ov_ty = if (ty.zigTypeTag() == .Vector) try Type.vector(sema.arena, ty.vectorLen(), Type.@"u1") else Type.@"u1"; + const ov_ty = if (ty.zigTypeTag() == .Vector) try Type.vector(sema.arena, ty.vectorLen(), Type.u1) else Type.u1; const types = try sema.arena.alloc(Type, 2); const values = try sema.arena.alloc(Value, 2); @@ -14075,7 +14075,7 @@ fn analyzeArithmetic( }) else ov_bit; - const zero_ov = try sema.addConstant(Type.@"u1", Value.zero); + const zero_ov = try sema.addConstant(Type.u1, Value.zero); const no_ov = try block.addBinOp(.cmp_eq, any_ov_bit, zero_ov); try sema.addSafetyCheck(block, no_ov, .integer_overflow); @@ -14569,7 +14569,7 @@ fn cmpSelf( if (rhs_val.isUndef()) return sema.addConstUndef(Type.bool); if (resolved_type.zigTypeTag() == .Vector) { - const result_ty = try Type.vector(sema.arena, resolved_type.vectorLen(), Type.@"bool"); + const result_ty = try Type.vector(sema.arena, resolved_type.vectorLen(), Type.bool); const cmp_val = try sema.compareVector(lhs_val, op, rhs_val, resolved_type); return sema.addConstant(result_ty, cmp_val); } @@ -14600,7 +14600,7 @@ fn cmpSelf( }; try sema.requireRuntimeBlock(block, src, runtime_src); if (resolved_type.zigTypeTag() == .Vector) { - const result_ty = try Type.vector(sema.arena, resolved_type.vectorLen(), Type.@"bool"); + const result_ty = try Type.vector(sema.arena, resolved_type.vectorLen(), Type.bool); const result_ty_ref = try sema.addType(result_ty); return block.addCmpVector(casted_lhs, casted_rhs, op, result_ty_ref); } @@ -14932,63 +14932,63 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai type_info_ty, try Value.Tag.@"union".create(sema.arena, .{ .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Type)), - .val = Value.@"void", + .val = Value.void, }), ), .Void => return sema.addConstant( type_info_ty, try Value.Tag.@"union".create(sema.arena, .{ .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Void)), - .val = Value.@"void", + .val = Value.void, }), ), .Bool => return sema.addConstant( type_info_ty, try Value.Tag.@"union".create(sema.arena, .{ .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Bool)), - .val = Value.@"void", + .val = Value.void, }), ), .NoReturn => return sema.addConstant( type_info_ty, try Value.Tag.@"union".create(sema.arena, .{ .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.NoReturn)), - .val = Value.@"void", + .val = Value.void, }), ), .ComptimeFloat => return sema.addConstant( type_info_ty, try Value.Tag.@"union".create(sema.arena, .{ .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.ComptimeFloat)), - .val = Value.@"void", + .val = Value.void, }), ), .ComptimeInt => return sema.addConstant( type_info_ty, try Value.Tag.@"union".create(sema.arena, .{ .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.ComptimeInt)), - .val = Value.@"void", + .val = Value.void, }), ), .Undefined => return sema.addConstant( type_info_ty, try Value.Tag.@"union".create(sema.arena, .{ .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Undefined)), - .val = Value.@"void", + .val = Value.void, }), ), .Null => return sema.addConstant( type_info_ty, try Value.Tag.@"union".create(sema.arena, .{ .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Null)), - .val = Value.@"void", + .val = Value.void, }), ), .EnumLiteral => return sema.addConstant( type_info_ty, try Value.Tag.@"union".create(sema.arena, .{ .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.EnumLiteral)), - .val = Value.@"void", + .val = Value.void, }), ), .Fn => { @@ -15003,7 +15003,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai const param_ty = info.param_types[i]; const is_generic = param_ty.tag() == .generic_poison; const param_ty_val = if (is_generic) - Value.@"null" + Value.null else try Value.Tag.opt_payload.create( params_anon_decl.arena(), @@ -15015,7 +15015,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai // is_generic: bool, Value.makeBool(is_generic), // is_noalias: bool, - Value.@"false", // TODO + Value.false, // TODO // arg_type: ?type, param_ty_val, }; @@ -15068,7 +15068,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai try Value.Tag.ty.create(sema.arena, info.return_type), ) else - Value.@"null"; + Value.null; const field_values = try sema.arena.create([6]Value); field_values.* = .{ @@ -15287,7 +15287,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai .len = try Value.Tag.int_u64.create(sema.arena, vals.len), }); break :v try Value.Tag.opt_payload.create(sema.arena, slice_val); - } else Value.@"null"; + } else Value.null; // Construct Type{ .ErrorSet = errors_val } return sema.addConstant( @@ -15498,7 +15498,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai const enum_tag_ty_val = if (union_ty.unionTagType()) |tag_ty| v: { const ty_val = try Value.Tag.ty.create(sema.arena, tag_ty); break :v try Value.Tag.opt_payload.create(sema.arena, ty_val); - } else Value.@"null"; + } else Value.null; const field_values = try sema.arena.create([4]Value); field_values.* = .{ @@ -15848,7 +15848,7 @@ fn zirLog2IntType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError fn log2IntType(sema: *Sema, block: *Block, operand: Type, src: LazySrcLoc) CompileError!Type { switch (operand.zigTypeTag()) { - .ComptimeInt => return Type.@"comptime_int", + .ComptimeInt => return Type.comptime_int, .Int => { const bits = operand.bitSize(sema.mod.getTarget()); const count = if (bits == 0) @@ -17518,7 +17518,7 @@ fn getErrorReturnTrace(sema: *Sema, block: *Block) CompileError!Air.Inst.Ref { { return block.addTy(.err_return_trace, opt_ptr_stack_trace_ty); } - return sema.addConstant(opt_ptr_stack_trace_ty, Value.@"null"); + return sema.addConstant(opt_ptr_stack_trace_ty, Value.null); } fn zirFrame( @@ -17760,11 +17760,11 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in const bits = @intCast(u16, bits_val.toUnsignedInt(target)); const ty = switch (bits) { - 16 => Type.@"f16", - 32 => Type.@"f32", - 64 => Type.@"f64", - 80 => Type.@"f80", - 128 => Type.@"f128", + 16 => Type.f16, + 32 => Type.f32, + 64 => Type.f64, + 80 => Type.f80, + 128 => Type.f128, else => return sema.fail(block, src, "{}-bit float unsupported", .{bits}), }; return sema.addType(ty); @@ -18029,7 +18029,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in enum_obj.* = .{ .owner_decl = new_decl_index, - .tag_ty = Type.@"null", + .tag_ty = Type.null, .tag_ty_inferred = false, .fields = .{}, .values = .{}, @@ -18077,7 +18077,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in // TODO: better source location return sema.fail(block, src, "field '{s}' with enumeration value '{}' is too large for backing int type '{}'", .{ field_name, - value_val.fmtValue(Type.@"comptime_int", mod), + value_val.fmtValue(Type.comptime_int, mod), enum_obj.tag_ty.fmt(mod), }); } @@ -18187,7 +18187,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in errdefer mod.abortAnonDecl(new_decl_index); union_obj.* = .{ .owner_decl = new_decl_index, - .tag_ty = Type.initTag(.@"null"), + .tag_ty = Type.initTag(.null), .fields = .{}, .zir_index = inst, .layout = layout, @@ -19918,7 +19918,7 @@ fn zirCmpxchg( // special case zero bit types if ((try sema.typeHasOnePossibleValue(elem_ty)) != null) { - return sema.addConstant(result_ty, Value.@"null"); + return sema.addConstant(result_ty, Value.null); } const runtime_src = if (try sema.resolveDefinedValue(block, ptr_src, ptr)) |ptr_val| rs: { @@ -19933,7 +19933,7 @@ fn zirCmpxchg( const stored_val = (try sema.pointerDeref(block, ptr_src, ptr_val, ptr_ty)) orelse break :rs ptr_src; const result_val = if (stored_val.eql(expected_val, elem_ty, sema.mod)) blk: { try sema.storePtr(block, src, ptr, new_value); - break :blk Value.@"null"; + break :blk Value.null; } else try Value.Tag.opt_payload.create(sema.arena, stored_val); return sema.addConstant(result_ty, result_val); @@ -20074,7 +20074,7 @@ fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air }; mask_ty = try Type.Tag.vector.create(sema.arena, .{ .len = mask_len, - .elem_type = Type.@"i32", + .elem_type = Type.i32, }); mask = try sema.coerce(block, mask_ty, mask, mask_src); const mask_val = try sema.resolveConstMaybeUndefVal(block, mask_src, mask, "shuffle mask must be comptime-known"); @@ -22133,7 +22133,7 @@ fn panicWithMsg( }); const null_stack_trace = try sema.addConstant( try Type.optional(arena, ptr_stack_trace_ty), - Value.@"null", + Value.null, ); const args: [3]Air.Inst.Ref = .{ msg_inst, null_stack_trace, .null_value }; _ = try sema.analyzeCall(block, panic_fn, src, src, .auto, false, &args, null); @@ -23976,7 +23976,7 @@ fn coerceExtra( // null to ?T if (inst_ty.zigTypeTag() == .Null) { - return sema.addConstant(dest_ty, Value.@"null"); + return sema.addConstant(dest_ty, Value.null); } // cast from ?*T and ?[*]T to ?*anyopaque @@ -24135,7 +24135,7 @@ fn coerceExtra( // coercion to C pointer .C => switch (inst_ty.zigTypeTag()) { .Null => { - return sema.addConstant(dest_ty, Value.@"null"); + return sema.addConstant(dest_ty, Value.null); }, .ComptimeInt => { const addr = sema.coerceExtra(block, Type.usize, inst, inst_src, .{ .report_err = false }) catch |err| switch (err) { @@ -27361,7 +27361,7 @@ fn refValue(sema: *Sema, block: *Block, ty: Type, val: Value) !Value { } fn optRefValue(sema: *Sema, block: *Block, ty: Type, opt_val: ?Value) !Value { - const val = opt_val orelse return Value.@"null"; + const val = opt_val orelse return Value.null; const ptr_val = try sema.refValue(block, ty, val); const result = try Value.Tag.opt_payload.create(sema.arena, ptr_val); return result; @@ -28301,7 +28301,7 @@ fn cmpVector( assert(rhs_ty.zigTypeTag() == .Vector); try sema.checkVectorizableBinaryOperands(block, src, lhs_ty, rhs_ty, lhs_src, rhs_src); - const result_ty = try Type.vector(sema.arena, lhs_ty.vectorLen(), Type.@"bool"); + const result_ty = try Type.vector(sema.arena, lhs_ty.vectorLen(), Type.bool); const runtime_src: LazySrcLoc = src: { if (try sema.resolveMaybeUndefVal(lhs)) |lhs_val| { @@ -30419,7 +30419,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value { var buf: Type.Payload.ElemType = undefined; const child_ty = ty.optionalChild(&buf); if (child_ty.isNoReturn()) { - return Value.@"null"; + return Value.null; } else { return null; } @@ -30539,8 +30539,8 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value { .empty_struct, .empty_struct_literal => return Value.initTag(.empty_struct_value), .void => return Value.void, .noreturn => return Value.initTag(.unreachable_value), - .@"null" => return Value.@"null", - .@"undefined" => return Value.initTag(.undef), + .null => return Value.null, + .undefined => return Value.initTag(.undef), .int_unsigned, .int_signed => { if (ty.cast(Type.Payload.Bits).?.data == 0) { @@ -30712,8 +30712,8 @@ pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref { .comptime_float => return .comptime_float_type, .noreturn => return .noreturn_type, .@"anyframe" => return .anyframe_type, - .@"null" => return .null_type, - .@"undefined" => return .undefined_type, + .null => return .null_type, + .undefined => return .undefined_type, .enum_literal => return .enum_literal_type, .atomic_order => return .atomic_order_type, .atomic_rmw_op => return .atomic_rmw_op_type, @@ -31102,8 +31102,8 @@ pub fn typeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool { .anyerror, .noreturn, .@"anyframe", - .@"null", - .@"undefined", + .null, + .undefined, .atomic_order, .atomic_rmw_op, .calling_convention, diff --git a/src/Zir.zig b/src/Zir.zig index b17d6d7fec..c30642d6c5 100644 --- a/src/Zir.zig +++ b/src/Zir.zig @@ -2367,7 +2367,7 @@ pub const Inst = struct { }, .undef = .{ - .ty = Type.initTag(.@"undefined"), + .ty = Type.initTag(.undefined), .val = Value.initTag(.undef), }, .zero = .{ @@ -2395,7 +2395,7 @@ pub const Inst = struct { .val = Value.initTag(.unreachable_value), }, .null_value = .{ - .ty = Type.initTag(.@"null"), + .ty = Type.initTag(.null), .val = Value.initTag(.null_value), }, .bool_true = .{ diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig index 9b3178a757..7b601fdcfb 100644 --- a/src/arch/aarch64/CodeGen.zig +++ b/src/arch/aarch64/CodeGen.zig @@ -150,7 +150,7 @@ const MCValue = union(enum) { /// * got - the value is referenced indirectly via GOT entry index (the linker emits a got-type reloc) /// * direct - the value is referenced directly via symbol index index (the linker emits a displacement reloc) /// * import - the value is referenced indirectly via import entry index (the linker emits an import-type reloc) - linker_load: struct { @"type": enum { got, direct, import }, sym_index: u32 }, + linker_load: struct { type: enum { got, direct, import }, sym_index: u32 }, /// The value is one of the stack variables. /// /// If the type is a pointer, it means the pointer address is in @@ -4024,7 +4024,7 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type }, .memory => |addr| try self.genSetReg(Type.usize, src_reg, .{ .immediate = @intCast(u32, addr) }), .linker_load => |load_struct| { - const tag: Mir.Inst.Tag = switch (load_struct.@"type") { + const tag: Mir.Inst.Tag = switch (load_struct.type) { .got => .load_memory_ptr_got, .direct => .load_memory_ptr_direct, .import => unreachable, @@ -4347,7 +4347,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. const fn_owner_decl = mod.declPtr(func.owner_decl); try self.genSetReg(Type.initTag(.u64), .x30, .{ .linker_load = .{ - .@"type" = .got, + .type = .got, .sym_index = fn_owner_decl.link.macho.sym_index, }, }); @@ -4385,7 +4385,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. const fn_owner_decl = mod.declPtr(func.owner_decl); try self.genSetReg(Type.initTag(.u64), .x30, .{ .linker_load = .{ - .@"type" = .got, + .type = .got, .sym_index = fn_owner_decl.link.coff.sym_index, }, }); @@ -4406,7 +4406,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. const sym_index = try coff_file.getGlobalSymbol(mem.sliceTo(decl_name, 0)); try self.genSetReg(Type.initTag(.u64), .x30, .{ .linker_load = .{ - .@"type" = .import, + .type = .import, .sym_index = sym_index, }, }); @@ -5534,7 +5534,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro }, .memory => |addr| try self.genSetReg(Type.usize, src_reg, .{ .immediate = addr }), .linker_load => |load_struct| { - const tag: Mir.Inst.Tag = switch (load_struct.@"type") { + const tag: Mir.Inst.Tag = switch (load_struct.type) { .got => .load_memory_ptr_got, .direct => .load_memory_ptr_direct, .import => unreachable, @@ -5648,7 +5648,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void }, .register_with_overflow => unreachable, // doesn't fit into a register .linker_load => |load_struct| { - const tag: Mir.Inst.Tag = switch (load_struct.@"type") { + const tag: Mir.Inst.Tag = switch (load_struct.type) { .got => .load_memory_got, .direct => .load_memory_direct, .import => .load_memory_import, @@ -5842,7 +5842,7 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I }, .memory => |addr| try self.genSetReg(ptr_ty, src_reg, .{ .immediate = @intCast(u32, addr) }), .linker_load => |load_struct| { - const tag: Mir.Inst.Tag = switch (load_struct.@"type") { + const tag: Mir.Inst.Tag = switch (load_struct.type) { .got => .load_memory_ptr_got, .direct => .load_memory_ptr_direct, .import => unreachable, @@ -6168,7 +6168,7 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne // the linker has enough info to perform relocations. assert(decl.link.macho.sym_index != 0); return MCValue{ .linker_load = .{ - .@"type" = .got, + .type = .got, .sym_index = decl.link.macho.sym_index, } }; } else if (self.bin_file.cast(link.File.Coff)) |_| { @@ -6176,7 +6176,7 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne // the linker has enough info to perform relocations. assert(decl.link.coff.sym_index != 0); return MCValue{ .linker_load = .{ - .@"type" = .got, + .type = .got, .sym_index = decl.link.coff.sym_index, } }; } else if (self.bin_file.cast(link.File.Plan9)) |p9| { @@ -6198,12 +6198,12 @@ fn lowerUnnamedConst(self: *Self, tv: TypedValue) InnerError!MCValue { return MCValue{ .memory = vaddr }; } else if (self.bin_file.cast(link.File.MachO)) |_| { return MCValue{ .linker_load = .{ - .@"type" = .direct, + .type = .direct, .sym_index = local_sym_index, } }; } else if (self.bin_file.cast(link.File.Coff)) |_| { return MCValue{ .linker_load = .{ - .@"type" = .direct, + .type = .direct, .sym_index = local_sym_index, } }; } else if (self.bin_file.cast(link.File.Plan9)) |_| { diff --git a/src/arch/aarch64/Emit.zig b/src/arch/aarch64/Emit.zig index 9608e1e9fc..e5a8bc4dd6 100644 --- a/src/arch/aarch64/Emit.zig +++ b/src/arch/aarch64/Emit.zig @@ -687,7 +687,7 @@ fn mirCallExtern(emit: *Emit, inst: Mir.Inst.Index) !void { const atom = macho_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?; const target = macho_file.getGlobalByIndex(relocation.sym_index); try atom.addRelocation(macho_file, .{ - .@"type" = @enumToInt(std.macho.reloc_type_arm64.ARM64_RELOC_BRANCH26), + .type = @enumToInt(std.macho.reloc_type_arm64.ARM64_RELOC_BRANCH26), .target = target, .offset = offset, .addend = 0, @@ -906,7 +906,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void { .addend = 0, .pcrel = true, .length = 2, - .@"type" = switch (tag) { + .type = switch (tag) { .load_memory_got, .load_memory_ptr_got, => @enumToInt(std.macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGE21), @@ -922,7 +922,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void { .addend = 0, .pcrel = false, .length = 2, - .@"type" = switch (tag) { + .type = switch (tag) { .load_memory_got, .load_memory_ptr_got, => @enumToInt(std.macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGEOFF12), @@ -949,7 +949,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void { .addend = 0, .pcrel = true, .length = 2, - .@"type" = switch (tag) { + .type = switch (tag) { .load_memory_got, .load_memory_ptr_got, => .got_page, @@ -966,7 +966,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void { .addend = 0, .pcrel = false, .length = 2, - .@"type" = switch (tag) { + .type = switch (tag) { .load_memory_got, .load_memory_ptr_got, => .got_pageoff, diff --git a/src/arch/sparc64/CodeGen.zig b/src/arch/sparc64/CodeGen.zig index 9d37cd9d1b..e49727428f 100644 --- a/src/arch/sparc64/CodeGen.zig +++ b/src/arch/sparc64/CodeGen.zig @@ -446,7 +446,7 @@ fn gen(self: *Self) !void { .data = .{ .arithmetic_2op = .{ .is_imm = true, - .rs1 = .@"i7", + .rs1 = .i7, .rs2_or_imm = .{ .imm = 8 }, }, }, diff --git a/src/arch/sparc64/bits.zig b/src/arch/sparc64/bits.zig index 4e6140bdab..0446a84d6d 100644 --- a/src/arch/sparc64/bits.zig +++ b/src/arch/sparc64/bits.zig @@ -35,14 +35,14 @@ test "Register.id" { try testing.expectEqual(Register.o6.id(), Register.sp.id()); // FP - try testing.expectEqual(@as(u5, 30), Register.@"i6".id()); - try testing.expectEqual(Register.@"i6".id(), Register.fp.id()); + try testing.expectEqual(@as(u5, 30), Register.i6.id()); + try testing.expectEqual(Register.i6.id(), Register.fp.id()); // x0 try testing.expectEqual(@as(u5, 0), Register.g0.id()); try testing.expectEqual(@as(u5, 8), Register.o0.id()); try testing.expectEqual(@as(u5, 16), Register.l0.id()); - try testing.expectEqual(@as(u5, 24), Register.@"i0".id()); + try testing.expectEqual(@as(u5, 24), Register.i0.id()); } test "Register.enc" { @@ -50,13 +50,13 @@ test "Register.enc" { try testing.expectEqual(@as(u5, 0), Register.g0.enc()); try testing.expectEqual(@as(u5, 8), Register.o0.enc()); try testing.expectEqual(@as(u5, 16), Register.l0.enc()); - try testing.expectEqual(@as(u5, 24), Register.@"i0".enc()); + try testing.expectEqual(@as(u5, 24), Register.i0.enc()); // For integer registers, enc() == id(). try testing.expectEqual(Register.g0.enc(), Register.g0.id()); try testing.expectEqual(Register.o0.enc(), Register.o0.id()); try testing.expectEqual(Register.l0.enc(), Register.l0.id()); - try testing.expectEqual(Register.@"i0".enc(), Register.@"i0".id()); + try testing.expectEqual(Register.i0.enc(), Register.i0.id()); } /// Scalar floating point registers in the SPARCv9 instruction set @@ -127,11 +127,11 @@ test "FloatingPointRegister.id" { // Low region try testing.expectEqual(@as(u6, 0), FloatingPointRegister.q0.id()); try testing.expectEqual(FloatingPointRegister.q0.id(), FloatingPointRegister.d0.id()); - try testing.expectEqual(FloatingPointRegister.d0.id(), FloatingPointRegister.@"f0".id()); + try testing.expectEqual(FloatingPointRegister.d0.id(), FloatingPointRegister.f0.id()); try testing.expectEqual(@as(u6, 28), FloatingPointRegister.q28.id()); try testing.expectEqual(FloatingPointRegister.q28.id(), FloatingPointRegister.d28.id()); - try testing.expectEqual(FloatingPointRegister.d28.id(), FloatingPointRegister.@"f28".id()); + try testing.expectEqual(FloatingPointRegister.d28.id(), FloatingPointRegister.f28.id()); // High region try testing.expectEqual(@as(u6, 32), FloatingPointRegister.q32.id()); @@ -143,9 +143,9 @@ test "FloatingPointRegister.id" { test "FloatingPointRegister.enc" { // f registers - try testing.expectEqual(@as(u5, 0), FloatingPointRegister.@"f0".enc()); - try testing.expectEqual(@as(u5, 1), FloatingPointRegister.@"f1".enc()); - try testing.expectEqual(@as(u5, 31), FloatingPointRegister.@"f31".enc()); + try testing.expectEqual(@as(u5, 0), FloatingPointRegister.f0.enc()); + try testing.expectEqual(@as(u5, 1), FloatingPointRegister.f1.enc()); + try testing.expectEqual(@as(u5, 31), FloatingPointRegister.f31.enc()); // d registers try testing.expectEqual(@as(u5, 0), FloatingPointRegister.d0.enc()); diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 2bafbfb3d7..ceecc6919b 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -132,7 +132,7 @@ pub const MCValue = union(enum) { /// * got - the value is referenced indirectly via GOT entry index (the linker emits a got-type reloc) /// * direct - the value is referenced directly via symbol index index (the linker emits a displacement reloc) /// * import - the value is referenced indirectly via import entry index (the linker emits an import-type reloc) - linker_load: struct { @"type": enum { got, direct, import }, sym_index: u32 }, + linker_load: struct { type: enum { got, direct, import }, sym_index: u32 }, /// The value is one of the stack variables. /// If the type is a pointer, it means the pointer address is in the stack at this offset. stack_offset: i32, @@ -2671,7 +2671,7 @@ fn loadMemPtrIntoRegister(self: *Self, reg: Register, ptr_ty: Type, ptr: MCValue fn_owner_decl.link.macho.sym_index else fn_owner_decl.link.coff.sym_index; - const flags: u2 = switch (load_struct.@"type") { + const flags: u2 = switch (load_struct.type) { .got => 0b00, .direct => 0b01, .import => 0b10, @@ -4010,7 +4010,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. const fn_owner_decl = mod.declPtr(func.owner_decl); try self.genSetReg(Type.initTag(.usize), .rax, .{ .linker_load = .{ - .@"type" = .got, + .type = .got, .sym_index = fn_owner_decl.link.coff.sym_index, }, }); @@ -4034,7 +4034,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. const sym_index = try coff_file.getGlobalSymbol(mem.sliceTo(decl_name, 0)); try self.genSetReg(Type.initTag(.usize), .rax, .{ .linker_load = .{ - .@"type" = .import, + .type = .import, .sym_index = sym_index, }, }); @@ -4070,7 +4070,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. const sym_index = fn_owner_decl.link.macho.sym_index; try self.genSetReg(Type.initTag(.usize), .rax, .{ .linker_load = .{ - .@"type" = .got, + .type = .got, .sym_index = sym_index, }, }); @@ -6925,13 +6925,13 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne } else if (self.bin_file.cast(link.File.MachO)) |_| { assert(decl.link.macho.sym_index != 0); return MCValue{ .linker_load = .{ - .@"type" = .got, + .type = .got, .sym_index = decl.link.macho.sym_index, } }; } else if (self.bin_file.cast(link.File.Coff)) |_| { assert(decl.link.coff.sym_index != 0); return MCValue{ .linker_load = .{ - .@"type" = .got, + .type = .got, .sym_index = decl.link.coff.sym_index, } }; } else if (self.bin_file.cast(link.File.Plan9)) |p9| { @@ -6953,12 +6953,12 @@ fn lowerUnnamedConst(self: *Self, tv: TypedValue) InnerError!MCValue { return MCValue{ .memory = vaddr }; } else if (self.bin_file.cast(link.File.MachO)) |_| { return MCValue{ .linker_load = .{ - .@"type" = .direct, + .type = .direct, .sym_index = local_sym_index, } }; } else if (self.bin_file.cast(link.File.Coff)) |_| { return MCValue{ .linker_load = .{ - .@"type" = .direct, + .type = .direct, .sym_index = local_sym_index, } }; } else if (self.bin_file.cast(link.File.Plan9)) |p9| { diff --git a/src/arch/x86_64/Emit.zig b/src/arch/x86_64/Emit.zig index c1c00d8303..10e834ddf1 100644 --- a/src/arch/x86_64/Emit.zig +++ b/src/arch/x86_64/Emit.zig @@ -1005,7 +1005,7 @@ fn mirLeaPic(emit: *Emit, inst: Mir.Inst.Index) InnerError!void { }; const atom = macho_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?; try atom.addRelocation(macho_file, .{ - .@"type" = reloc_type, + .type = reloc_type, .target = .{ .sym_index = relocation.sym_index, .file = null }, .offset = @intCast(u32, end_offset - 4), .addend = 0, @@ -1015,7 +1015,7 @@ fn mirLeaPic(emit: *Emit, inst: Mir.Inst.Index) InnerError!void { } else if (emit.bin_file.cast(link.File.Coff)) |coff_file| { const atom = coff_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?; try atom.addRelocation(coff_file, .{ - .@"type" = switch (ops.flags) { + .type = switch (ops.flags) { 0b00 => .got, 0b01 => .direct, 0b10 => .import, @@ -1145,7 +1145,7 @@ fn mirCallExtern(emit: *Emit, inst: Mir.Inst.Index) InnerError!void { const atom = macho_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?; const target = macho_file.getGlobalByIndex(relocation.sym_index); try atom.addRelocation(macho_file, .{ - .@"type" = @enumToInt(std.macho.reloc_type_x86_64.X86_64_RELOC_BRANCH), + .type = @enumToInt(std.macho.reloc_type_x86_64.X86_64_RELOC_BRANCH), .target = target, .offset = offset, .addend = 0, @@ -1157,7 +1157,7 @@ fn mirCallExtern(emit: *Emit, inst: Mir.Inst.Index) InnerError!void { const atom = coff_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?; const target = coff_file.getGlobalByIndex(relocation.sym_index); try atom.addRelocation(coff_file, .{ - .@"type" = .direct, + .type = .direct, .target = target, .offset = offset, .addend = 0, diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 736eb02973..f582fe7eb1 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -607,7 +607,7 @@ pub const DeclGen = struct { if (val.isUndefDeep()) { switch (ty.zigTypeTag()) { // bool b = 0xaa; evals to true, but memcpy(&b, 0xaa, 1); evals to false. - .Bool => return dg.renderValue(writer, ty, Value.@"false", location), + .Bool => return dg.renderValue(writer, ty, Value.false, location), .Int, .Enum, .ErrorSet => return writer.print("{x}", .{try dg.fmtIntLiteral(ty, val)}), .Float => { const bits = ty.floatBits(target); @@ -1964,7 +1964,7 @@ pub const DeclGen = struct { try buffer.appendSlice(" }\n"); } try buffer.appendSlice(" }\n while ("); - try dg.renderValue(bw, Type.bool, Value.@"true", .Other); + try dg.renderValue(bw, Type.bool, Value.true, .Other); try buffer.appendSlice(") "); _ = try airBreakpoint(bw); try buffer.appendSlice("}\n"); @@ -3800,7 +3800,7 @@ fn airLoop(f: *Function, inst: Air.Inst.Index) !CValue { const body = f.air.extra[loop.end..][0..loop.data.body_len]; const writer = f.object.writer(); try writer.writeAll("while ("); - try f.object.dg.renderValue(writer, Type.bool, Value.@"true", .Other); + try f.object.dg.renderValue(writer, Type.bool, Value.true, .Other); try writer.writeAll(") "); try genBody(f, body); try writer.writeByte('\n'); @@ -4095,19 +4095,19 @@ fn airIsNull( var slice_ptr_buf: Type.SlicePtrFieldTypeBuffer = undefined; const rhs = if (!payload_ty.hasRuntimeBitsIgnoreComptime()) - TypedValue{ .ty = Type.bool, .val = Value.@"true" } + TypedValue{ .ty = Type.bool, .val = Value.true } else if (optional_ty.isPtrLikeOptional()) // operand is a regular pointer, test `operand !=/== NULL` - TypedValue{ .ty = optional_ty, .val = Value.@"null" } + TypedValue{ .ty = optional_ty, .val = Value.null } else if (payload_ty.zigTypeTag() == .ErrorSet) TypedValue{ .ty = payload_ty, .val = Value.zero } else if (payload_ty.isSlice() and optional_ty.optionalReprIsPayload()) rhs: { try writer.writeAll(".ptr"); const slice_ptr_ty = payload_ty.slicePtrFieldType(&slice_ptr_buf); - break :rhs TypedValue{ .ty = slice_ptr_ty, .val = Value.@"null" }; + break :rhs TypedValue{ .ty = slice_ptr_ty, .val = Value.null }; } else rhs: { try writer.writeAll(".is_null"); - break :rhs TypedValue{ .ty = Type.bool, .val = Value.@"true" }; + break :rhs TypedValue{ .ty = Type.bool, .val = Value.true }; }; try writer.writeByte(' '); try writer.writeAll(operator); @@ -4195,7 +4195,7 @@ fn airOptionalPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue { try f.writeCValueDeref(writer, operand); try writer.writeAll(".is_null = "); - try f.object.dg.renderValue(writer, Type.bool, Value.@"false", .Initializer); + try f.object.dg.renderValue(writer, Type.bool, Value.false, .Initializer); try writer.writeAll(";\n"); const inst_ty = f.air.typeOfIndex(inst); @@ -4534,7 +4534,7 @@ fn airWrapOptional(f: *Function, inst: Air.Inst.Index) !CValue { try writer.writeAll(" = { .payload = "); try f.writeCValue(writer, if (is_array) CValue{ .undef = payload_ty } else payload, .Initializer); try writer.writeAll(", .is_null = "); - try f.object.dg.renderValue(writer, Type.bool, Value.@"false", .Initializer); + try f.object.dg.renderValue(writer, Type.bool, Value.false, .Initializer); try writer.writeAll(" };\n"); if (is_array) { try writer.writeAll("memcpy("); @@ -4862,7 +4862,7 @@ fn airCmpxchg(f: *Function, inst: Air.Inst.Index, flavor: [*:0]const u8) !CValue try f.writeCValue(writer, expected_value, .Initializer); if (is_struct) { try writer.writeAll(", .is_null = "); - try f.object.dg.renderValue(writer, Type.bool, Value.@"false", .Initializer); + try f.object.dg.renderValue(writer, Type.bool, Value.false, .Initializer); try writer.writeAll(" }"); } try writer.writeAll(";\n"); diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index af9dcacf48..e16d5e5337 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -10723,7 +10723,7 @@ fn ccAbiPromoteInt( else => {}, } const int_info = switch (ty.zigTypeTag()) { - .Bool => Type.@"u1".intInfo(target), + .Bool => Type.u1.intInfo(target), .Int, .Enum, .ErrorSet => ty.intInfo(target), else => return null, }; diff --git a/src/codegen/spirv/type.zig b/src/codegen/spirv/type.zig index d9504f4d23..6cc1b8f3bd 100644 --- a/src/codegen/spirv/type.zig +++ b/src/codegen/spirv/type.zig @@ -104,7 +104,7 @@ pub const Type = extern union { } return true; }, - .@"function" => { + .function => { const fn_a = a.payload(.function); const fn_b = b.payload(.function); if (fn_a.return_type != fn_b.return_type) diff --git a/src/link/Coff.zig b/src/link/Coff.zig index ab3dcdfffe..d419bd633b 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -337,7 +337,7 @@ fn populateMissingMetadata(self: *Coff) !void { .name = [_]u8{0} ** 8, .value = 0, .section_number = .UNDEFINED, - .@"type" = .{ .base_type = .NULL, .complex_type = .NULL }, + .type = .{ .base_type = .NULL, .complex_type = .NULL }, .storage_class = .NULL, .number_of_aux_symbols = 0, }); @@ -635,7 +635,7 @@ fn allocateSymbol(self: *Coff) !u32 { .name = [_]u8{0} ** 8, .value = 0, .section_number = .UNDEFINED, - .@"type" = .{ .base_type = .NULL, .complex_type = .NULL }, + .type = .{ .base_type = .NULL, .complex_type = .NULL }, .storage_class = .NULL, .number_of_aux_symbols = 0, }; @@ -730,7 +730,7 @@ fn createGotAtom(self: *Coff, target: SymbolWithLoc) !*Atom { log.debug("allocated GOT atom at 0x{x}", .{sym.value}); try atom.addRelocation(self, .{ - .@"type" = .direct, + .type = .direct, .target = target, .offset = 0, .addend = 0, @@ -1106,7 +1106,7 @@ fn updateDeclCode(self: *Coff, decl_index: Module.Decl.Index, code: []const u8, const sym = atom.getSymbolPtr(self); try self.setSymbolName(sym, decl_name); sym.section_number = @intToEnum(coff.SectionNumber, sect_index + 1); - sym.@"type" = .{ .complex_type = complex_type, .base_type = .NULL }; + sym.type = .{ .complex_type = complex_type, .base_type = .NULL }; const capacity = atom.capacity(self); const need_realloc = code.len > capacity or !mem.isAlignedGeneric(u64, sym.value, required_alignment); @@ -1131,7 +1131,7 @@ fn updateDeclCode(self: *Coff, decl_index: Module.Decl.Index, code: []const u8, const sym = atom.getSymbolPtr(self); try self.setSymbolName(sym, decl_name); sym.section_number = @intToEnum(coff.SectionNumber, sect_index + 1); - sym.@"type" = .{ .complex_type = complex_type, .base_type = .NULL }; + sym.type = .{ .complex_type = complex_type, .base_type = .NULL }; const vaddr = try self.allocateAtom(atom, code_len, required_alignment); errdefer self.freeAtom(atom); @@ -1307,7 +1307,7 @@ pub fn updateDeclExports( try self.setSymbolName(sym, exp.options.name); sym.value = decl_sym.value; sym.section_number = @intToEnum(coff.SectionNumber, self.text_section_index.? + 1); - sym.@"type" = .{ .complex_type = .FUNCTION, .base_type = .NULL }; + sym.type = .{ .complex_type = .FUNCTION, .base_type = .NULL }; switch (exp.options.linkage) { .Strong => { @@ -1337,7 +1337,7 @@ pub fn deleteExport(self: *Coff, exp: Export) void { .name = [_]u8{0} ** 8, .value = 0, .section_number = .UNDEFINED, - .@"type" = .{ .base_type = .NULL, .complex_type = .NULL }, + .type = .{ .base_type = .NULL, .complex_type = .NULL }, .storage_class = .NULL, .number_of_aux_symbols = 0, }; @@ -1465,7 +1465,7 @@ pub fn getDeclVAddr( const atom = self.getAtomForSymbol(.{ .sym_index = reloc_info.parent_atom_index, .file = null }).?; const target = SymbolWithLoc{ .sym_index = decl.link.coff.sym_index, .file = null }; try atom.addRelocation(self, .{ - .@"type" = .direct, + .type = .direct, .target = target, .offset = @intCast(u32, reloc_info.offset), .addend = reloc_info.addend, @@ -1537,7 +1537,7 @@ fn writeBaseRelocations(self: *Coff) !void { } try gop.value_ptr.append(.{ .offset = @intCast(u12, rva - page), - .@"type" = .DIR64, + .type = .DIR64, }); } } @@ -1555,7 +1555,7 @@ fn writeBaseRelocations(self: *Coff) !void { )) { try entry.value_ptr.append(.{ .offset = 0, - .@"type" = .ABSOLUTE, + .type = .ABSOLUTE, }); } diff --git a/src/link/Coff/Atom.zig b/src/link/Coff/Atom.zig index 1767a986e9..b1bb292c62 100644 --- a/src/link/Coff/Atom.zig +++ b/src/link/Coff/Atom.zig @@ -94,7 +94,7 @@ pub fn freeListEligible(self: Atom, coff_file: *const Coff) bool { pub fn addRelocation(self: *Atom, coff_file: *Coff, reloc: Relocation) !void { const gpa = coff_file.base.allocator; - log.debug(" (adding reloc of type {s} to target %{d})", .{ @tagName(reloc.@"type"), reloc.target.sym_index }); + log.debug(" (adding reloc of type {s} to target %{d})", .{ @tagName(reloc.type), reloc.target.sym_index }); const gop = try coff_file.relocs.getOrPut(gpa, self); if (!gop.found_existing) { gop.value_ptr.* = .{}; diff --git a/src/link/Coff/Relocation.zig b/src/link/Coff/Relocation.zig index cc187a6be1..12a34b332d 100644 --- a/src/link/Coff/Relocation.zig +++ b/src/link/Coff/Relocation.zig @@ -13,7 +13,7 @@ const Atom = @import("Atom.zig"); const Coff = @import("../Coff.zig"); const SymbolWithLoc = Coff.SymbolWithLoc; -@"type": enum { +type: enum { // x86, x86_64 /// RIP-relative displacement to a GOT pointer got, @@ -47,7 +47,7 @@ dirty: bool = true, /// Returns an Atom which is the target node of this relocation edge (if any). pub fn getTargetAtom(self: Relocation, coff_file: *Coff) ?*Atom { - switch (self.@"type") { + switch (self.type) { .got, .got_page, .got_pageoff, @@ -80,7 +80,7 @@ pub fn resolve(self: *Relocation, atom: *Atom, coff_file: *Coff) !void { source_vaddr, target_vaddr_with_addend, coff_file.getSymbolName(self.target), - @tagName(self.@"type"), + @tagName(self.type), file_offset + self.offset, }); @@ -121,7 +121,7 @@ fn resolveAarch64(self: *Relocation, ctx: Context, coff_file: *Coff) !void { else => unreachable, } - switch (self.@"type") { + switch (self.type) { .got_page, .import_page, .page => { const source_page = @intCast(i32, ctx.source_vaddr >> 12); const target_page = @intCast(i32, ctx.target_vaddr >> 12); @@ -198,7 +198,7 @@ fn resolveAarch64(self: *Relocation, ctx: Context, coff_file: *Coff) !void { } fn resolveX86(self: *Relocation, ctx: Context, coff_file: *Coff) !void { - switch (self.@"type") { + switch (self.type) { .got_page => unreachable, .got_pageoff => unreachable, .page => unreachable, diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig index f821cb9709..843d14edd7 100644 --- a/src/link/Dwarf.zig +++ b/src/link/Dwarf.zig @@ -104,7 +104,7 @@ pub const DeclState = struct { pub fn addExprlocReloc(self: *DeclState, target: u32, offset: u32, is_ptr: bool) !void { log.debug("{x}: target sym %{d}, via GOT {}", .{ offset, target, is_ptr }); try self.exprloc_relocs.append(self.gpa, .{ - .@"type" = if (is_ptr) .got_load else .direct_load, + .type = if (is_ptr) .got_load else .direct_load, .target = target, .offset = offset, }); @@ -132,7 +132,7 @@ pub const DeclState = struct { const sym_index = @intCast(u32, self.abbrev_table.items.len); try self.abbrev_table.append(self.gpa, .{ .atom = atom, - .@"type" = ty, + .type = ty, .offset = undefined, }); log.debug("%{d}: {}", .{ sym_index, ty.fmtDebug() }); @@ -564,7 +564,7 @@ pub const DeclState = struct { pub const AbbrevEntry = struct { atom: *const Atom, - @"type": Type, + type: Type, offset: u32, }; @@ -579,7 +579,7 @@ pub const AbbrevRelocation = struct { pub const ExprlocRelocation = struct { /// Type of the relocation: direct load ref, or GOT load ref (via GOT table) - @"type": enum { + type: enum { direct_load, got_load, }, @@ -1022,7 +1022,7 @@ pub fn commitDeclState( var sym_index: usize = 0; while (sym_index < decl_state.abbrev_table.items.len) : (sym_index += 1) { const symbol = &decl_state.abbrev_table.items[sym_index]; - const ty = symbol.@"type"; + const ty = symbol.type; const deferred: bool = blk: { if (ty.isAnyError()) break :blk true; switch (ty.tag()) { @@ -1046,7 +1046,7 @@ pub fn commitDeclState( while (decl_state.abbrev_relocs.popOrNull()) |reloc| { if (reloc.target) |target| { const symbol = decl_state.abbrev_table.items[target]; - const ty = symbol.@"type"; + const ty = symbol.type; const deferred: bool = blk: { if (ty.isAnyError()) break :blk true; switch (ty.tag()) { @@ -1091,7 +1091,7 @@ pub fn commitDeclState( const macho_file = file.cast(File.MachO).?; const d_sym = &macho_file.d_sym.?; try d_sym.relocs.append(d_sym.base.base.allocator, .{ - .@"type" = switch (reloc.@"type") { + .type = switch (reloc.type) { .direct_load => .direct_load, .got_load => .got_load, }, diff --git a/src/link/MachO.zig b/src/link/MachO.zig index a25d13fdf5..06e073e95d 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -1059,7 +1059,7 @@ pub fn createGotAtom(self: *MachO, target: SymbolWithLoc) !*Atom { log.debug("allocated GOT atom at 0x{x}", .{sym.n_value}); try atom.addRelocation(self, .{ - .@"type" = switch (self.base.options.target.cpu.arch) { + .type = switch (self.base.options.target.cpu.arch) { .aarch64 => @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED), .x86_64 => @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED), else => unreachable, @@ -1164,14 +1164,14 @@ pub fn createStubHelperPreambleAtom(self: *MachO) !void { code[10] = 0x25; try atom.addRelocations(self, 2, .{ .{ - .@"type" = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_SIGNED), + .type = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_SIGNED), .target = .{ .sym_index = dyld_private_sym_index, .file = null }, .offset = 3, .addend = 0, .pcrel = true, .length = 2, }, .{ - .@"type" = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_GOT), + .type = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_GOT), .target = .{ .sym_index = self.dyld_stub_binder_index.?, .file = null }, .offset = 11, .addend = 0, @@ -1204,28 +1204,28 @@ pub fn createStubHelperPreambleAtom(self: *MachO) !void { mem.writeIntLittle(u32, code[20..][0..4], aarch64.Instruction.br(.x16).toU32()); try atom.addRelocations(self, 4, .{ .{ - .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGE21), + .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGE21), .target = .{ .sym_index = dyld_private_sym_index, .file = null }, .offset = 0, .addend = 0, .pcrel = true, .length = 2, }, .{ - .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGEOFF12), + .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGEOFF12), .target = .{ .sym_index = dyld_private_sym_index, .file = null }, .offset = 4, .addend = 0, .pcrel = false, .length = 2, }, .{ - .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGE21), + .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGE21), .target = .{ .sym_index = self.dyld_stub_binder_index.?, .file = null }, .offset = 12, .addend = 0, .pcrel = true, .length = 2, }, .{ - .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGEOFF12), + .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGEOFF12), .target = .{ .sym_index = self.dyld_stub_binder_index.?, .file = null }, .offset = 16, .addend = 0, @@ -1286,7 +1286,7 @@ pub fn createStubHelperAtom(self: *MachO) !*Atom { code[5] = 0xe9; try atom.addRelocation(self, .{ - .@"type" = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_BRANCH), + .type = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_BRANCH), .target = .{ .sym_index = self.stub_helper_preamble_atom.?.sym_index, .file = null }, .offset = 6, .addend = 0, @@ -1309,7 +1309,7 @@ pub fn createStubHelperAtom(self: *MachO) !*Atom { // Next 4 bytes 8..12 are just a placeholder populated in `populateLazyBindOffsetsInStubHelper`. try atom.addRelocation(self, .{ - .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_BRANCH26), + .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_BRANCH26), .target = .{ .sym_index = self.stub_helper_preamble_atom.?.sym_index, .file = null }, .offset = 4, .addend = 0, @@ -1348,7 +1348,7 @@ pub fn createLazyPointerAtom(self: *MachO, stub_sym_index: u32, target: SymbolWi sym.n_sect = self.la_symbol_ptr_section_index.? + 1; try atom.addRelocation(self, .{ - .@"type" = switch (self.base.options.target.cpu.arch) { + .type = switch (self.base.options.target.cpu.arch) { .aarch64 => @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED), .x86_64 => @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED), else => unreachable, @@ -1414,7 +1414,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom { code[1] = 0x25; try atom.addRelocation(self, .{ - .@"type" = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_BRANCH), + .type = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_BRANCH), .target = .{ .sym_index = laptr_sym_index, .file = null }, .offset = 2, .addend = 0, @@ -1436,7 +1436,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom { try atom.addRelocations(self, 2, .{ .{ - .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGE21), + .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGE21), .target = .{ .sym_index = laptr_sym_index, .file = null }, .offset = 0, .addend = 0, @@ -1444,7 +1444,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom { .length = 2, }, .{ - .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGEOFF12), + .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGEOFF12), .target = .{ .sym_index = laptr_sym_index, .file = null }, .offset = 4, .addend = 0, @@ -2446,7 +2446,7 @@ pub fn getOutputSection(self: *MachO, sect: macho.section_64) !?u8 { break :blk null; } - switch (sect.@"type"()) { + switch (sect.type()) { macho.S_4BYTE_LITERALS, macho.S_8BYTE_LITERALS, macho.S_16BYTE_LITERALS, @@ -2827,7 +2827,7 @@ pub fn getDeclVAddr(self: *MachO, decl_index: Module.Decl.Index, reloc_info: Fil const atom = self.getAtomForSymbol(.{ .sym_index = reloc_info.parent_atom_index, .file = null }).?; try atom.addRelocation(self, .{ - .@"type" = switch (self.base.options.target.cpu.arch) { + .type = switch (self.base.options.target.cpu.arch) { .aarch64 => @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED), .x86_64 => @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED), else => unreachable, @@ -3345,10 +3345,10 @@ fn allocateAtom(self: *MachO, atom: *Atom, new_atom_size: u64, alignment: u64) ! fn getSectionPrecedence(header: macho.section_64) u4 { if (header.isCode()) { if (mem.eql(u8, "__text", header.sectName())) return 0x0; - if (header.@"type"() == macho.S_SYMBOL_STUBS) return 0x1; + if (header.type() == macho.S_SYMBOL_STUBS) return 0x1; return 0x2; } - switch (header.@"type"()) { + switch (header.type()) { macho.S_NON_LAZY_SYMBOL_POINTERS, macho.S_LAZY_SYMBOL_POINTERS, => return 0x0, diff --git a/src/link/MachO/DebugSymbols.zig b/src/link/MachO/DebugSymbols.zig index f0c3ee4f3c..60fb015bee 100644 --- a/src/link/MachO/DebugSymbols.zig +++ b/src/link/MachO/DebugSymbols.zig @@ -47,7 +47,7 @@ strtab: StringTable(.strtab) = .{}, relocs: std.ArrayListUnmanaged(Reloc) = .{}, pub const Reloc = struct { - @"type": enum { + type: enum { direct_load, got_load, }, @@ -188,7 +188,7 @@ pub fn flushModule(self: *DebugSymbols, allocator: Allocator, options: link.Opti const module = options.module orelse return error.LinkingWithoutZigSourceUnimplemented; for (self.relocs.items) |*reloc| { - const sym = switch (reloc.@"type") { + const sym = switch (reloc.type) { .direct_load => self.base.getSymbol(.{ .sym_index = reloc.target, .file = null }), .got_load => blk: { const got_index = self.base.got_entries_table.get(.{ @@ -201,7 +201,7 @@ pub fn flushModule(self: *DebugSymbols, allocator: Allocator, options: link.Opti }; if (sym.n_value == reloc.prev_vaddr) continue; - const sym_name = switch (reloc.@"type") { + const sym_name = switch (reloc.type) { .direct_load => self.base.getSymbolName(.{ .sym_index = reloc.target, .file = null }), .got_load => blk: { const got_index = self.base.got_entries_table.get(.{ diff --git a/src/link/MachO/DwarfInfo.zig b/src/link/MachO/DwarfInfo.zig index a8f44df5c3..1ec4a79871 100644 --- a/src/link/MachO/DwarfInfo.zig +++ b/src/link/MachO/DwarfInfo.zig @@ -185,7 +185,7 @@ const AbbrevEntryIterator = struct { self.pos += (math.cast(usize, creader.bytes_read) orelse return error.Overflow); if (kind == 0) { - return AbbrevEntry.@"null"(); + return AbbrevEntry.null(); } const abbrev_pos = lookup.get(kind) orelse return error.MalformedDwarf; diff --git a/src/link/MachO/Relocation.zig b/src/link/MachO/Relocation.zig index 338bcb66cb..ca6bf9d681 100644 --- a/src/link/MachO/Relocation.zig +++ b/src/link/MachO/Relocation.zig @@ -13,7 +13,7 @@ const Atom = @import("Atom.zig"); const MachO = @import("../MachO.zig"); const SymbolWithLoc = MachO.SymbolWithLoc; -@"type": u4, +type: u4, target: SymbolWithLoc, offset: u32, addend: i64, @@ -23,22 +23,22 @@ dirty: bool = true, pub fn fmtType(self: Relocation, target: std.Target) []const u8 { switch (target.cpu.arch) { - .aarch64 => return @tagName(@intToEnum(macho.reloc_type_arm64, self.@"type")), - .x86_64 => return @tagName(@intToEnum(macho.reloc_type_x86_64, self.@"type")), + .aarch64 => return @tagName(@intToEnum(macho.reloc_type_arm64, self.type)), + .x86_64 => return @tagName(@intToEnum(macho.reloc_type_x86_64, self.type)), else => unreachable, } } pub fn getTargetAtom(self: Relocation, macho_file: *MachO) ?*Atom { switch (macho_file.base.options.target.cpu.arch) { - .aarch64 => switch (@intToEnum(macho.reloc_type_arm64, self.@"type")) { + .aarch64 => switch (@intToEnum(macho.reloc_type_arm64, self.type)) { .ARM64_RELOC_GOT_LOAD_PAGE21, .ARM64_RELOC_GOT_LOAD_PAGEOFF12, .ARM64_RELOC_POINTER_TO_GOT, => return macho_file.getGotAtomForSymbol(self.target), else => {}, }, - .x86_64 => switch (@intToEnum(macho.reloc_type_x86_64, self.@"type")) { + .x86_64 => switch (@intToEnum(macho.reloc_type_x86_64, self.type)) { .X86_64_RELOC_GOT, .X86_64_RELOC_GOT_LOAD, => return macho_file.getGotAtomForSymbol(self.target), @@ -79,7 +79,7 @@ fn resolveAarch64( target_addr: i64, base_offset: u64, ) !void { - const rel_type = @intToEnum(macho.reloc_type_arm64, self.@"type"); + const rel_type = @intToEnum(macho.reloc_type_arm64, self.type); if (rel_type == .ARM64_RELOC_UNSIGNED) { var buffer: [@sizeOf(u64)]u8 = undefined; const code = blk: { @@ -232,7 +232,7 @@ fn resolveX8664( target_addr: i64, base_offset: u64, ) !void { - const rel_type = @intToEnum(macho.reloc_type_x86_64, self.@"type"); + const rel_type = @intToEnum(macho.reloc_type_x86_64, self.type); var buffer: [@sizeOf(u64)]u8 = undefined; const code = blk: { switch (rel_type) { diff --git a/src/link/MachO/ZldAtom.zig b/src/link/MachO/ZldAtom.zig index 817aa81662..8d4b6dfb2d 100644 --- a/src/link/MachO/ZldAtom.zig +++ b/src/link/MachO/ZldAtom.zig @@ -596,7 +596,7 @@ fn resolveRelocsArm64( const is_tlv = is_tlv: { const source_sym = zld.getSymbol(atom.getSymbolWithLoc()); const header = zld.sections.items(.header)[source_sym.n_sect - 1]; - break :is_tlv header.@"type"() == macho.S_THREAD_LOCAL_VARIABLES; + break :is_tlv header.type() == macho.S_THREAD_LOCAL_VARIABLES; }; const target_addr = try getRelocTargetAddress(zld, rel, target, is_tlv); @@ -877,7 +877,7 @@ fn resolveRelocsX86( const is_tlv = is_tlv: { const source_sym = zld.getSymbol(atom.getSymbolWithLoc()); const header = zld.sections.items(.header)[source_sym.n_sect - 1]; - break :is_tlv header.@"type"() == macho.S_THREAD_LOCAL_VARIABLES; + break :is_tlv header.type() == macho.S_THREAD_LOCAL_VARIABLES; }; log.debug(" | source_addr = 0x{x}", .{source_addr}); diff --git a/src/link/MachO/dead_strip.zig b/src/link/MachO/dead_strip.zig index b02a8b5264..aee03bb1d9 100644 --- a/src/link/MachO/dead_strip.zig +++ b/src/link/MachO/dead_strip.zig @@ -107,7 +107,7 @@ fn collectRoots(zld: *Zld, roots: *AtomTable) !void { }; const source_sect = object.getSourceSection(sect_id); if (source_sect.isDontDeadStrip()) break :blk true; - switch (source_sect.@"type"()) { + switch (source_sect.type()) { macho.S_MOD_INIT_FUNC_POINTERS, macho.S_MOD_TERM_FUNC_POINTERS, => break :blk true, diff --git a/src/link/MachO/zld.zig b/src/link/MachO/zld.zig index 3a2ea79c6e..5baaf71f18 100644 --- a/src/link/MachO/zld.zig +++ b/src/link/MachO/zld.zig @@ -396,7 +396,7 @@ pub const Zld = struct { break :blk null; } - switch (sect.@"type"()) { + switch (sect.type()) { macho.S_4BYTE_LITERALS, macho.S_8BYTE_LITERALS, macho.S_16BYTE_LITERALS, @@ -1701,7 +1701,7 @@ pub const Zld = struct { break :outer; } } - switch (header.@"type"()) { + switch (header.type()) { macho.S_NON_LAZY_SYMBOL_POINTERS => { try self.writeGotPointer(count, buffer.writer()); }, @@ -1718,7 +1718,7 @@ pub const Zld = struct { break :outer; } } - if (header.@"type"() == macho.S_SYMBOL_STUBS) { + if (header.type() == macho.S_SYMBOL_STUBS) { try self.writeStubCode(atom_index, count, buffer.writer()); } else if (mem.eql(u8, header.sectName(), "__stub_helper")) { try self.writeStubHelperCode(atom_index, buffer.writer()); @@ -1802,7 +1802,7 @@ pub const Zld = struct { for (slice.items(.header)) |*header, sect_id| { if (header.size == 0) continue; if (self.requiresThunks()) { - if (header.isCode() and !(header.@"type"() == macho.S_SYMBOL_STUBS) and !mem.eql(u8, header.sectName(), "__stub_helper")) continue; + if (header.isCode() and !(header.type() == macho.S_SYMBOL_STUBS) and !mem.eql(u8, header.sectName(), "__stub_helper")) continue; } var atom_index = slice.items(.first_atom_index)[sect_id]; @@ -1830,7 +1830,7 @@ pub const Zld = struct { if (self.requiresThunks()) { for (slice.items(.header)) |header, sect_id| { if (!header.isCode()) continue; - if (header.@"type"() == macho.S_SYMBOL_STUBS) continue; + if (header.type() == macho.S_SYMBOL_STUBS) continue; if (mem.eql(u8, header.sectName(), "__stub_helper")) continue; // Create jump/branch range extenders if needed. @@ -1994,10 +1994,10 @@ pub const Zld = struct { const section_precedence: u4 = blk: { if (header.isCode()) { if (mem.eql(u8, "__text", header.sectName())) break :blk 0x0; - if (header.@"type"() == macho.S_SYMBOL_STUBS) break :blk 0x1; + if (header.type() == macho.S_SYMBOL_STUBS) break :blk 0x1; break :blk 0x2; } - switch (header.@"type"()) { + switch (header.type()) { macho.S_NON_LAZY_SYMBOL_POINTERS, macho.S_LAZY_SYMBOL_POINTERS, => break :blk 0x0, @@ -2121,7 +2121,7 @@ pub const Zld = struct { // Finally, unpack the rest. for (slice.items(.header)) |header, sect_id| { - switch (header.@"type"()) { + switch (header.type()) { macho.S_LITERAL_POINTERS, macho.S_REGULAR, macho.S_MOD_INIT_FUNC_POINTERS, @@ -2252,7 +2252,7 @@ pub const Zld = struct { // Finally, unpack the rest. const slice = self.sections.slice(); for (slice.items(.header)) |header, sect_id| { - switch (header.@"type"()) { + switch (header.type()) { macho.S_LITERAL_POINTERS, macho.S_REGULAR, macho.S_MOD_INIT_FUNC_POINTERS, diff --git a/src/test.zig b/src/test.zig index c6d55b806e..c32cd84686 100644 --- a/src/test.zig +++ b/src/test.zig @@ -213,7 +213,7 @@ const TestManifestConfigDefaults = struct { /// /// build test const TestManifest = struct { - @"type": Type, + type: Type, config_map: std.StringHashMap([]const u8), trailing_bytes: []const u8 = "", @@ -294,7 +294,7 @@ const TestManifest = struct { }; var manifest: TestManifest = .{ - .@"type" = tt, + .type = tt, .config_map = std.StringHashMap([]const u8).init(arena), }; @@ -320,7 +320,7 @@ const TestManifest = struct { key: []const u8, comptime T: type, ) ConfigValueIterator(T) { - const bytes = self.config_map.get(key) orelse TestManifestConfigDefaults.get(self.@"type", key); + const bytes = self.config_map.get(key) orelse TestManifestConfigDefaults.get(self.type, key); return ConfigValueIterator(T){ .inner = std.mem.split(u8, bytes, ","), }; @@ -1157,7 +1157,7 @@ pub const TestContext = struct { for (cases.items) |case_index| { const case = &ctx.cases.items[case_index]; - switch (manifest.@"type") { + switch (manifest.type) { .@"error" => { const errors = try manifest.trailingAlloc(ctx.arena); switch (strategy) { diff --git a/src/type.zig b/src/type.zig index 73c88cea03..710b2fe4a3 100644 --- a/src/type.zig +++ b/src/type.zig @@ -80,8 +80,8 @@ pub const Type = extern union { .comptime_int => return .ComptimeInt, .comptime_float => return .ComptimeFloat, .noreturn => return .NoReturn, - .@"null" => return .Null, - .@"undefined" => return .Undefined, + .null => return .Null, + .undefined => return .Undefined, .fn_noreturn_no_args => return .Fn, .fn_void_no_args => return .Fn, @@ -556,9 +556,9 @@ pub const Type = extern union { .comptime_int, .comptime_float, .noreturn, - .@"null", - .@"undefined", - .@"anyopaque", + .null, + .undefined, + .anyopaque, .@"anyframe", .enum_literal, => |a_tag| { @@ -962,12 +962,12 @@ pub const Type = extern union { .comptime_int => std.hash.autoHash(hasher, std.builtin.TypeId.ComptimeInt), .comptime_float => std.hash.autoHash(hasher, std.builtin.TypeId.ComptimeFloat), .noreturn => std.hash.autoHash(hasher, std.builtin.TypeId.NoReturn), - .@"null" => std.hash.autoHash(hasher, std.builtin.TypeId.Null), - .@"undefined" => std.hash.autoHash(hasher, std.builtin.TypeId.Undefined), + .null => std.hash.autoHash(hasher, std.builtin.TypeId.Null), + .undefined => std.hash.autoHash(hasher, std.builtin.TypeId.Undefined), - .@"anyopaque" => { + .anyopaque => { std.hash.autoHash(hasher, std.builtin.TypeId.Opaque); - std.hash.autoHash(hasher, Tag.@"anyopaque"); + std.hash.autoHash(hasher, Tag.anyopaque); }, .@"anyframe" => { @@ -1299,8 +1299,8 @@ pub const Type = extern union { .comptime_int, .comptime_float, .noreturn, - .@"null", - .@"undefined", + .null, + .undefined, .fn_noreturn_no_args, .fn_void_no_args, .fn_naked_noreturn_no_args, @@ -1596,8 +1596,8 @@ pub const Type = extern union { => return writer.writeAll(@tagName(t)), .enum_literal => return writer.writeAll("@Type(.EnumLiteral)"), - .@"null" => return writer.writeAll("@Type(.Null)"), - .@"undefined" => return writer.writeAll("@Type(.Undefined)"), + .null => return writer.writeAll("@Type(.Null)"), + .undefined => return writer.writeAll("@Type(.Undefined)"), .empty_struct, .empty_struct_literal => return writer.writeAll("struct {}"), @@ -1979,8 +1979,8 @@ pub const Type = extern union { => try writer.writeAll(@tagName(t)), .enum_literal => try writer.writeAll("@TypeOf(.enum_literal)"), - .@"null" => try writer.writeAll("@TypeOf(null)"), - .@"undefined" => try writer.writeAll("@TypeOf(undefined)"), + .null => try writer.writeAll("@TypeOf(null)"), + .undefined => try writer.writeAll("@TypeOf(undefined)"), .empty_struct_literal => try writer.writeAll("@TypeOf(.{})"), .empty_struct => { @@ -2282,8 +2282,8 @@ pub const Type = extern union { .comptime_int => return Value.initTag(.comptime_int_type), .comptime_float => return Value.initTag(.comptime_float_type), .noreturn => return Value.initTag(.noreturn_type), - .@"null" => return Value.initTag(.null_type), - .@"undefined" => return Value.initTag(.undefined_type), + .null => return Value.initTag(.null_type), + .undefined => return Value.initTag(.undefined_type), .fn_noreturn_no_args => return Value.initTag(.fn_noreturn_no_args_type), .fn_void_no_args => return Value.initTag(.fn_void_no_args_type), .fn_naked_noreturn_no_args => return Value.initTag(.fn_naked_noreturn_no_args_type), @@ -2420,8 +2420,8 @@ pub const Type = extern union { .comptime_int, .comptime_float, .noreturn, - .@"null", - .@"undefined", + .null, + .undefined, .enum_literal, .empty_struct, .empty_struct_literal, @@ -2600,9 +2600,9 @@ pub const Type = extern union { .anyopaque, .anyerror, .noreturn, - .@"null", + .null, .@"anyframe", - .@"undefined", + .undefined, .atomic_order, .atomic_rmw_op, .calling_convention, @@ -3109,8 +3109,8 @@ pub const Type = extern union { .type, .comptime_int, .comptime_float, - .@"null", - .@"undefined", + .null, + .undefined, .enum_literal, .type_info, => return AbiAlignmentAdvanced{ .scalar = 0 }, @@ -3231,8 +3231,8 @@ pub const Type = extern union { .type, .comptime_int, .comptime_float, - .@"null", - .@"undefined", + .null, + .undefined, .enum_literal, .single_const_pointer_to_comptime_int, .empty_struct_literal, @@ -3554,8 +3554,8 @@ pub const Type = extern union { .comptime_int => unreachable, .comptime_float => unreachable, .noreturn => unreachable, - .@"null" => unreachable, - .@"undefined" => unreachable, + .null => unreachable, + .undefined => unreachable, .enum_literal => unreachable, .single_const_pointer_to_comptime_int => unreachable, .empty_struct => unreachable, @@ -4157,7 +4157,7 @@ pub const Type = extern union { .optional_single_const_pointer => ty.castPointer().?.data, .anyframe_T => ty.castTag(.anyframe_T).?.data, - .@"anyframe" => Type.@"void", + .@"anyframe" => Type.void, else => unreachable, }; @@ -4975,7 +4975,7 @@ pub const Type = extern union { var buf: Payload.ElemType = undefined; const child_ty = ty.optionalChild(&buf); if (child_ty.isNoReturn()) { - return Value.@"null"; + return Value.null; } else { return null; } @@ -5057,8 +5057,8 @@ pub const Type = extern union { .empty_struct, .empty_struct_literal => return Value.initTag(.empty_struct_value), .void => return Value.initTag(.void_value), .noreturn => return Value.initTag(.unreachable_value), - .@"null" => return Value.initTag(.null_value), - .@"undefined" => return Value.initTag(.undef), + .null => return Value.initTag(.null_value), + .undefined => return Value.initTag(.undef), .int_unsigned, .int_signed => { if (ty.cast(Payload.Bits).?.data == 0) { @@ -5121,8 +5121,8 @@ pub const Type = extern union { .anyerror, .noreturn, .@"anyframe", - .@"null", - .@"undefined", + .null, + .undefined, .atomic_order, .atomic_rmw_op, .calling_convention, @@ -5937,8 +5937,8 @@ pub const Type = extern union { comptime_float, noreturn, @"anyframe", - @"null", - @"undefined", + null, + undefined, enum_literal, atomic_order, atomic_rmw_op, @@ -6062,8 +6062,8 @@ pub const Type = extern union { .comptime_float, .noreturn, .enum_literal, - .@"null", - .@"undefined", + .null, + .undefined, .fn_noreturn_no_args, .fn_void_no_args, .fn_naked_noreturn_no_args, @@ -6420,7 +6420,7 @@ pub const Type = extern union { pub const @"type" = initTag(.type); pub const @"anyerror" = initTag(.anyerror); pub const @"anyopaque" = initTag(.anyopaque); - pub const @"null" = initTag(.@"null"); + pub const @"null" = initTag(.null); pub const err_int = Type.u16; @@ -6559,7 +6559,7 @@ pub const Type = extern union { mod: *Module, ) Allocator.Error!Type { assert(error_set.zigTypeTag() == .ErrorSet); - if (error_set.eql(Type.@"anyerror", mod) and + if (error_set.eql(Type.anyerror, mod) and payload.eql(Type.void, mod)) { return Type.initTag(.anyerror_void_error_union); diff --git a/src/value.zig b/src/value.zig index 16b6cc87b7..61d7840e04 100644 --- a/src/value.zig +++ b/src/value.zig @@ -941,8 +941,8 @@ pub const Value = extern union { .comptime_int_type => Type.initTag(.comptime_int), .comptime_float_type => Type.initTag(.comptime_float), .noreturn_type => Type.initTag(.noreturn), - .null_type => Type.initTag(.@"null"), - .undefined_type => Type.initTag(.@"undefined"), + .null_type => Type.initTag(.null), + .undefined_type => Type.initTag(.undefined), .fn_noreturn_no_args_type => Type.initTag(.fn_noreturn_no_args), .fn_void_no_args_type => Type.initTag(.fn_void_no_args), .fn_naked_noreturn_no_args_type => Type.initTag(.fn_naked_noreturn_no_args), @@ -1437,12 +1437,12 @@ pub const Value = extern union { const target = mod.getTarget(); const endian = target.cpu.arch.endian(); switch (ty.zigTypeTag()) { - .Void => return Value.@"void", + .Void => return Value.void, .Bool => { if (buffer[0] == 0) { - return Value.@"false"; + return Value.false; } else { - return Value.@"true"; + return Value.true; } }, .Int, .Enum => { @@ -1542,16 +1542,16 @@ pub const Value = extern union { const target = mod.getTarget(); const endian = target.cpu.arch.endian(); switch (ty.zigTypeTag()) { - .Void => return Value.@"void", + .Void => return Value.void, .Bool => { const byte = switch (endian) { .Big => buffer[buffer.len - bit_offset / 8 - 1], .Little => buffer[bit_offset / 8], }; if (((byte >> @intCast(u3, bit_offset % 8)) & 1) == 0) { - return Value.@"false"; + return Value.false; } else { - return Value.@"true"; + return Value.true; } }, .Int, .Enum => { @@ -5279,7 +5279,7 @@ pub const Value = extern union { pub const @"true" = initTag(.bool_true); pub fn makeBool(x: bool) Value { - return if (x) Value.@"true" else Value.@"false"; + return if (x) Value.true else Value.false; } pub const RuntimeIndex = enum(u32) { diff --git a/test/behavior/bitcast.zig b/test/behavior/bitcast.zig index 8dbd765cb5..0071996056 100644 --- a/test/behavior/bitcast.zig +++ b/test/behavior/bitcast.zig @@ -337,7 +337,7 @@ test "comptime @bitCast packed struct to int and back" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; const S = packed struct { - @"void": void = {}, + void: void = {}, uint: u8 = 13, uint_bit_aligned: u3 = 2, iint_pos: i4 = 1, diff --git a/tools/gen_spirv_spec.zig b/tools/gen_spirv_spec.zig index 11ccce35a2..619143d883 100644 --- a/tools/gen_spirv_spec.zig +++ b/tools/gen_spirv_spec.zig @@ -193,7 +193,6 @@ fn renderOpcodes( try renderOperand(writer, .instruction, inst.opname, inst.operands, extended_structs); } try writer.writeAll("};\n}\n};\n"); - _ = extended_structs; } fn renderOperandKinds(