diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-04-02 19:11:04 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-04-02 19:18:41 -0700 |
| commit | 3432e66faf8940bbbfc7ee24d0e17e6127e66bf6 (patch) | |
| tree | 585b35e886651c8f47970c1985ea84fd98637c3c /src | |
| parent | 843d5adcd6ec0b620fe93e0366aa0e8bb92bd171 (diff) | |
| download | zig-3432e66faf8940bbbfc7ee24d0e17e6127e66bf6.tar.gz zig-3432e66faf8940bbbfc7ee24d0e17e6127e66bf6.zip | |
stage2: remove dependencies on async functions
This commit removes the tiny amount of dependency on async/await that
the self-hosted compiler has so that it can self-host before async/await
language features are working.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libc_installation.zig | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/src/libc_installation.zig b/src/libc_installation.zig index fe1a2b2ca5..0b40580d7b 100644 --- a/src/libc_installation.zig +++ b/src/libc_installation.zig @@ -3,7 +3,6 @@ const builtin = @import("builtin"); const Target = std.Target; const fs = std.fs; const Allocator = std.mem.Allocator; -const Batch = std.event.Batch; const build_options = @import("build_options"); const is_darwin = builtin.target.isDarwin(); @@ -195,40 +194,28 @@ pub const LibCInstallation = struct { .None => { defer sdk.free(); - var batch = Batch(FindError!void, 5, .auto_async).init(); - batch.add(&async self.findNativeMsvcIncludeDir(args, sdk)); - batch.add(&async self.findNativeMsvcLibDir(args, sdk)); - batch.add(&async self.findNativeKernel32LibDir(args, sdk)); - batch.add(&async self.findNativeIncludeDirWindows(args, sdk)); - batch.add(&async self.findNativeCrtDirWindows(args, sdk)); - try batch.wait(); + try self.findNativeMsvcIncludeDir(args, sdk); + try self.findNativeMsvcLibDir(args, sdk); + try self.findNativeKernel32LibDir(args, sdk); + try self.findNativeIncludeDirWindows(args, sdk); + try self.findNativeCrtDirWindows(args, sdk); }, .OutOfMemory => return error.OutOfMemory, .NotFound => return error.WindowsSdkNotFound, .PathTooLong => return error.WindowsSdkNotFound, } } else if (is_haiku) { - try blk: { - var batch = Batch(FindError!void, 2, .auto_async).init(); - errdefer batch.wait() catch {}; - batch.add(&async self.findNativeIncludeDirPosix(args)); - batch.add(&async self.findNativeCrtBeginDirHaiku(args)); - self.crt_dir = try args.allocator.dupeZ(u8, "/system/develop/lib"); - break :blk batch.wait(); - }; + try self.findNativeIncludeDirPosix(args); + try self.findNativeCrtBeginDirHaiku(args); + self.crt_dir = try args.allocator.dupeZ(u8, "/system/develop/lib"); } else if (std.process.can_spawn) { - try blk: { - var batch = Batch(FindError!void, 2, .auto_async).init(); - errdefer batch.wait() catch {}; - batch.add(&async self.findNativeIncludeDirPosix(args)); - switch (builtin.target.os.tag) { - .freebsd, .netbsd, .openbsd, .dragonfly => self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib"), - .solaris => self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib/64"), - .linux => batch.add(&async self.findNativeCrtDirPosix(args)), - else => {}, - } - break :blk batch.wait(); - }; + try self.findNativeIncludeDirPosix(args); + switch (builtin.target.os.tag) { + .freebsd, .netbsd, .openbsd, .dragonfly => self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib"), + .solaris => self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib/64"), + .linux => try self.findNativeCrtDirPosix(args), + else => {}, + } } else { return error.LibCRuntimeNotFound; } |
