| author | |
| committer | |
| log | 1b56686012c49b34f395c82741b03587633aaa31 |
| tree | 8e2e9b1020f48044796b56b84f9fe84dbbee45f1 |
| parent | f2cf7b538f5c8ec0da69715d39ad6d433f3168d6 |
10 files changed, 45 insertions(+), 46 deletions(-)
lib/compiler/resinator/main.zig+28-4| ... | ... | @@ -24,7 +24,10 @@ pub fn main(init: std.process.Init.Minimal) !void { |
| 24 | 24 | defer std.debug.assert(debug_allocator.deinit() == .ok); |
| 25 | 25 | const gpa = debug_allocator.allocator(); |
| 26 | 26 | |
| 27 | var threaded: std.Io.Threaded = .init(gpa, .{}); | |
| 27 | var threaded: std.Io.Threaded = .init(gpa, .{ | |
| 28 | .environ = init.environ, | |
| 29 | .argv0 = .init(init.args), | |
| 30 | }); | |
| 28 | 31 | defer threaded.deinit(); |
| 29 | 32 | const io = threaded.io(); |
| 30 | 33 | |
| ... | ... | @@ -536,13 +539,24 @@ const LazyIncludePaths = struct { |
| 536 | 539 | target_machine_type: std.coff.IMAGE.FILE.MACHINE, |
| 537 | 540 | resolved_include_paths: ?[]const []const u8 = null, |
| 538 | 541 | |
| 539 | pub fn get(self: *LazyIncludePaths, error_handler: *ErrorHandler) ![]const []const u8 { | |
| 542 | pub fn get( | |
| 543 | self: *LazyIncludePaths, | |
| 544 | error_handler: *ErrorHandler, | |
| 545 | env_map: *const std.process.Environ.Map, | |
| 546 | ) ![]const []const u8 { | |
| 540 | 547 | const io = self.io; |
| 541 | 548 | |
| 542 | 549 | if (self.resolved_include_paths) |include_paths| |
| 543 | 550 | return include_paths; |
| 544 | 551 | |
| 545 | return getIncludePaths(self.arena, io, self.auto_includes_option, self.zig_lib_dir, self.target_machine_type) catch |err| switch (err) { | |
| 552 | return getIncludePaths( | |
| 553 | self.arena, | |
| 554 | io, | |
| 555 | self.auto_includes_option, | |
| 556 | self.zig_lib_dir, | |
| 557 | self.target_machine_type, | |
| 558 | env_map, | |
| 559 | ) catch |err| switch (err) { | |
| 546 | 560 | error.OutOfMemory => |e| return e, |
| 547 | 561 | else => |e| { |
| 548 | 562 | switch (e) { |
| ... | ... | @@ -569,6 +583,7 @@ fn getIncludePaths( |
| 569 | 583 | auto_includes_option: cli.Options.AutoIncludes, |
| 570 | 584 | zig_lib_dir: []const u8, |
| 571 | 585 | target_machine_type: std.coff.IMAGE.FILE.MACHINE, |
| 586 | env_map: *const std.process.Environ.Map, | |
| 572 | 587 | ) ![]const []const u8 { |
| 573 | 588 | if (auto_includes_option == .none) return &[_][]const u8{}; |
| 574 | 589 | |
| ... | ... | @@ -641,7 +656,16 @@ fn getIncludePaths( |
| 641 | 656 | }; |
| 642 | 657 | const target = std.zig.resolveTargetQueryOrFatal(io, target_query); |
| 643 | 658 | const is_native_abi = target_query.isNativeAbi(); |
| 644 | const detected_libc = std.zig.LibCDirs.detect(arena, io, zig_lib_dir, &target, is_native_abi, true, null) catch |err| switch (err) { | |
| 659 | const detected_libc = std.zig.LibCDirs.detect( | |
| 660 | arena, | |
| 661 | io, | |
| 662 | zig_lib_dir, | |
| 663 | &target, | |
| 664 | is_native_abi, | |
| 665 | true, | |
| 666 | null, | |
| 667 | env_map, | |
| 668 | ) catch |err| switch (err) { | |
| 645 | 669 | error.OutOfMemory => |e| return e, |
| 646 | 670 | else => return error.MingwIncludesNotFound, |
| 647 | 671 | }; |
lib/compiler/translate-c/main.zig+2-2| ... | ... | @@ -25,8 +25,8 @@ pub fn main(init: std.process.Init) u8 { |
| 25 | 25 | zig_integration = true; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | const NO_COLOR = std.zig.EnvVar.NO_COLOR.isSet(); | |
| 29 | const CLICOLOR_FORCE = std.zig.EnvVar.CLICOLOR_FORCE.isSet(); | |
| 28 | const NO_COLOR = std.zig.EnvVar.NO_COLOR.isSet(init.env_map); | |
| 29 | const CLICOLOR_FORCE = std.zig.EnvVar.CLICOLOR_FORCE.isSet(init.env_map); | |
| 30 | 30 | |
| 31 | 31 | var stderr_buf: [1024]u8 = undefined; |
| 32 | 32 | var stderr = Io.File.stderr().writer(io, &stderr_buf); |
test/standalone/coff_dwarf/main.zig+3-8| ... | ... | @@ -3,18 +3,13 @@ const fatal = std.process.fatal; |
| 3 | 3 | |
| 4 | 4 | extern fn add(a: u32, b: u32, addr: *usize) u32; |
| 5 | 5 | |
| 6 | pub fn main() void { | |
| 7 | var debug_alloc_inst: std.heap.DebugAllocator(.{}) = .init; | |
| 8 | defer std.debug.assert(debug_alloc_inst.deinit() == .ok); | |
| 9 | const gpa = debug_alloc_inst.allocator(); | |
| 6 | pub fn main(init: std.process.Init) void { | |
| 7 | const gpa = init.gpa; | |
| 8 | const io = init.io; | |
| 10 | 9 | |
| 11 | 10 | var di: std.debug.SelfInfo = .init; |
| 12 | 11 | defer di.deinit(gpa); |
| 13 | 12 | |
| 14 | var threaded: std.Io.Threaded = .init(gpa, .{}); | |
| 15 | defer threaded.deinit(); | |
| 16 | const io = threaded.io(); | |
| 17 | ||
| 18 | 13 | var add_addr: usize = undefined; |
| 19 | 14 | _ = add(1, 2, &add_addr); |
| 20 | 15 |
test/standalone/dirname/exists_in.zig+1-1| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | const std = @import("std"); |
| 13 | 13 | |
| 14 | 14 | pub fn main(init: std.process.Init) !void { |
| 15 | var args = try init.args.iterateAllocator(init.arena); | |
| 15 | var args = try init.minimal.args.iterateAllocator(init.gpa); | |
| 16 | 16 | defer args.deinit(); |
| 17 | 17 | _ = args.next() orelse unreachable; // skip binary name |
| 18 | 18 |
test/standalone/dirname/has_basename.zig+1-1| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | const std = @import("std"); |
| 15 | 15 | |
| 16 | 16 | pub fn main(init: std.process.Init) !void { |
| 17 | var args = try init.args.iterateAllocator(init.arena); | |
| 17 | var args = try init.minimal.args.iterateAllocator(init.gpa); | |
| 18 | 18 | defer args.deinit(); |
| 19 | 19 | _ = args.next() orelse unreachable; // skip binary name |
| 20 | 20 |
test/standalone/dirname/touch.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | const std = @import("std"); |
| 10 | 10 | |
| 11 | 11 | pub fn main(init: std.process.Init) !void { |
| 12 | var args = try init.args.iterateAllocator(init.arena); | |
| 12 | var args = try init.minimal.args.iterateAllocator(init.gpa); | |
| 13 | 13 | defer args.deinit(); |
| 14 | 14 | _ = args.next() orelse unreachable; // skip binary name |
| 15 | 15 |
test/standalone/load_dynamic_library/main.zig+2-5| ... | ... | @@ -1,10 +1,7 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | |
| 3 | pub fn main() !void { | |
| 4 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; | |
| 5 | defer _ = gpa.deinit(); | |
| 6 | const args = try std.process.argsAlloc(gpa.allocator()); | |
| 7 | defer std.process.argsFree(gpa.allocator(), args); | |
| 3 | pub fn main(init: std.process.Init) !void { | |
| 4 | const args = try init.minimal.args.toSlice(init.arena.allocator()); | |
| 8 | 5 | |
| 9 | 6 | const dynlib_name = args[1]; |
| 10 | 7 |
test/standalone/posix/cwd.zig+2-10| ... | ... | @@ -7,24 +7,16 @@ const assert = std.debug.assert; |
| 7 | 7 | |
| 8 | 8 | const path_max = std.fs.max_path_bytes; |
| 9 | 9 | |
| 10 | pub fn main() !void { | |
| 10 | pub fn main(init: std.process.Init) !void { | |
| 11 | 11 | switch (builtin.target.os.tag) { |
| 12 | 12 | .wasi => return, // WASI doesn't support changing the working directory at all. |
| 13 | 13 | .windows => return, // POSIX is not implemented by Windows |
| 14 | 14 | else => {}, |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | var debug_allocator: std.heap.DebugAllocator(.{}) = .{}; | |
| 18 | defer assert(debug_allocator.deinit() == .ok); | |
| 19 | const gpa = debug_allocator.allocator(); | |
| 20 | ||
| 21 | var threaded: std.Io.Threaded = .init(gpa, .{}); | |
| 22 | defer threaded.deinit(); | |
| 23 | const io = threaded.io(); | |
| 24 | ||
| 25 | 17 | try test_chdir_self(); |
| 26 | 18 | try test_chdir_absolute(); |
| 27 | try test_chdir_relative(gpa, io); | |
| 19 | try test_chdir_relative(init.gpa, init.io); | |
| 28 | 20 | } |
| 29 | 21 | |
| 30 | 22 | // get current working directory and expect it to match given path |
test/standalone/posix/relpaths.zig+2-8| ... | ... | @@ -6,16 +6,10 @@ const builtin = @import("builtin"); |
| 6 | 6 | const std = @import("std"); |
| 7 | 7 | const Io = std.Io; |
| 8 | 8 | |
| 9 | pub fn main() !void { | |
| 9 | pub fn main(init: std.process.Init) !void { | |
| 10 | 10 | if (builtin.target.os.tag == .wasi) return; // Can link, but can't change into tmpDir |
| 11 | 11 | |
| 12 | var debug_allocator: std.heap.DebugAllocator(.{}) = .init; | |
| 13 | const gpa = debug_allocator.allocator(); | |
| 14 | defer std.debug.assert(debug_allocator.deinit() == .ok); | |
| 15 | ||
| 16 | var threaded: std.Io.Threaded = .init(gpa, .{}); | |
| 17 | defer threaded.deinit(); | |
| 18 | const io = threaded.io(); | |
| 12 | const io = init.io; | |
| 19 | 13 | |
| 20 | 14 | var tmp = tmpDir(io, .{}); |
| 21 | 15 | defer tmp.cleanup(io); |
test/standalone/run_cwd/check_file_exists.zig+3-6| ... | ... | @@ -1,9 +1,6 @@ |
| 1 | pub fn main() !void { | |
| 2 | var arena_state: std.heap.ArenaAllocator = .init(std.heap.page_allocator); | |
| 3 | defer arena_state.deinit(); | |
| 4 | const arena = arena_state.allocator(); | |
| 5 | ||
| 6 | const args = try std.process.argsAlloc(arena); | |
| 1 | pub fn main(init: std.process.Init) !void { | |
| 2 | const arena = init.arena.allocator(); | |
| 3 | const args = try init.minimal.args.toSlice(arena); | |
| 7 | 4 | |
| 8 | 5 | if (args.len != 2) return error.BadUsage; |
| 9 | 6 | const path = args[1]; |