diff --git a/src/Compilation.zig b/src/Compilation.zig index 15b507b7a4..d8c59f4f1b 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -35,7 +35,6 @@ const c_codegen = @import("codegen/c.zig"); const libtsan = @import("libtsan.zig"); const Zir = @import("Zir.zig"); const Autodoc = @import("Autodoc.zig"); -const Color = @import("main.zig").Color; const resinator = @import("resinator.zig"); const Builtin = @import("Builtin.zig"); @@ -197,10 +196,6 @@ glibc_so_files: ?glibc.BuiltSharedObjects = null, /// The key is the basename, and the value is the absolute path to the completed build artifact. crt_files: std.StringHashMapUnmanaged(CRTFile) = .{}, -/// This is for stage1 and should be deleted upon completion of self-hosting. -/// Don't use this for anything other than stage1 compatibility. -color: Color = .auto, - /// How many lines of reference trace should be included per compile error. /// Null means only show snippet on first error. reference_trace: ?u32 = null, @@ -1068,8 +1063,6 @@ pub const InitOptions = struct { libc_installation: ?*const LibCInstallation = null, native_system_include_paths: []const []const u8 = &.{}, clang_preprocessor_mode: ClangPreprocessorMode = .no, - /// This is for stage1 and should be deleted upon completion of self-hosting. - color: Color = .auto, reference_trace: ?u32 = null, test_filter: ?[]const u8 = null, test_name_prefix: ?[]const u8 = null, @@ -1481,7 +1474,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { .verbose_llvm_cpu_features = options.verbose_llvm_cpu_features, .verbose_link = options.verbose_link, .disable_c_depfile = options.disable_c_depfile, - .color = options.color, .reference_trace = options.reference_trace, .formatted_panics = formatted_panics, .time_report = options.time_report, diff --git a/src/main.zig b/src/main.zig index 16bd32b45e..0822557158 100644 --- a/src/main.zig +++ b/src/main.zig @@ -3220,7 +3220,6 @@ fn buildOutputType( .verbose_llvm_bc = verbose_llvm_bc, .verbose_cimport = verbose_cimport, .verbose_llvm_cpu_features = verbose_llvm_cpu_features, - .color = color, .time_report = time_report, .stack_report = stack_report, .each_lib_rpath = each_lib_rpath, @@ -3323,7 +3322,7 @@ fn buildOutputType( return cmdTranslateC(comp, arena, null); } - updateModule(comp) catch |err| switch (err) { + updateModule(comp, color) catch |err| switch (err) { error.SemanticAnalyzeFail => { assert(listen == .none); saveState(comp, debug_incremental); @@ -4436,13 +4435,13 @@ fn runOrTestHotSwap( } } -fn updateModule(comp: *Compilation) !void { +fn updateModule(comp: *Compilation, color: Color) !void { { // If the terminal is dumb, we dont want to show the user all the output. var progress: std.Progress = .{ .dont_print_on_dumb = true }; const main_progress_node = progress.start("", 0); defer main_progress_node.end(); - switch (comp.color) { + switch (color) { .off => { progress.terminal = null; }, @@ -4460,13 +4459,14 @@ fn updateModule(comp: *Compilation) !void { defer errors.deinit(comp.gpa); if (errors.errorMessageCount() > 0) { - errors.renderToStdErr(renderOptions(comp.color)); + errors.renderToStdErr(renderOptions(color)); return error.SemanticAnalyzeFail; } } fn cmdTranslateC(comp: *Compilation, arena: Allocator, fancy_output: ?*Compilation.CImportResult) !void { if (build_options.only_core_functionality) @panic("@translate-c is not available in a zig2.c build"); + const color: Color = .auto; assert(comp.c_source_files.len == 1); const c_source_file = comp.c_source_files[0]; @@ -4559,7 +4559,7 @@ fn cmdTranslateC(comp: *Compilation, arena: Allocator, fancy_output: ?*Compilati p.errors = errors; return; } else { - errors.renderToStdErr(renderOptions(comp.color)); + errors.renderToStdErr(renderOptions(color)); process.exit(1); } }, @@ -5533,7 +5533,7 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi }; defer comp.destroy(); - updateModule(comp) catch |err| switch (err) { + updateModule(comp, color) catch |err| switch (err) { error.SemanticAnalyzeFail => process.exit(2), else => |e| return e, };