| ... | ... | @@ -13,7 +13,6 @@ const Package = @import("Package.zig"); |
| 13 | 13 | const zir = @import("zir.zig"); |
| 14 | 14 | const build_options = @import("build_options"); |
| 15 | 15 | const warn = std.log.warn; |
| 16 | | const info = std.log.info; |
| 17 | 16 | |
| 18 | 17 | fn fatal(comptime format: []const u8, args: anytype) noreturn { |
| 19 | 18 | std.log.emerg(format, args); |
| ... | ... | @@ -67,10 +66,16 @@ pub fn log( |
| 67 | 66 | return; |
| 68 | 67 | } |
| 69 | 68 | |
| 70 | | const prefix = "[" ++ @tagName(level) ++ "] " ++ "(" ++ @tagName(scope) ++ "): "; |
| 69 | const level_txt = switch (level) { |
| 70 | .emerg => "error", |
| 71 | .warn => "warning", |
| 72 | else => @tagName(level), |
| 73 | }; |
| 74 | const prefix1 = level_txt ++ ": "; |
| 75 | const prefix2 = if (scope == .default) "" else "(" ++ @tagName(scope) ++ "): "; |
| 71 | 76 | |
| 72 | 77 | // Print the message to stderr, silently ignoring any errors |
| 73 | | std.debug.print(prefix ++ format ++ "\n", args); |
| 78 | std.debug.print(prefix1 ++ prefix2 ++ format ++ "\n", args); |
| 74 | 79 | } |
| 75 | 80 | |
| 76 | 81 | var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; |
| ... | ... | @@ -486,8 +491,6 @@ pub fn buildOutputType( |
| 486 | 491 | } |
| 487 | 492 | } |
| 488 | 493 | } else { |
| 489 | | if (!build_options.have_llvm) |
| 490 | | fatal("`zig cc` and `zig c++` unavailable: compiler not built with LLVM extensions enabled", .{}); |
| 491 | 494 | emit_h = false; |
| 492 | 495 | strip = true; |
| 493 | 496 | ensure_libc_on_non_freestanding = true; |
| ... | ... | @@ -994,7 +997,7 @@ fn updateModule(gpa: *Allocator, module: *Module, zir_out_path: ?[]const u8) !vo |
| 994 | 997 | }); |
| 995 | 998 | } |
| 996 | 999 | } else { |
| 997 | | info("Update completed in {} ms", .{update_nanos / std.time.ns_per_ms}); |
| 1000 | std.log.info("Update completed in {} ms", .{update_nanos / std.time.ns_per_ms}); |
| 998 | 1001 | } |
| 999 | 1002 | |
| 1000 | 1003 | if (zir_out_path) |zop| { |
| ... | ... | @@ -1401,6 +1404,8 @@ extern "c" fn ZigClang_main(argc: c_int, argv: [*:null]?[*:0]u8) c_int; |
| 1401 | 1404 | |
| 1402 | 1405 | /// TODO make it so the return value can be !noreturn |
| 1403 | 1406 | fn punt_to_clang(arena: *Allocator, args: []const []const u8) error{OutOfMemory} { |
| 1407 | if (!build_options.have_llvm) |
| 1408 | fatal("`zig cc` and `zig c++` unavailable: compiler not built with LLVM extensions enabled", .{}); |
| 1404 | 1409 | // Convert the args to the format Clang expects. |
| 1405 | 1410 | const argv = try arena.alloc(?[*:0]u8, args.len + 1); |
| 1406 | 1411 | for (args) |arg, i| { |