authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-12-08 11:31:05+00:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-12-09 17:35:10-05:00
log3aab81b0abe2efeab8a2c7cdae2146252b4f703f
tree8c08297231e51f59709139c5b95620dc4656ae0f
parentb94bb6f96f475efcdb24c64fe36a4ec22bf18cdf

Builtin: clean up formatting of generated code

This commit simply tweaks the generated `builtin.zig` source code to be more consistent and in line with current conventions.

1 files changed, 11 insertions(+), 12 deletions(-)

src/Builtin.zig+11-12
......@@ -38,15 +38,15 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
3838 \\pub const zig_version_string = "{s}";
3939 \\pub const zig_backend = std.builtin.CompilerBackend.{p_};
4040 \\
41 \\pub const output_mode = std.builtin.OutputMode.{p_};
42 \\pub const link_mode = std.builtin.LinkMode.{p_};
41 \\pub const output_mode: std.builtin.OutputMode = .{p_};
42 \\pub const link_mode: std.builtin.LinkMode = .{p_};
4343 \\pub const is_test = {};
4444 \\pub const single_threaded = {};
45 \\pub const abi = std.Target.Abi.{p_};
45 \\pub const abi: std.Target.Abi = .{p_};
4646 \\pub const cpu: std.Target.Cpu = .{{
4747 \\ .arch = .{p_},
4848 \\ .model = &std.Target.{p_}.cpu.{p_},
49 \\ .features = std.Target.{p_}.featureSet(&[_]std.Target.{p_}.Feature{{
49 \\ .features = std.Target.{p_}.featureSet(&.{{
5050 \\
5151 , .{
5252 build_options.version,
......@@ -60,7 +60,6 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
6060 std.zig.fmtId(generic_arch_name),
6161 std.zig.fmtId(target.cpu.model.name),
6262 std.zig.fmtId(generic_arch_name),
63 std.zig.fmtId(generic_arch_name),
6463 });
6564
6665 for (target.cpu.arch.allFeaturesList(), 0..) |feature, index_usize| {
......@@ -73,7 +72,7 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
7372 try buffer.writer().print(
7473 \\ }}),
7574 \\}};
76 \\pub const os = std.Target.Os{{
75 \\pub const os: std.Target.Os = .{{
7776 \\ .tag = .{p_},
7877 \\ .version_range = .{{
7978 ,
......@@ -196,13 +195,13 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
196195
197196 if (target.dynamic_linker.get()) |dl| {
198197 try buffer.writer().print(
199 \\ .dynamic_linker = std.Target.DynamicLinker.init("{s}"),
198 \\ .dynamic_linker = .init("{s}"),
200199 \\}};
201200 \\
202201 , .{dl});
203202 } else {
204203 try buffer.appendSlice(
205 \\ .dynamic_linker = std.Target.DynamicLinker.none,
204 \\ .dynamic_linker = .none,
206205 \\};
207206 \\
208207 );
......@@ -216,8 +215,8 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
216215 const link_libc = opts.link_libc;
217216
218217 try buffer.writer().print(
219 \\pub const object_format = std.Target.ObjectFormat.{p_};
220 \\pub const mode = std.builtin.OptimizeMode.{p_};
218 \\pub const object_format: std.Target.ObjectFormat = .{p_};
219 \\pub const mode: std.builtin.OptimizeMode = .{p_};
221220 \\pub const link_libc = {};
222221 \\pub const link_libcpp = {};
223222 \\pub const have_error_return_tracing = {};
......@@ -227,7 +226,7 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
227226 \\pub const position_independent_code = {};
228227 \\pub const position_independent_executable = {};
229228 \\pub const strip_debug_info = {};
230 \\pub const code_model = std.builtin.CodeModel.{p_};
229 \\pub const code_model: std.builtin.CodeModel = .{p_};
231230 \\pub const omit_frame_pointer = {};
232231 \\
233232 , .{
......@@ -248,7 +247,7 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
248247
249248 if (target.os.tag == .wasi) {
250249 try buffer.writer().print(
251 \\pub const wasi_exec_model = std.builtin.WasiExecModel.{p_};
250 \\pub const wasi_exec_model: std.builtin.WasiExecModel = .{p_};
252251 \\
253252 , .{std.zig.fmtId(@tagName(opts.wasi_exec_model))});
254253 }