| author | |
| committer | |
| log | 6936243ee1b933cba5d5e86c398ec39865e4db28 |
| tree | 974627e1578c2781439ade57726f1d762ba49b05 |
| parent | 7278c51ddd1f3d0a06a4181f3588032d6940a8d4 |
| signature | Commit is signed but in an unrecognized format. |
5 files changed, 27 insertions(+), 23 deletions(-)
src-self-hosted/arg.zig+1-1| ... | @@ -178,7 +178,7 @@ pub const Args = struct { | ... | @@ -178,7 +178,7 @@ pub const Args = struct { |
| 178 | else => @panic("attempted to retrieve flag with wrong type"), | 178 | else => @panic("attempted to retrieve flag with wrong type"), |
| 179 | } | 179 | } |
| 180 | } else { | 180 | } else { |
| 181 | return [_][]const u8{}; | 181 | return &[_][]const u8{}; |
| 182 | } | 182 | } |
| 183 | } | 183 | } |
| 184 | }; | 184 | }; |
src-self-hosted/compilation.zig+16-12| ... | @@ -103,8 +103,8 @@ pub const ZigCompiler = struct { | ... | @@ -103,8 +103,8 @@ pub const ZigCompiler = struct { |
| 103 | /// Must be called only once, ever. Sets global state. | 103 | /// Must be called only once, ever. Sets global state. |
| 104 | pub fn setLlvmArgv(allocator: *Allocator, llvm_argv: []const []const u8) !void { | 104 | pub fn setLlvmArgv(allocator: *Allocator, llvm_argv: []const []const u8) !void { |
| 105 | if (llvm_argv.len != 0) { | 105 | if (llvm_argv.len != 0) { |
| 106 | var c_compatible_args = try std.cstr.NullTerminated2DArray.fromSlices(allocator, [_][]const []const u8{ | 106 | var c_compatible_args = try std.cstr.NullTerminated2DArray.fromSlices(allocator, &[_][]const []const u8{ |
| 107 | [_][]const u8{"zig (LLVM option parsing)"}, | 107 | &[_][]const u8{"zig (LLVM option parsing)"}, |
| 108 | llvm_argv, | 108 | llvm_argv, |
| 109 | }); | 109 | }); |
| 110 | defer c_compatible_args.deinit(); | 110 | defer c_compatible_args.deinit(); |
| ... | @@ -359,7 +359,11 @@ pub const Compilation = struct { | ... | @@ -359,7 +359,11 @@ pub const Compilation = struct { |
| 359 | is_static, | 359 | is_static, |
| 360 | zig_lib_dir, | 360 | zig_lib_dir, |
| 361 | ); | 361 | ); |
| 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 | } | ||
| 363 | } | 367 | } |
| 364 | 368 | ||
| 365 | async fn createAsync( | 369 | async fn createAsync( |
| ... | @@ -412,20 +416,20 @@ pub const Compilation = struct { | ... | @@ -412,20 +416,20 @@ pub const Compilation = struct { |
| 412 | .strip = false, | 416 | .strip = false, |
| 413 | .is_static = is_static, | 417 | .is_static = is_static, |
| 414 | .linker_rdynamic = false, | 418 | .linker_rdynamic = false, |
| 415 | .clang_argv = [_][]const u8{}, | 419 | .clang_argv = &[_][]const u8{}, |
| 416 | .lib_dirs = [_][]const u8{}, | 420 | .lib_dirs = &[_][]const u8{}, |
| 417 | .rpath_list = [_][]const u8{}, | 421 | .rpath_list = &[_][]const u8{}, |
| 418 | .assembly_files = [_][]const u8{}, | 422 | .assembly_files = &[_][]const u8{}, |
| 419 | .link_objects = [_][]const u8{}, | 423 | .link_objects = &[_][]const u8{}, |
| 420 | .fn_link_set = event.Locked(FnLinkSet).init(FnLinkSet.init()), | 424 | .fn_link_set = event.Locked(FnLinkSet).init(FnLinkSet.init()), |
| 421 | .windows_subsystem_windows = false, | 425 | .windows_subsystem_windows = false, |
| 422 | .windows_subsystem_console = false, | 426 | .windows_subsystem_console = false, |
| 423 | .link_libs_list = undefined, | 427 | .link_libs_list = undefined, |
| 424 | .libc_link_lib = null, | 428 | .libc_link_lib = null, |
| 425 | .err_color = errmsg.Color.Auto, | 429 | .err_color = errmsg.Color.Auto, |
| 426 | .darwin_frameworks = [_][]const u8{}, | 430 | .darwin_frameworks = &[_][]const u8{}, |
| 427 | .darwin_version_min = DarwinVersionMin.None, | 431 | .darwin_version_min = DarwinVersionMin.None, |
| 428 | .test_filters = [_][]const u8{}, | 432 | .test_filters = &[_][]const u8{}, |
| 429 | .test_name_prefix = null, | 433 | .test_name_prefix = null, |
| 430 | .emit_file_type = Emit.Binary, | 434 | .emit_file_type = Emit.Binary, |
| 431 | .link_out_file = null, | 435 | .link_out_file = null, |
| ... | @@ -478,7 +482,7 @@ pub const Compilation = struct { | ... | @@ -478,7 +482,7 @@ pub const Compilation = struct { |
| 478 | comp.name = try Buffer.init(comp.arena(), name); | 482 | comp.name = try Buffer.init(comp.arena(), name); |
| 479 | comp.llvm_triple = try util.getTriple(comp.arena(), target); | 483 | comp.llvm_triple = try util.getTriple(comp.arena(), target); |
| 480 | comp.llvm_target = try util.llvmTargetFromTriple(comp.llvm_triple); | 484 | 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" }); |
| 482 | 486 | ||
| 483 | const opt_level = switch (build_mode) { | 487 | const opt_level = switch (build_mode) { |
| 484 | .Debug => llvm.CodeGenLevelNone, | 488 | .Debug => llvm.CodeGenLevelNone, |
| ... | @@ -520,7 +524,7 @@ pub const Compilation = struct { | ... | @@ -520,7 +524,7 @@ pub const Compilation = struct { |
| 520 | comp.events = try allocator.create(event.Channel(Event)); | 524 | comp.events = try allocator.create(event.Channel(Event)); |
| 521 | defer allocator.destroy(comp.events); | 525 | defer allocator.destroy(comp.events); |
| 522 | 526 | ||
| 523 | comp.events.init([0]Event{}); | 527 | comp.events.init(&[0]Event{}); |
| 524 | defer comp.events.deinit(); | 528 | defer comp.events.deinit(); |
| 525 | 529 | ||
| 526 | if (root_src_path) |root_src| { | 530 | if (root_src_path) |root_src| { |
src-self-hosted/introspect.zig+2-2| ... | @@ -8,10 +8,10 @@ const warn = std.debug.warn; | ... | @@ -8,10 +8,10 @@ const warn = std.debug.warn; |
| 8 | 8 | ||
| 9 | /// Caller must free result | 9 | /// Caller must free result |
| 10 | pub fn testZigInstallPrefix(allocator: *mem.Allocator, test_path: []const u8) ![]u8 { | 10 | pub 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" }); |
| 12 | errdefer allocator.free(test_zig_dir); | 12 | errdefer allocator.free(test_zig_dir); |
| 13 | 13 | ||
| 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" }); |
| 15 | defer allocator.free(test_index_file); | 15 | defer allocator.free(test_index_file); |
| 16 | 16 | ||
| 17 | var file = try fs.File.openRead(test_index_file); | 17 | 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 { | ... | @@ -193,7 +193,7 @@ pub const LibCInstallation = struct { |
| 193 | "/dev/null", | 193 | "/dev/null", |
| 194 | }; | 194 | }; |
| 195 | // TODO make this use event loop | 195 | // 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); |
| 197 | const exec_result = if (std.debug.runtime_safety) blk: { | 197 | const exec_result = if (std.debug.runtime_safety) blk: { |
| 198 | break :blk errorable_result catch unreachable; | 198 | break :blk errorable_result catch unreachable; |
| 199 | } else blk: { | 199 | } else blk: { |
| ... | @@ -233,7 +233,7 @@ pub const LibCInstallation = struct { | ... | @@ -233,7 +233,7 @@ pub const LibCInstallation = struct { |
| 233 | while (path_i < search_paths.len) : (path_i += 1) { | 233 | while (path_i < search_paths.len) : (path_i += 1) { |
| 234 | const search_path_untrimmed = search_paths.at(search_paths.len - path_i - 1); | 234 | const search_path_untrimmed = search_paths.at(search_paths.len - path_i - 1); |
| 235 | const search_path = std.mem.trimLeft(u8, search_path_untrimmed, " "); | 235 | 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" }); |
| 237 | defer allocator.free(stdlib_path); | 237 | defer allocator.free(stdlib_path); |
| 238 | 238 | ||
| 239 | if (try fileExists(stdlib_path)) { | 239 | if (try fileExists(stdlib_path)) { |
| ... | @@ -401,7 +401,7 @@ async fn ccPrintFileName(allocator: *Allocator, o_file: []const u8, want_dirname | ... | @@ -401,7 +401,7 @@ async fn ccPrintFileName(allocator: *Allocator, o_file: []const u8, want_dirname |
| 401 | 401 | ||
| 402 | // TODO This simulates evented I/O for the child process exec | 402 | // TODO This simulates evented I/O for the child process exec |
| 403 | std.event.Loop.instance.?.yield(); | 403 | 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); |
| 405 | const exec_result = if (std.debug.runtime_safety) blk: { | 405 | const exec_result = if (std.debug.runtime_safety) blk: { |
| 406 | break :blk errorable_result catch unreachable; | 406 | break :blk errorable_result catch unreachable; |
| 407 | } else blk: { | 407 | } else blk: { |
src-self-hosted/main.zig+5-5| ... | @@ -191,12 +191,12 @@ const usage_build_generic = | ... | @@ -191,12 +191,12 @@ const usage_build_generic = |
| 191 | 191 | ||
| 192 | const args_build_generic = [_]Flag{ | 192 | const args_build_generic = [_]Flag{ |
| 193 | Flag.Bool("--help"), | 193 | Flag.Bool("--help"), |
| 194 | Flag.Option("--color", [_][]const u8{ | 194 | Flag.Option("--color", &[_][]const u8{ |
| 195 | "auto", | 195 | "auto", |
| 196 | "off", | 196 | "off", |
| 197 | "on", | 197 | "on", |
| 198 | }), | 198 | }), |
| 199 | Flag.Option("--mode", [_][]const u8{ | 199 | Flag.Option("--mode", &[_][]const u8{ |
| 200 | "debug", | 200 | "debug", |
| 201 | "release-fast", | 201 | "release-fast", |
| 202 | "release-safe", | 202 | "release-safe", |
| ... | @@ -204,7 +204,7 @@ const args_build_generic = [_]Flag{ | ... | @@ -204,7 +204,7 @@ const args_build_generic = [_]Flag{ |
| 204 | }), | 204 | }), |
| 205 | 205 | ||
| 206 | Flag.ArgMergeN("--assembly", 1), | 206 | Flag.ArgMergeN("--assembly", 1), |
| 207 | Flag.Option("--emit", [_][]const u8{ | 207 | Flag.Option("--emit", &[_][]const u8{ |
| 208 | "asm", | 208 | "asm", |
| 209 | "bin", | 209 | "bin", |
| 210 | "llvm-ir", | 210 | "llvm-ir", |
| ... | @@ -252,7 +252,7 @@ const args_build_generic = [_]Flag{ | ... | @@ -252,7 +252,7 @@ const args_build_generic = [_]Flag{ |
| 252 | }; | 252 | }; |
| 253 | 253 | ||
| 254 | fn buildOutputType(allocator: *Allocator, args: []const []const u8, out_type: Compilation.Kind) !void { | 254 | fn 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); |
| 256 | defer flags.deinit(); | 256 | defer flags.deinit(); |
| 257 | 257 | ||
| 258 | if (flags.present("help")) { | 258 | if (flags.present("help")) { |
| ... | @@ -579,7 +579,7 @@ async fn findLibCAsync(zig_compiler: *ZigCompiler) void { | ... | @@ -579,7 +579,7 @@ async fn findLibCAsync(zig_compiler: *ZigCompiler) void { |
| 579 | } | 579 | } |
| 580 | 580 | ||
| 581 | fn cmdFmt(allocator: *Allocator, args: []const []const u8) !void { | 581 | fn 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); |
| 583 | defer flags.deinit(); | 583 | defer flags.deinit(); |
| 584 | 584 | ||
| 585 | if (flags.present("help")) { | 585 | if (flags.present("help")) { |