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");...@@ -35,7 +35,6 @@ const c_codegen = @import("codegen/c.zig");
35const libtsan = @import("libtsan.zig");35const libtsan = @import("libtsan.zig");
36const Zir = @import("Zir.zig");36const Zir = @import("Zir.zig");
37const Autodoc = @import("Autodoc.zig");37const Autodoc = @import("Autodoc.zig");
38const Color = @import("main.zig").Color;
39const resinator = @import("resinator.zig");38const resinator = @import("resinator.zig");
40const Builtin = @import("Builtin.zig");39const Builtin = @import("Builtin.zig");
4140
...@@ -197,10 +196,6 @@ glibc_so_files: ?glibc.BuiltSharedObjects = null,...@@ -197,10 +196,6 @@ glibc_so_files: ?glibc.BuiltSharedObjects = null,
197/// The key is the basename, and the value is the absolute path to the completed build artifact.196/// The key is the basename, and the value is the absolute path to the completed build artifact.
198crt_files: std.StringHashMapUnmanaged(CRTFile) = .{},197crt_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
204/// How many lines of reference trace should be included per compile error.199/// How many lines of reference trace should be included per compile error.
205/// Null means only show snippet on first error.200/// Null means only show snippet on first error.
206reference_trace: ?u32 = null,201reference_trace: ?u32 = null,
...@@ -1068,8 +1063,6 @@ pub const InitOptions = struct {...@@ -1068,8 +1063,6 @@ pub const InitOptions = struct {
1068 libc_installation: ?*const LibCInstallation = null,1063 libc_installation: ?*const LibCInstallation = null,
1069 native_system_include_paths: []const []const u8 = &.{},1064 native_system_include_paths: []const []const u8 = &.{},
1070 clang_preprocessor_mode: ClangPreprocessorMode = .no,1065 clang_preprocessor_mode: ClangPreprocessorMode = .no,
1071 /// This is for stage1 and should be deleted upon completion of self-hosting.
1072 color: Color = .auto,
1073 reference_trace: ?u32 = null,1066 reference_trace: ?u32 = null,
1074 test_filter: ?[]const u8 = null,1067 test_filter: ?[]const u8 = null,
1075 test_name_prefix: ?[]const u8 = null,1068 test_name_prefix: ?[]const u8 = null,
...@@ -1481,7 +1474,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1481,7 +1474,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
1481 .verbose_llvm_cpu_features = options.verbose_llvm_cpu_features,1474 .verbose_llvm_cpu_features = options.verbose_llvm_cpu_features,
1482 .verbose_link = options.verbose_link,1475 .verbose_link = options.verbose_link,
1483 .disable_c_depfile = options.disable_c_depfile,1476 .disable_c_depfile = options.disable_c_depfile,
1484 .color = options.color,
1485 .reference_trace = options.reference_trace,1477 .reference_trace = options.reference_trace,
1486 .formatted_panics = formatted_panics,1478 .formatted_panics = formatted_panics,
1487 .time_report = options.time_report,1479 .time_report = options.time_report,
src/main.zig+7-7
...@@ -3220,7 +3220,6 @@ fn buildOutputType(...@@ -3220,7 +3220,6 @@ fn buildOutputType(
3220 .verbose_llvm_bc = verbose_llvm_bc,3220 .verbose_llvm_bc = verbose_llvm_bc,
3221 .verbose_cimport = verbose_cimport,3221 .verbose_cimport = verbose_cimport,
3222 .verbose_llvm_cpu_features = verbose_llvm_cpu_features,3222 .verbose_llvm_cpu_features = verbose_llvm_cpu_features,
3223 .color = color,
3224 .time_report = time_report,3223 .time_report = time_report,
3225 .stack_report = stack_report,3224 .stack_report = stack_report,
3226 .each_lib_rpath = each_lib_rpath,3225 .each_lib_rpath = each_lib_rpath,
...@@ -3323,7 +3322,7 @@ fn buildOutputType(...@@ -3323,7 +3322,7 @@ fn buildOutputType(
3323 return cmdTranslateC(comp, arena, null);3322 return cmdTranslateC(comp, arena, null);
3324 }3323 }
33253324
3326 updateModule(comp) catch |err| switch (err) {3325 updateModule(comp, color) catch |err| switch (err) {
3327 error.SemanticAnalyzeFail => {3326 error.SemanticAnalyzeFail => {
3328 assert(listen == .none);3327 assert(listen == .none);
3329 saveState(comp, debug_incremental);3328 saveState(comp, debug_incremental);
...@@ -4436,13 +4435,13 @@ fn runOrTestHotSwap(...@@ -4436,13 +4435,13 @@ fn runOrTestHotSwap(
4436 }4435 }
4437}4436}
44384437
4439fn updateModule(comp: *Compilation) !void {4438fn updateModule(comp: *Compilation, color: Color) !void {
4440 {4439 {
4441 // If the terminal is dumb, we dont want to show the user all the output.4440 // If the terminal is dumb, we dont want to show the user all the output.
4442 var progress: std.Progress = .{ .dont_print_on_dumb = true };4441 var progress: std.Progress = .{ .dont_print_on_dumb = true };
4443 const main_progress_node = progress.start("", 0);4442 const main_progress_node = progress.start("", 0);
4444 defer main_progress_node.end();4443 defer main_progress_node.end();
4445 switch (comp.color) {4444 switch (color) {
4446 .off => {4445 .off => {
4447 progress.terminal = null;4446 progress.terminal = null;
4448 },4447 },
...@@ -4460,13 +4459,14 @@ fn updateModule(comp: *Compilation) !void {...@@ -4460,13 +4459,14 @@ fn updateModule(comp: *Compilation) !void {
4460 defer errors.deinit(comp.gpa);4459 defer errors.deinit(comp.gpa);
44614460
4462 if (errors.errorMessageCount() > 0) {4461 if (errors.errorMessageCount() > 0) {
4463 errors.renderToStdErr(renderOptions(comp.color));4462 errors.renderToStdErr(renderOptions(color));
4464 return error.SemanticAnalyzeFail;4463 return error.SemanticAnalyzeFail;
4465 }4464 }
4466}4465}
44674466
4468fn cmdTranslateC(comp: *Compilation, arena: Allocator, fancy_output: ?*Compilation.CImportResult) !void {4467fn cmdTranslateC(comp: *Compilation, arena: Allocator, fancy_output: ?*Compilation.CImportResult) !void {
4469 if (build_options.only_core_functionality) @panic("@translate-c is not available in a zig2.c build");4468 if (build_options.only_core_functionality) @panic("@translate-c is not available in a zig2.c build");
4469 const color: Color = .auto;
4470 assert(comp.c_source_files.len == 1);4470 assert(comp.c_source_files.len == 1);
4471 const c_source_file = comp.c_source_files[0];4471 const c_source_file = comp.c_source_files[0];
44724472
...@@ -4559,7 +4559,7 @@ fn cmdTranslateC(comp: *Compilation, arena: Allocator, fancy_output: ?*Compilati...@@ -4559,7 +4559,7 @@ fn cmdTranslateC(comp: *Compilation, arena: Allocator, fancy_output: ?*Compilati
4559 p.errors = errors;4559 p.errors = errors;
4560 return;4560 return;
4561 } else {4561 } else {
4562 errors.renderToStdErr(renderOptions(comp.color));4562 errors.renderToStdErr(renderOptions(color));
4563 process.exit(1);4563 process.exit(1);
4564 }4564 }
4565 },4565 },
...@@ -5533,7 +5533,7 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi...@@ -5533,7 +5533,7 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
5533 };5533 };
5534 defer comp.destroy();5534 defer comp.destroy();
55355535
5536 updateModule(comp) catch |err| switch (err) {5536 updateModule(comp, color) catch |err| switch (err) {
5537 error.SemanticAnalyzeFail => process.exit(2),5537 error.SemanticAnalyzeFail => process.exit(2),
5538 else => |e| return e,5538 else => |e| return e,
5539 };5539 };