authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-11-29 21:49:08-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-11-29 21:49:08-05:00
log6936243ee1b933cba5d5e86c398ec39865e4db28
tree974627e1578c2781439ade57726f1d762ba49b05
parent7278c51ddd1f3d0a06a4181f3588032d6940a8d4
signaturelock-open Commit is signed but in an unrecognized format.

fix self-hosted compiler regressions


5 files changed, 27 insertions(+), 23 deletions(-)

src-self-hosted/arg.zig+1-1
......@@ -178,7 +178,7 @@ pub const Args = struct {
178178 else => @panic("attempted to retrieve flag with wrong type"),
179179 }
180180 } else {
181 return [_][]const u8{};
181 return &[_][]const u8{};
182182 }
183183 }
184184};
src-self-hosted/compilation.zig+16-12
......@@ -103,8 +103,8 @@ pub const ZigCompiler = struct {
103103 /// Must be called only once, ever. Sets global state.
104104 pub fn setLlvmArgv(allocator: *Allocator, llvm_argv: []const []const u8) !void {
105105 if (llvm_argv.len != 0) {
106 var c_compatible_args = try std.cstr.NullTerminated2DArray.fromSlices(allocator, [_][]const []const u8{
107 [_][]const u8{"zig (LLVM option parsing)"},
106 var c_compatible_args = try std.cstr.NullTerminated2DArray.fromSlices(allocator, &[_][]const []const u8{
107 &[_][]const u8{"zig (LLVM option parsing)"},
108108 llvm_argv,
109109 });
110110 defer c_compatible_args.deinit();
......@@ -359,7 +359,11 @@ pub const Compilation = struct {
359359 is_static,
360360 zig_lib_dir,
361361 );
362 return optional_comp orelse if (await frame) |_| unreachable else |err| err;
362 if (optional_comp) |comp| {
363 return comp;
364 } else {
365 if (await frame) |_| unreachable else |err| return err;
366 }
363367 }
364368
365369 async fn createAsync(
......@@ -412,20 +416,20 @@ pub const Compilation = struct {
412416 .strip = false,
413417 .is_static = is_static,
414418 .linker_rdynamic = false,
415 .clang_argv = [_][]const u8{},
416 .lib_dirs = [_][]const u8{},
417 .rpath_list = [_][]const u8{},
418 .assembly_files = [_][]const u8{},
419 .link_objects = [_][]const u8{},
419 .clang_argv = &[_][]const u8{},
420 .lib_dirs = &[_][]const u8{},
421 .rpath_list = &[_][]const u8{},
422 .assembly_files = &[_][]const u8{},
423 .link_objects = &[_][]const u8{},
420424 .fn_link_set = event.Locked(FnLinkSet).init(FnLinkSet.init()),
421425 .windows_subsystem_windows = false,
422426 .windows_subsystem_console = false,
423427 .link_libs_list = undefined,
424428 .libc_link_lib = null,
425429 .err_color = errmsg.Color.Auto,
426 .darwin_frameworks = [_][]const u8{},
430 .darwin_frameworks = &[_][]const u8{},
427431 .darwin_version_min = DarwinVersionMin.None,
428 .test_filters = [_][]const u8{},
432 .test_filters = &[_][]const u8{},
429433 .test_name_prefix = null,
430434 .emit_file_type = Emit.Binary,
431435 .link_out_file = null,
......@@ -478,7 +482,7 @@ pub const Compilation = struct {
478482 comp.name = try Buffer.init(comp.arena(), name);
479483 comp.llvm_triple = try util.getTriple(comp.arena(), target);
480484 comp.llvm_target = try util.llvmTargetFromTriple(comp.llvm_triple);
481 comp.zig_std_dir = try std.fs.path.join(comp.arena(), [_][]const u8{ zig_lib_dir, "std" });
485 comp.zig_std_dir = try std.fs.path.join(comp.arena(), &[_][]const u8{ zig_lib_dir, "std" });
482486
483487 const opt_level = switch (build_mode) {
484488 .Debug => llvm.CodeGenLevelNone,
......@@ -520,7 +524,7 @@ pub const Compilation = struct {
520524 comp.events = try allocator.create(event.Channel(Event));
521525 defer allocator.destroy(comp.events);
522526
523 comp.events.init([0]Event{});
527 comp.events.init(&[0]Event{});
524528 defer comp.events.deinit();
525529
526530 if (root_src_path) |root_src| {
src-self-hosted/introspect.zig+2-2
......@@ -8,10 +8,10 @@ const warn = std.debug.warn;
88
99/// Caller must free result
1010pub fn testZigInstallPrefix(allocator: *mem.Allocator, test_path: []const u8) ![]u8 {
11 const test_zig_dir = try fs.path.join(allocator, [_][]const u8{ test_path, "lib", "zig" });
11 const test_zig_dir = try fs.path.join(allocator, &[_][]const u8{ test_path, "lib", "zig" });
1212 errdefer allocator.free(test_zig_dir);
1313
14 const test_index_file = try fs.path.join(allocator, [_][]const u8{ test_zig_dir, "std", "std.zig" });
14 const test_index_file = try fs.path.join(allocator, &[_][]const u8{ test_zig_dir, "std", "std.zig" });
1515 defer allocator.free(test_index_file);
1616
1717 var file = try fs.File.openRead(test_index_file);
src-self-hosted/libc_installation.zig+3-3
......@@ -193,7 +193,7 @@ pub const LibCInstallation = struct {
193193 "/dev/null",
194194 };
195195 // TODO make this use event loop
196 const errorable_result = std.ChildProcess.exec(allocator, argv, null, null, 1024 * 1024);
196 const errorable_result = std.ChildProcess.exec(allocator, &argv, null, null, 1024 * 1024);
197197 const exec_result = if (std.debug.runtime_safety) blk: {
198198 break :blk errorable_result catch unreachable;
199199 } else blk: {
......@@ -233,7 +233,7 @@ pub const LibCInstallation = struct {
233233 while (path_i < search_paths.len) : (path_i += 1) {
234234 const search_path_untrimmed = search_paths.at(search_paths.len - path_i - 1);
235235 const search_path = std.mem.trimLeft(u8, search_path_untrimmed, " ");
236 const stdlib_path = try fs.path.join(allocator, [_][]const u8{ search_path, "stdlib.h" });
236 const stdlib_path = try fs.path.join(allocator, &[_][]const u8{ search_path, "stdlib.h" });
237237 defer allocator.free(stdlib_path);
238238
239239 if (try fileExists(stdlib_path)) {
......@@ -401,7 +401,7 @@ async fn ccPrintFileName(allocator: *Allocator, o_file: []const u8, want_dirname
401401
402402 // TODO This simulates evented I/O for the child process exec
403403 std.event.Loop.instance.?.yield();
404 const errorable_result = std.ChildProcess.exec(allocator, argv, null, null, 1024 * 1024);
404 const errorable_result = std.ChildProcess.exec(allocator, &argv, null, null, 1024 * 1024);
405405 const exec_result = if (std.debug.runtime_safety) blk: {
406406 break :blk errorable_result catch unreachable;
407407 } else blk: {
src-self-hosted/main.zig+5-5
......@@ -191,12 +191,12 @@ const usage_build_generic =
191191
192192const args_build_generic = [_]Flag{
193193 Flag.Bool("--help"),
194 Flag.Option("--color", [_][]const u8{
194 Flag.Option("--color", &[_][]const u8{
195195 "auto",
196196 "off",
197197 "on",
198198 }),
199 Flag.Option("--mode", [_][]const u8{
199 Flag.Option("--mode", &[_][]const u8{
200200 "debug",
201201 "release-fast",
202202 "release-safe",
......@@ -204,7 +204,7 @@ const args_build_generic = [_]Flag{
204204 }),
205205
206206 Flag.ArgMergeN("--assembly", 1),
207 Flag.Option("--emit", [_][]const u8{
207 Flag.Option("--emit", &[_][]const u8{
208208 "asm",
209209 "bin",
210210 "llvm-ir",
......@@ -252,7 +252,7 @@ const args_build_generic = [_]Flag{
252252};
253253
254254fn buildOutputType(allocator: *Allocator, args: []const []const u8, out_type: Compilation.Kind) !void {
255 var flags = try Args.parse(allocator, args_build_generic, args);
255 var flags = try Args.parse(allocator, &args_build_generic, args);
256256 defer flags.deinit();
257257
258258 if (flags.present("help")) {
......@@ -579,7 +579,7 @@ async fn findLibCAsync(zig_compiler: *ZigCompiler) void {
579579}
580580
581581fn cmdFmt(allocator: *Allocator, args: []const []const u8) !void {
582 var flags = try Args.parse(allocator, args_fmt_spec, args);
582 var flags = try Args.parse(allocator, &args_fmt_spec, args);
583583 defer flags.deinit();
584584
585585 if (flags.present("help")) {