authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-04-02 19:11:04-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-04-02 19:18:41-07:00
log3432e66faf8940bbbfc7ee24d0e17e6127e66bf6
tree585b35e886651c8f47970c1985ea84fd98637c3c
parent843d5adcd6ec0b620fe93e0366aa0e8bb92bd171

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.

1 files changed, 15 insertions(+), 28 deletions(-)

src/libc_installation.zig+15-28
...@@ -3,7 +3,6 @@ const builtin = @import("builtin");...@@ -3,7 +3,6 @@ const builtin = @import("builtin");
3const Target = std.Target;3const Target = std.Target;
4const fs = std.fs;4const fs = std.fs;
5const Allocator = std.mem.Allocator;5const Allocator = std.mem.Allocator;
6const Batch = std.event.Batch;
7const build_options = @import("build_options");6const build_options = @import("build_options");
87
9const is_darwin = builtin.target.isDarwin();8const is_darwin = builtin.target.isDarwin();
...@@ -195,40 +194,28 @@ pub const LibCInstallation = struct {...@@ -195,40 +194,28 @@ pub const LibCInstallation = struct {
195 .None => {194 .None => {
196 defer sdk.free();195 defer sdk.free();
197196
198 var batch = Batch(FindError!void, 5, .auto_async).init();197 try self.findNativeMsvcIncludeDir(args, sdk);
199 batch.add(&async self.findNativeMsvcIncludeDir(args, sdk));198 try self.findNativeMsvcLibDir(args, sdk);
200 batch.add(&async self.findNativeMsvcLibDir(args, sdk));199 try self.findNativeKernel32LibDir(args, sdk);
201 batch.add(&async self.findNativeKernel32LibDir(args, sdk));200 try self.findNativeIncludeDirWindows(args, sdk);
202 batch.add(&async self.findNativeIncludeDirWindows(args, sdk));201 try self.findNativeCrtDirWindows(args, sdk);
203 batch.add(&async self.findNativeCrtDirWindows(args, sdk));
204 try batch.wait();
205 },202 },
206 .OutOfMemory => return error.OutOfMemory,203 .OutOfMemory => return error.OutOfMemory,
207 .NotFound => return error.WindowsSdkNotFound,204 .NotFound => return error.WindowsSdkNotFound,
208 .PathTooLong => return error.WindowsSdkNotFound,205 .PathTooLong => return error.WindowsSdkNotFound,
209 }206 }
210 } else if (is_haiku) {207 } else if (is_haiku) {
211 try blk: {208 try self.findNativeIncludeDirPosix(args);
212 var batch = Batch(FindError!void, 2, .auto_async).init();209 try self.findNativeCrtBeginDirHaiku(args);
213 errdefer batch.wait() catch {};210 self.crt_dir = try args.allocator.dupeZ(u8, "/system/develop/lib");
214 batch.add(&async self.findNativeIncludeDirPosix(args));
215 batch.add(&async self.findNativeCrtBeginDirHaiku(args));
216 self.crt_dir = try args.allocator.dupeZ(u8, "/system/develop/lib");
217 break :blk batch.wait();
218 };
219 } else if (std.process.can_spawn) {211 } else if (std.process.can_spawn) {
220 try blk: {212 try self.findNativeIncludeDirPosix(args);
221 var batch = Batch(FindError!void, 2, .auto_async).init();213 switch (builtin.target.os.tag) {
222 errdefer batch.wait() catch {};214 .freebsd, .netbsd, .openbsd, .dragonfly => self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib"),
223 batch.add(&async self.findNativeIncludeDirPosix(args));215 .solaris => self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib/64"),
224 switch (builtin.target.os.tag) {216 .linux => try self.findNativeCrtDirPosix(args),
225 .freebsd, .netbsd, .openbsd, .dragonfly => self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib"),217 else => {},
226 .solaris => self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib/64"),218 }
227 .linux => batch.add(&async self.findNativeCrtDirPosix(args)),
228 else => {},
229 }
230 break :blk batch.wait();
231 };
232 } else {219 } else {
233 return error.LibCRuntimeNotFound;220 return error.LibCRuntimeNotFound;
234 }221 }