authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-26 20:32:40-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 17:51:21-07:00
logc9fe43679f8d8f0db6250cc881b59cc68daaf128
tree9bb9762bd3330f8da870efeaa53a5a544ad7274e
parent6beae6c061a650ea2d695e6902683641df920aa8

frontend: remove deprecated field from Compilation


2 files changed, 7 insertions(+), 15 deletions(-)

src/Compilation.zig-8
......@@ -35,7 +35,6 @@ const c_codegen = @import("codegen/c.zig");
3535const libtsan = @import("libtsan.zig");
3636const Zir = @import("Zir.zig");
3737const Autodoc = @import("Autodoc.zig");
38const Color = @import("main.zig").Color;
3938const resinator = @import("resinator.zig");
4039const Builtin = @import("Builtin.zig");
4140
......@@ -197,10 +196,6 @@ glibc_so_files: ?glibc.BuiltSharedObjects = null,
197196/// The key is the basename, and the value is the absolute path to the completed build artifact.
198197crt_files: std.StringHashMapUnmanaged(CRTFile) = .{},
199198
200/// This is for stage1 and should be deleted upon completion of self-hosting.
201/// Don't use this for anything other than stage1 compatibility.
202color: Color = .auto,
203
204199/// How many lines of reference trace should be included per compile error.
205200/// Null means only show snippet on first error.
206201reference_trace: ?u32 = null,
......@@ -1068,8 +1063,6 @@ pub const InitOptions = struct {
10681063 libc_installation: ?*const LibCInstallation = null,
10691064 native_system_include_paths: []const []const u8 = &.{},
10701065 clang_preprocessor_mode: ClangPreprocessorMode = .no,
1071 /// This is for stage1 and should be deleted upon completion of self-hosting.
1072 color: Color = .auto,
10731066 reference_trace: ?u32 = null,
10741067 test_filter: ?[]const u8 = null,
10751068 test_name_prefix: ?[]const u8 = null,
......@@ -1481,7 +1474,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
14811474 .verbose_llvm_cpu_features = options.verbose_llvm_cpu_features,
14821475 .verbose_link = options.verbose_link,
14831476 .disable_c_depfile = options.disable_c_depfile,
1484 .color = options.color,
14851477 .reference_trace = options.reference_trace,
14861478 .formatted_panics = formatted_panics,
14871479 .time_report = options.time_report,
src/main.zig+7-7
......@@ -3220,7 +3220,6 @@ fn buildOutputType(
32203220 .verbose_llvm_bc = verbose_llvm_bc,
32213221 .verbose_cimport = verbose_cimport,
32223222 .verbose_llvm_cpu_features = verbose_llvm_cpu_features,
3223 .color = color,
32243223 .time_report = time_report,
32253224 .stack_report = stack_report,
32263225 .each_lib_rpath = each_lib_rpath,
......@@ -3323,7 +3322,7 @@ fn buildOutputType(
33233322 return cmdTranslateC(comp, arena, null);
33243323 }
33253324
3326 updateModule(comp) catch |err| switch (err) {
3325 updateModule(comp, color) catch |err| switch (err) {
33273326 error.SemanticAnalyzeFail => {
33283327 assert(listen == .none);
33293328 saveState(comp, debug_incremental);
......@@ -4436,13 +4435,13 @@ fn runOrTestHotSwap(
44364435 }
44374436}
44384437
4439fn updateModule(comp: *Compilation) !void {
4438fn updateModule(comp: *Compilation, color: Color) !void {
44404439 {
44414440 // If the terminal is dumb, we dont want to show the user all the output.
44424441 var progress: std.Progress = .{ .dont_print_on_dumb = true };
44434442 const main_progress_node = progress.start("", 0);
44444443 defer main_progress_node.end();
4445 switch (comp.color) {
4444 switch (color) {
44464445 .off => {
44474446 progress.terminal = null;
44484447 },
......@@ -4460,13 +4459,14 @@ fn updateModule(comp: *Compilation) !void {
44604459 defer errors.deinit(comp.gpa);
44614460
44624461 if (errors.errorMessageCount() > 0) {
4463 errors.renderToStdErr(renderOptions(comp.color));
4462 errors.renderToStdErr(renderOptions(color));
44644463 return error.SemanticAnalyzeFail;
44654464 }
44664465}
44674466
44684467fn cmdTranslateC(comp: *Compilation, arena: Allocator, fancy_output: ?*Compilation.CImportResult) !void {
44694468 if (build_options.only_core_functionality) @panic("@translate-c is not available in a zig2.c build");
4469 const color: Color = .auto;
44704470 assert(comp.c_source_files.len == 1);
44714471 const c_source_file = comp.c_source_files[0];
44724472
......@@ -4559,7 +4559,7 @@ fn cmdTranslateC(comp: *Compilation, arena: Allocator, fancy_output: ?*Compilati
45594559 p.errors = errors;
45604560 return;
45614561 } else {
4562 errors.renderToStdErr(renderOptions(comp.color));
4562 errors.renderToStdErr(renderOptions(color));
45634563 process.exit(1);
45644564 }
45654565 },
......@@ -5533,7 +5533,7 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
55335533 };
55345534 defer comp.destroy();
55355535
5536 updateModule(comp) catch |err| switch (err) {
5536 updateModule(comp, color) catch |err| switch (err) {
55375537 error.SemanticAnalyzeFail => process.exit(2),
55385538 else => |e| return e,
55395539 };