diff options
Diffstat (limited to 'lib')
39 files changed, 85 insertions, 85 deletions
diff --git a/lib/compiler/resinator/main.zig b/lib/compiler/resinator/main.zig index 3266b7921f..a96289ceec 100644 --- a/lib/compiler/resinator/main.zig +++ b/lib/compiler/resinator/main.zig @@ -525,7 +525,7 @@ fn getIncludePaths(arena: std.mem.Allocator, auto_includes_option: cli.Options.A }; const target = std.zig.resolveTargetQueryOrFatal(target_query); const is_native_abi = target_query.isNativeAbi(); - const detected_libc = std.zig.LibCDirs.detect(arena, zig_lib_dir, target, is_native_abi, true, null) catch { + const detected_libc = std.zig.LibCDirs.detect(arena, zig_lib_dir, &target, is_native_abi, true, null) catch { if (includes == .any) { // fall back to mingw includes = .gnu; @@ -550,7 +550,7 @@ fn getIncludePaths(arena: std.mem.Allocator, auto_includes_option: cli.Options.A }; const target = std.zig.resolveTargetQueryOrFatal(target_query); const is_native_abi = target_query.isNativeAbi(); - const detected_libc = std.zig.LibCDirs.detect(arena, zig_lib_dir, target, is_native_abi, true, null) catch |err| switch (err) { + const detected_libc = std.zig.LibCDirs.detect(arena, zig_lib_dir, &target, is_native_abi, true, null) catch |err| switch (err) { error.OutOfMemory => |e| return e, else => return error.MingwIncludesNotFound, }; diff --git a/lib/compiler_rt/divmodei4.zig b/lib/compiler_rt/divmodei4.zig index 9e5e4333b9..3f12e8697d 100644 --- a/lib/compiler_rt/divmodei4.zig +++ b/lib/compiler_rt/divmodei4.zig @@ -35,7 +35,7 @@ fn divmod(q: ?[]u32, r: ?[]u32, u: []u32, v: []u32) !void { pub fn __divei4(q_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) void { @setRuntimeSafety(builtin.is_test); - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size])); const u: []u32 = @ptrCast(@alignCast(u_p[0..byte_size])); const v: []u32 = @ptrCast(@alignCast(v_p[0..byte_size])); @@ -44,7 +44,7 @@ pub fn __divei4(q_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) vo pub fn __modei4(r_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) void { @setRuntimeSafety(builtin.is_test); - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size])); const u: []u32 = @ptrCast(@alignCast(u_p[0..byte_size])); const v: []u32 = @ptrCast(@alignCast(v_p[0..byte_size])); diff --git a/lib/compiler_rt/fixdfei.zig b/lib/compiler_rt/fixdfei.zig index 95189b0f7b..31c7994c58 100644 --- a/lib/compiler_rt/fixdfei.zig +++ b/lib/compiler_rt/fixdfei.zig @@ -10,6 +10,6 @@ comptime { } pub fn __fixdfei(r: [*]u8, bits: usize, a: f64) callconv(.c) void { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return bigIntFromFloat(.signed, @ptrCast(@alignCast(r[0..byte_size])), a); } diff --git a/lib/compiler_rt/fixhfei.zig b/lib/compiler_rt/fixhfei.zig index c4532f18c0..c7f30055c5 100644 --- a/lib/compiler_rt/fixhfei.zig +++ b/lib/compiler_rt/fixhfei.zig @@ -10,6 +10,6 @@ comptime { } pub fn __fixhfei(r: [*]u8, bits: usize, a: f16) callconv(.c) void { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return bigIntFromFloat(.signed, @ptrCast(@alignCast(r[0..byte_size])), a); } diff --git a/lib/compiler_rt/fixsfei.zig b/lib/compiler_rt/fixsfei.zig index 8182ca0551..c72e002fb1 100644 --- a/lib/compiler_rt/fixsfei.zig +++ b/lib/compiler_rt/fixsfei.zig @@ -10,6 +10,6 @@ comptime { } pub fn __fixsfei(r: [*]u8, bits: usize, a: f32) callconv(.c) void { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return bigIntFromFloat(.signed, @ptrCast(@alignCast(r[0..byte_size])), a); } diff --git a/lib/compiler_rt/fixtfei.zig b/lib/compiler_rt/fixtfei.zig index 02a2c164a6..8daf3754f7 100644 --- a/lib/compiler_rt/fixtfei.zig +++ b/lib/compiler_rt/fixtfei.zig @@ -10,6 +10,6 @@ comptime { } pub fn __fixtfei(r: [*]u8, bits: usize, a: f128) callconv(.c) void { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return bigIntFromFloat(.signed, @ptrCast(@alignCast(r[0..byte_size])), a); } diff --git a/lib/compiler_rt/fixunsdfei.zig b/lib/compiler_rt/fixunsdfei.zig index a88c344bc6..886feab66a 100644 --- a/lib/compiler_rt/fixunsdfei.zig +++ b/lib/compiler_rt/fixunsdfei.zig @@ -10,6 +10,6 @@ comptime { } pub fn __fixunsdfei(r: [*]u8, bits: usize, a: f64) callconv(.c) void { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return bigIntFromFloat(.unsigned, @ptrCast(@alignCast(r[0..byte_size])), a); } diff --git a/lib/compiler_rt/fixunshfei.zig b/lib/compiler_rt/fixunshfei.zig index 056d2faaf7..788605a686 100644 --- a/lib/compiler_rt/fixunshfei.zig +++ b/lib/compiler_rt/fixunshfei.zig @@ -10,6 +10,6 @@ comptime { } pub fn __fixunshfei(r: [*]u8, bits: usize, a: f16) callconv(.c) void { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return bigIntFromFloat(.unsigned, @ptrCast(@alignCast(r[0..byte_size])), a); } diff --git a/lib/compiler_rt/fixunssfei.zig b/lib/compiler_rt/fixunssfei.zig index 179e395de0..bb89fc283d 100644 --- a/lib/compiler_rt/fixunssfei.zig +++ b/lib/compiler_rt/fixunssfei.zig @@ -10,6 +10,6 @@ comptime { } pub fn __fixunssfei(r: [*]u8, bits: usize, a: f32) callconv(.c) void { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return bigIntFromFloat(.unsigned, @ptrCast(@alignCast(r[0..byte_size])), a); } diff --git a/lib/compiler_rt/fixunstfei.zig b/lib/compiler_rt/fixunstfei.zig index b69fb31ab6..997a100afa 100644 --- a/lib/compiler_rt/fixunstfei.zig +++ b/lib/compiler_rt/fixunstfei.zig @@ -10,6 +10,6 @@ comptime { } pub fn __fixunstfei(r: [*]u8, bits: usize, a: f128) callconv(.c) void { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return bigIntFromFloat(.unsigned, @ptrCast(@alignCast(r[0..byte_size])), a); } diff --git a/lib/compiler_rt/fixunsxfei.zig b/lib/compiler_rt/fixunsxfei.zig index ca1bae9a80..88c7f18243 100644 --- a/lib/compiler_rt/fixunsxfei.zig +++ b/lib/compiler_rt/fixunsxfei.zig @@ -10,6 +10,6 @@ comptime { } pub fn __fixunsxfei(r: [*]u8, bits: usize, a: f80) callconv(.c) void { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return bigIntFromFloat(.unsigned, @ptrCast(@alignCast(r[0..byte_size])), a); } diff --git a/lib/compiler_rt/fixxfei.zig b/lib/compiler_rt/fixxfei.zig index 5efe7da7e9..6f28153a66 100644 --- a/lib/compiler_rt/fixxfei.zig +++ b/lib/compiler_rt/fixxfei.zig @@ -10,6 +10,6 @@ comptime { } pub fn __fixxfei(r: [*]u8, bits: usize, a: f80) callconv(.c) void { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return bigIntFromFloat(.signed, @ptrCast(@alignCast(r[0..byte_size])), a); } diff --git a/lib/compiler_rt/floateidf.zig b/lib/compiler_rt/floateidf.zig index c540cc1d1c..96411ae878 100644 --- a/lib/compiler_rt/floateidf.zig +++ b/lib/compiler_rt/floateidf.zig @@ -10,6 +10,6 @@ comptime { } pub fn __floateidf(a: [*]const u8, bits: usize) callconv(.c) f64 { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return floatFromBigInt(f64, .signed, @ptrCast(@alignCast(a[0..byte_size]))); } diff --git a/lib/compiler_rt/floateihf.zig b/lib/compiler_rt/floateihf.zig index b9544cc9b0..ac9fd355c7 100644 --- a/lib/compiler_rt/floateihf.zig +++ b/lib/compiler_rt/floateihf.zig @@ -10,6 +10,6 @@ comptime { } pub fn __floateihf(a: [*]const u8, bits: usize) callconv(.c) f16 { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return floatFromBigInt(f16, .signed, @ptrCast(@alignCast(a[0..byte_size]))); } diff --git a/lib/compiler_rt/floateisf.zig b/lib/compiler_rt/floateisf.zig index 6420016d00..f53b75643f 100644 --- a/lib/compiler_rt/floateisf.zig +++ b/lib/compiler_rt/floateisf.zig @@ -10,6 +10,6 @@ comptime { } pub fn __floateisf(a: [*]const u8, bits: usize) callconv(.c) f32 { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return floatFromBigInt(f32, .signed, @ptrCast(@alignCast(a[0..byte_size]))); } diff --git a/lib/compiler_rt/floateitf.zig b/lib/compiler_rt/floateitf.zig index 6dfaac2955..3e07c6becb 100644 --- a/lib/compiler_rt/floateitf.zig +++ b/lib/compiler_rt/floateitf.zig @@ -10,6 +10,6 @@ comptime { } pub fn __floateitf(a: [*]const u8, bits: usize) callconv(.c) f128 { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return floatFromBigInt(f128, .signed, @ptrCast(@alignCast(a[0..byte_size]))); } diff --git a/lib/compiler_rt/floateixf.zig b/lib/compiler_rt/floateixf.zig index 4c76e8b12f..65585e2ed3 100644 --- a/lib/compiler_rt/floateixf.zig +++ b/lib/compiler_rt/floateixf.zig @@ -10,6 +10,6 @@ comptime { } pub fn __floateixf(a: [*]const u8, bits: usize) callconv(.c) f80 { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return floatFromBigInt(f80, .signed, @ptrCast(@alignCast(a[0..byte_size]))); } diff --git a/lib/compiler_rt/floatuneidf.zig b/lib/compiler_rt/floatuneidf.zig index e47ae0309b..c7b1e032ea 100644 --- a/lib/compiler_rt/floatuneidf.zig +++ b/lib/compiler_rt/floatuneidf.zig @@ -10,6 +10,6 @@ comptime { } pub fn __floatuneidf(a: [*]const u8, bits: usize) callconv(.c) f64 { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return floatFromBigInt(f64, .unsigned, @ptrCast(@alignCast(a[0..byte_size]))); } diff --git a/lib/compiler_rt/floatuneihf.zig b/lib/compiler_rt/floatuneihf.zig index cc8962161c..00c53a1919 100644 --- a/lib/compiler_rt/floatuneihf.zig +++ b/lib/compiler_rt/floatuneihf.zig @@ -10,6 +10,6 @@ comptime { } pub fn __floatuneihf(a: [*]const u8, bits: usize) callconv(.c) f16 { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return floatFromBigInt(f16, .unsigned, @ptrCast(@alignCast(a[0..byte_size]))); } diff --git a/lib/compiler_rt/floatuneisf.zig b/lib/compiler_rt/floatuneisf.zig index 325b0afe70..4acb0fa7b2 100644 --- a/lib/compiler_rt/floatuneisf.zig +++ b/lib/compiler_rt/floatuneisf.zig @@ -10,6 +10,6 @@ comptime { } pub fn __floatuneisf(a: [*]const u8, bits: usize) callconv(.c) f32 { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return floatFromBigInt(f32, .unsigned, @ptrCast(@alignCast(a[0..byte_size]))); } diff --git a/lib/compiler_rt/floatuneitf.zig b/lib/compiler_rt/floatuneitf.zig index 727d301f7b..323f44611d 100644 --- a/lib/compiler_rt/floatuneitf.zig +++ b/lib/compiler_rt/floatuneitf.zig @@ -10,6 +10,6 @@ comptime { } pub fn __floatuneitf(a: [*]const u8, bits: usize) callconv(.c) f128 { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return floatFromBigInt(f128, .unsigned, @ptrCast(@alignCast(a[0..byte_size]))); } diff --git a/lib/compiler_rt/floatuneixf.zig b/lib/compiler_rt/floatuneixf.zig index adfa8aa5ee..12157d20a3 100644 --- a/lib/compiler_rt/floatuneixf.zig +++ b/lib/compiler_rt/floatuneixf.zig @@ -10,6 +10,6 @@ comptime { } pub fn __floatuneixf(a: [*]const u8, bits: usize) callconv(.c) f80 { - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); return floatFromBigInt(f80, .unsigned, @ptrCast(@alignCast(a[0..byte_size]))); } diff --git a/lib/compiler_rt/udivmodei4.zig b/lib/compiler_rt/udivmodei4.zig index d84bace9fb..6d6f6c1b65 100644 --- a/lib/compiler_rt/udivmodei4.zig +++ b/lib/compiler_rt/udivmodei4.zig @@ -114,7 +114,7 @@ pub fn divmod(q: ?[]u32, r: ?[]u32, u: []const u32, v: []const u32) !void { pub fn __udivei4(q_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) callconv(.c) void { @setRuntimeSafety(builtin.is_test); - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size])); const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size])); const v: []const u32 = @ptrCast(@alignCast(v_p[0..byte_size])); @@ -123,7 +123,7 @@ pub fn __udivei4(q_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) ca pub fn __umodei4(r_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) callconv(.c) void { @setRuntimeSafety(builtin.is_test); - const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); + const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size])); const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size])); const v: []const u32 = @ptrCast(@alignCast(v_p[0..byte_size])); diff --git a/lib/std/Build/Fuzz/WebServer.zig b/lib/std/Build/Fuzz/WebServer.zig index 87cd7a1a1d..ab44d4e7af 100644 --- a/lib/std/Build/Fuzz/WebServer.zig +++ b/lib/std/Build/Fuzz/WebServer.zig @@ -198,10 +198,10 @@ fn serveWasm( const wasm_base_path = try buildWasmBinary(ws, arena, optimize_mode); const bin_name = try std.zig.binNameAlloc(arena, .{ .root_name = fuzzer_bin_name, - .target = std.zig.system.resolveTargetQuery(std.Build.parseTargetQuery(.{ + .target = &(std.zig.system.resolveTargetQuery(std.Build.parseTargetQuery(.{ .arch_os_abi = fuzzer_arch_os_abi, .cpu_features = fuzzer_cpu_features, - }) catch unreachable) catch unreachable, + }) catch unreachable) catch unreachable), .output_mode = .Exe, }); // std.http.Server does not have a sendfile API yet. diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig index 12b55a8c29..d9c098113f 100644 --- a/lib/std/Build/Module.zig +++ b/lib/std/Build/Module.zig @@ -655,10 +655,10 @@ fn linkLibraryOrObject(m: *Module, other: *Step.Compile) void { m.include_dirs.append(allocator, .{ .other_step = other }) catch @panic("OOM"); } -fn requireKnownTarget(m: *Module) std.Target { - const resolved_target = m.resolved_target orelse - @panic("this API requires the Module to be created with a known 'target' field"); - return resolved_target.result; +fn requireKnownTarget(m: *Module) *const std.Target { + const resolved_target = &(m.resolved_target orelse + @panic("this API requires the Module to be created with a known 'target' field")); + return &resolved_target.result; } /// Elements of `modules` and `names` are matched one-to-one. diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index e10840db75..9352280d96 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -377,7 +377,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile { const resolved_target = options.root_module.resolved_target orelse @panic("the root Module of a Compile step must be created with a known 'target' field"); - const target = resolved_target.result; + const target = &resolved_target.result; const step_name = owner.fmt("compile {s} {s} {s}", .{ // Avoid the common case of the step name looking like "compile test test". @@ -1866,7 +1866,7 @@ fn outputPath(c: *Compile, out_dir: std.Build.Cache.Path, ea: std.zig.EmitArtifa const arena = c.step.owner.graph.arena; const name = ea.cacheName(arena, .{ .root_name = c.name, - .target = c.root_module.resolved_target.?.result, + .target = &c.root_module.resolved_target.?.result, .output_mode = switch (c.kind) { .lib => .Lib, .obj, .test_obj => .Obj, diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig index af7f0ee1a9..aa3931ac8c 100644 --- a/lib/std/Build/Step/Run.zig +++ b/lib/std/Build/Step/Run.zig @@ -1108,7 +1108,7 @@ fn runCommand( const need_cross_libc = exe.is_linking_libc and (root_target.isGnuLibC() or (root_target.isMuslLibC() and exe.linkage == .dynamic)); const other_target = exe.root_module.resolved_target.?.result; - switch (std.zig.system.getExternalExecutor(b.graph.host.result, &other_target, .{ + switch (std.zig.system.getExternalExecutor(&b.graph.host.result, &other_target, .{ .qemu_fixes_dl = need_cross_libc and b.libc_runtimes_dir != null, .link_libc = exe.is_linking_libc, })) { diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 347b3357f5..b31f6c2de9 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -1074,7 +1074,7 @@ pub const ObjectFormat = enum { } }; -pub fn toElfMachine(target: Target) std.elf.EM { +pub fn toElfMachine(target: *const Target) std.elf.EM { return switch (target.cpu.arch) { .amdgcn => .AMDGPU, .arc => .ARC_COMPACT, @@ -1115,7 +1115,7 @@ pub fn toElfMachine(target: Target) std.elf.EM { }; } -pub fn toCoffMachine(target: Target) std.coff.MachineType { +pub fn toCoffMachine(target: *const Target) std.coff.MachineType { return switch (target.cpu.arch) { .arm => .ARM, .thumb => .ARMNT, @@ -1999,7 +1999,7 @@ pub const Cpu = struct { } }; -pub fn zigTriple(target: Target, allocator: Allocator) Allocator.Error![]u8 { +pub fn zigTriple(target: *const Target, allocator: Allocator) Allocator.Error![]u8 { return Query.fromTarget(target).zigTriple(allocator); } @@ -2007,7 +2007,7 @@ pub fn hurdTupleSimple(allocator: Allocator, arch: Cpu.Arch, abi: Abi) ![]u8 { return std.fmt.allocPrint(allocator, "{s}-{s}", .{ @tagName(arch), @tagName(abi) }); } -pub fn hurdTuple(target: Target, allocator: Allocator) ![]u8 { +pub fn hurdTuple(target: *const Target, allocator: Allocator) ![]u8 { return hurdTupleSimple(allocator, target.cpu.arch, target.abi); } @@ -2015,63 +2015,63 @@ pub fn linuxTripleSimple(allocator: Allocator, arch: Cpu.Arch, os_tag: Os.Tag, a return std.fmt.allocPrint(allocator, "{s}-{s}-{s}", .{ @tagName(arch), @tagName(os_tag), @tagName(abi) }); } -pub fn linuxTriple(target: Target, allocator: Allocator) ![]u8 { +pub fn linuxTriple(target: *const Target, allocator: Allocator) ![]u8 { return linuxTripleSimple(allocator, target.cpu.arch, target.os.tag, target.abi); } -pub fn exeFileExt(target: Target) [:0]const u8 { +pub fn exeFileExt(target: *const Target) [:0]const u8 { return target.os.tag.exeFileExt(target.cpu.arch); } -pub fn staticLibSuffix(target: Target) [:0]const u8 { +pub fn staticLibSuffix(target: *const Target) [:0]const u8 { return target.os.tag.staticLibSuffix(target.abi); } -pub fn dynamicLibSuffix(target: Target) [:0]const u8 { +pub fn dynamicLibSuffix(target: *const Target) [:0]const u8 { return target.os.tag.dynamicLibSuffix(); } -pub fn libPrefix(target: Target) [:0]const u8 { +pub fn libPrefix(target: *const Target) [:0]const u8 { return target.os.tag.libPrefix(target.abi); } -pub inline fn isMinGW(target: Target) bool { +pub inline fn isMinGW(target: *const Target) bool { return target.os.tag == .windows and target.abi.isGnu(); } -pub inline fn isGnuLibC(target: Target) bool { +pub inline fn isGnuLibC(target: *const Target) bool { return switch (target.os.tag) { .hurd, .linux => target.abi.isGnu(), else => false, }; } -pub inline fn isMuslLibC(target: Target) bool { +pub inline fn isMuslLibC(target: *const Target) bool { return target.os.tag == .linux and target.abi.isMusl(); } -pub inline fn isDarwinLibC(target: Target) bool { +pub inline fn isDarwinLibC(target: *const Target) bool { return switch (target.abi) { .none, .macabi, .simulator => target.os.tag.isDarwin(), else => false, }; } -pub inline fn isFreeBSDLibC(target: Target) bool { +pub inline fn isFreeBSDLibC(target: *const Target) bool { return switch (target.abi) { .none, .eabihf => target.os.tag == .freebsd, else => false, }; } -pub inline fn isNetBSDLibC(target: Target) bool { +pub inline fn isNetBSDLibC(target: *const Target) bool { return switch (target.abi) { .none, .eabi, .eabihf => target.os.tag == .netbsd, else => false, }; } -pub inline fn isWasiLibC(target: Target) bool { +pub inline fn isWasiLibC(target: *const Target) bool { return target.os.tag == .wasi and target.abi.isMusl(); } @@ -2576,7 +2576,7 @@ pub const DynamicLinker = struct { } }; -pub fn standardDynamicLinkerPath(target: Target) DynamicLinker { +pub fn standardDynamicLinkerPath(target: *const Target) DynamicLinker { return DynamicLinker.standard(target.cpu, target.os, target.abi); } @@ -2645,11 +2645,11 @@ pub fn ptrBitWidth_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) u16 { }; } -pub fn ptrBitWidth(target: Target) u16 { +pub fn ptrBitWidth(target: *const Target) u16 { return ptrBitWidth_cpu_abi(target.cpu, target.abi); } -pub fn stackAlignment(target: Target) u16 { +pub fn stackAlignment(target: *const Target) u16 { // Overrides for when the stack alignment is not equal to the pointer width. switch (target.cpu.arch) { .m68k, @@ -2697,7 +2697,7 @@ pub fn stackAlignment(target: Target) u16 { /// Default signedness of `char` for the native C compiler for this target /// Note that char signedness is implementation-defined and many compilers provide /// an option to override the default signedness e.g. GCC's -funsigned-char / -fsigned-char -pub fn cCharSignedness(target: Target) std.builtin.Signedness { +pub fn cCharSignedness(target: *const Target) std.builtin.Signedness { if (target.os.tag.isDarwin() or target.os.tag == .windows or target.os.tag == .uefi) return .signed; return switch (target.cpu.arch) { @@ -2740,7 +2740,7 @@ pub const CType = enum { longdouble, }; -pub fn cTypeByteSize(t: Target, c_type: CType) u16 { +pub fn cTypeByteSize(t: *const Target, c_type: CType) u16 { return switch (c_type) { .char, .short, @@ -2766,7 +2766,7 @@ pub fn cTypeByteSize(t: Target, c_type: CType) u16 { }; } -pub fn cTypeBitSize(target: Target, c_type: CType) u16 { +pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 { switch (target.os.tag) { .freestanding, .other => switch (target.cpu.arch) { .msp430 => switch (c_type) { @@ -3077,7 +3077,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { } } -pub fn cTypeAlignment(target: Target, c_type: CType) u16 { +pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 { // Overrides for unusual alignments switch (target.cpu.arch) { .avr => return 1, @@ -3172,7 +3172,7 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 { ); } -pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 { +pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 { // Overrides for unusual alignments switch (target.cpu.arch) { .arc => switch (c_type) { @@ -3265,7 +3265,7 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 { ); } -pub fn cMaxIntAlignment(target: std.Target) u16 { +pub fn cMaxIntAlignment(target: *const Target) u16 { return switch (target.cpu.arch) { .avr => 1, @@ -3328,7 +3328,7 @@ pub fn cMaxIntAlignment(target: std.Target) u16 { }; } -pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention { +pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention { return switch (target.cpu.arch) { .x86_64 => switch (target.os.tag) { .windows, .uefi => .{ .x86_64_win = .{} }, diff --git a/lib/std/Target/Query.zig b/lib/std/Target/Query.zig index 478c4758f9..e453b70e5c 100644 --- a/lib/std/Target/Query.zig +++ b/lib/std/Target/Query.zig @@ -94,7 +94,7 @@ pub const OsVersion = union(enum) { pub const SemanticVersion = std.SemanticVersion; -pub fn fromTarget(target: Target) Query { +pub fn fromTarget(target: *const Target) Query { var result: Query = .{ .cpu_arch = target.cpu.arch, .cpu_model = .{ .explicit = target.cpu.model }, diff --git a/lib/std/debug/Dwarf/abi.zig b/lib/std/debug/Dwarf/abi.zig index 001e1977f9..e880b12863 100644 --- a/lib/std/debug/Dwarf/abi.zig +++ b/lib/std/debug/Dwarf/abi.zig @@ -9,7 +9,7 @@ const Arch = std.Target.Cpu.Arch; /// /// See also `std.debug.SelfInfo.supportsUnwinding` which tells whether the Zig /// standard library has a working implementation of unwinding for this target. -pub fn supportsUnwinding(target: std.Target) bool { +pub fn supportsUnwinding(target: *const std.Target) bool { return switch (target.cpu.arch) { .amdgcn, .nvptx, diff --git a/lib/std/debug/SelfInfo.zig b/lib/std/debug/SelfInfo.zig index 70f3075de7..a879309870 100644 --- a/lib/std/debug/SelfInfo.zig +++ b/lib/std/debug/SelfInfo.zig @@ -1795,10 +1795,10 @@ fn spRegNum(reg_context: Dwarf.abi.RegisterContext) u8 { const ip_reg_num = Dwarf.abi.ipRegNum(native_arch).?; /// Tells whether unwinding for the host is implemented. -pub const supports_unwinding = supportsUnwinding(builtin.target); +pub const supports_unwinding = supportsUnwinding(&builtin.target); comptime { - if (supports_unwinding) assert(Dwarf.abi.supportsUnwinding(builtin.target)); + if (supports_unwinding) assert(Dwarf.abi.supportsUnwinding(&builtin.target)); } /// Tells whether unwinding for this target is *implemented* here in the Zig @@ -1806,7 +1806,7 @@ comptime { /// /// See also `Dwarf.abi.supportsUnwinding` which tells whether Dwarf supports /// unwinding on that target *in theory*. -pub fn supportsUnwinding(target: std.Target) bool { +pub fn supportsUnwinding(target: *const std.Target) bool { return switch (target.cpu.arch) { .x86 => switch (target.os.tag) { .linux, .netbsd, .solaris, .illumos => true, diff --git a/lib/std/zig.zig b/lib/std/zig.zig index 21f1296766..cf7992baed 100644 --- a/lib/std/zig.zig +++ b/lib/std/zig.zig @@ -141,7 +141,7 @@ pub fn lineDelta(source: []const u8, start: usize, end: usize) isize { pub const BinNameOptions = struct { root_name: []const u8, - target: std.Target, + target: *const std.Target, output_mode: std.builtin.OutputMode, link_mode: ?std.builtin.LinkMode = null, version: ?std.SemanticVersion = null, diff --git a/lib/std/zig/LibCDirs.zig b/lib/std/zig/LibCDirs.zig index 90d4fa4d5f..f742b24c4a 100644 --- a/lib/std/zig/LibCDirs.zig +++ b/lib/std/zig/LibCDirs.zig @@ -15,7 +15,7 @@ pub const DarwinSdkLayout = enum { pub fn detect( arena: Allocator, zig_lib_dir: []const u8, - target: std.Target, + target: *const std.Target, is_native_abi: bool, link_libc: bool, libc_installation: ?*const LibCInstallation, @@ -88,7 +88,7 @@ pub fn detect( }; } -fn detectFromInstallation(arena: Allocator, target: std.Target, lci: *const LibCInstallation) !LibCDirs { +fn detectFromInstallation(arena: Allocator, target: *const std.Target, lci: *const LibCInstallation) !LibCDirs { var list = try std.ArrayList([]const u8).initCapacity(arena, 5); var framework_list = std.ArrayList([]const u8).init(arena); @@ -146,7 +146,7 @@ fn detectFromInstallation(arena: Allocator, target: std.Target, lci: *const LibC pub fn detectFromBuilding( arena: Allocator, zig_lib_dir: []const u8, - target: std.Target, + target: *const std.Target, ) !LibCDirs { const s = std.fs.path.sep_str; @@ -224,7 +224,7 @@ pub fn detectFromBuilding( }; } -fn libCGenericName(target: std.Target) [:0]const u8 { +fn libCGenericName(target: *const std.Target) [:0]const u8 { switch (target.os.tag) { .windows => return "mingw", .macos, .ios, .tvos, .watchos, .visionos => return "darwin", diff --git a/lib/std/zig/LibCInstallation.zig b/lib/std/zig/LibCInstallation.zig index 78b35517a6..e2b7cd233d 100644 --- a/lib/std/zig/LibCInstallation.zig +++ b/lib/std/zig/LibCInstallation.zig @@ -26,7 +26,7 @@ pub const FindError = error{ pub fn parse( allocator: Allocator, libc_file: []const u8, - target: std.Target, + target: *const std.Target, ) !LibCInstallation { var self: LibCInstallation = .{}; @@ -157,7 +157,7 @@ pub fn render(self: LibCInstallation, out: anytype) !void { pub const FindNativeOptions = struct { allocator: Allocator, - target: std.Target, + target: *const std.Target, /// If enabled, will print human-friendly errors to stderr. verbose: bool = false, @@ -700,7 +700,7 @@ pub const CrtBasenames = struct { crtn: ?[]const u8 = null, pub const GetArgs = struct { - target: std.Target, + target: *const std.Target, link_libc: bool, output_mode: std.builtin.OutputMode, link_mode: std.builtin.LinkMode, @@ -965,7 +965,7 @@ pub fn resolveCrtPaths( lci: LibCInstallation, arena: Allocator, crt_basenames: CrtBasenames, - target: std.Target, + target: *const std.Target, ) error{ OutOfMemory, LibCInstallationMissingCrtDir }!CrtPaths { const crt_dir_path: Path = .{ .root_dir = std.Build.Cache.Directory.cwd(), diff --git a/lib/std/zig/llvm/Builder.zig b/lib/std/zig/llvm/Builder.zig index 865e1efa6d..ff661aa1c7 100644 --- a/lib/std/zig/llvm/Builder.zig +++ b/lib/std/zig/llvm/Builder.zig @@ -66,7 +66,7 @@ pub const Options = struct { allocator: Allocator, strip: bool = true, name: []const u8 = &.{}, - target: std.Target = builtin.target, + target: *const std.Target = &builtin.target, triple: []const u8 = &.{}, }; diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index cf772cb65f..ba43543ee2 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -28,7 +28,7 @@ pub const GetExternalExecutorOptions = struct { /// Return whether or not the given host is capable of running executables of /// the other target. pub fn getExternalExecutor( - host: std.Target, + host: *const std.Target, candidate: *const std.Target, options: GetExternalExecutorOptions, ) Executor { diff --git a/lib/std/zig/system/NativePaths.zig b/lib/std/zig/system/NativePaths.zig index 33b3782f9d..47af64bc96 100644 --- a/lib/std/zig/system/NativePaths.zig +++ b/lib/std/zig/system/NativePaths.zig @@ -13,7 +13,7 @@ framework_dirs: std.ArrayListUnmanaged([]const u8) = .empty, rpaths: std.ArrayListUnmanaged([]const u8) = .empty, warnings: std.ArrayListUnmanaged([]const u8) = .empty, -pub fn detect(arena: Allocator, native_target: std.Target) !NativePaths { +pub fn detect(arena: Allocator, native_target: *const std.Target) !NativePaths { var self: NativePaths = .{ .arena = arena }; var is_nix = false; if (process.getEnvVarOwned(arena, "NIX_CFLAGS_COMPILE")) |nix_cflags_compile| { diff --git a/lib/std/zig/system/darwin.zig b/lib/std/zig/system/darwin.zig index f3088cfbfe..a5f28c2206 100644 --- a/lib/std/zig/system/darwin.zig +++ b/lib/std/zig/system/darwin.zig @@ -34,7 +34,7 @@ pub fn isSdkInstalled(allocator: Allocator) bool { /// Caller owns the memory. /// stderr from xcrun is ignored. /// If error.OutOfMemory occurs in Allocator, this function returns null. -pub fn getSdk(allocator: Allocator, target: Target) ?[]const u8 { +pub fn getSdk(allocator: Allocator, target: *const Target) ?[]const u8 { const is_simulator_abi = target.abi == .simulator; const sdk = switch (target.os.tag) { .ios => switch (target.abi) { diff --git a/lib/std/zig/target.zig b/lib/std/zig/target.zig index ec932fe9d9..873aa64688 100644 --- a/lib/std/zig/target.zig +++ b/lib/std/zig/target.zig @@ -116,7 +116,7 @@ pub const freebsd_libc_version: std.SemanticVersion = .{ .major = 14, .minor = 0 /// The version of Zig's bundled NetBSD libc used when linking libc statically. pub const netbsd_libc_version: std.SemanticVersion = .{ .major = 10, .minor = 1, .patch = 0 }; -pub fn canBuildLibC(target: std.Target) bool { +pub fn canBuildLibC(target: *const std.Target) bool { for (available_libcs) |libc| { if (target.cpu.arch == libc.arch and target.os.tag == libc.os and target.abi == libc.abi) { if (libc.os_ver) |libc_os_ver| { @@ -176,7 +176,7 @@ pub fn muslRuntimeTriple( return std.Target.linuxTripleSimple(allocator, arch, .linux, abi); } -pub fn osArchName(target: std.Target) [:0]const u8 { +pub fn osArchName(target: *const std.Target) [:0]const u8 { return switch (target.os.tag) { .linux => switch (target.cpu.arch) { .arm, .armeb, .thumb, .thumbeb => "arm", @@ -276,7 +276,7 @@ pub fn netbsdAbiNameHeaders(abi: std.Target.Abi) [:0]const u8 { }; } -pub fn isLibCLibName(target: std.Target, name: []const u8) bool { +pub fn isLibCLibName(target: *const std.Target, name: []const u8) bool { const ignore_case = target.os.tag.isDarwin() or target.os.tag == .windows; if (eqlIgnoreCase(ignore_case, name, "c")) @@ -453,7 +453,7 @@ pub fn isLibCLibName(target: std.Target, name: []const u8) bool { return false; } -pub fn isLibCxxLibName(target: std.Target, name: []const u8) bool { +pub fn isLibCxxLibName(target: *const std.Target, name: []const u8) bool { const ignore_case = target.os.tag.isDarwin() or target.os.tag == .windows; return eqlIgnoreCase(ignore_case, name, "c++") or @@ -470,11 +470,11 @@ fn eqlIgnoreCase(ignore_case: bool, a: []const u8, b: []const u8) bool { } } -pub fn intByteSize(target: std.Target, bits: u16) u19 { +pub fn intByteSize(target: *const std.Target, bits: u16) u19 { return std.mem.alignForward(u19, @intCast((@as(u17, bits) + 7) / 8), intAlignment(target, bits)); } -pub fn intAlignment(target: std.Target, bits: u16) u16 { +pub fn intAlignment(target: *const std.Target, bits: u16) u16 { return switch (target.cpu.arch) { .x86 => switch (bits) { 0 => 0, |
