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 {...@@ -38,15 +38,15 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
38 \\pub const zig_version_string = "{s}";38 \\pub const zig_version_string = "{s}";
39 \\pub const zig_backend = std.builtin.CompilerBackend.{p_};39 \\pub const zig_backend = std.builtin.CompilerBackend.{p_};
40 \\40 \\
41 \\pub const output_mode = std.builtin.OutputMode.{p_};41 \\pub const output_mode: std.builtin.OutputMode = .{p_};
42 \\pub const link_mode = std.builtin.LinkMode.{p_};42 \\pub const link_mode: std.builtin.LinkMode = .{p_};
43 \\pub const is_test = {};43 \\pub const is_test = {};
44 \\pub const single_threaded = {};44 \\pub const single_threaded = {};
45 \\pub const abi = std.Target.Abi.{p_};45 \\pub const abi: std.Target.Abi = .{p_};
46 \\pub const cpu: std.Target.Cpu = .{{46 \\pub const cpu: std.Target.Cpu = .{{
47 \\ .arch = .{p_},47 \\ .arch = .{p_},
48 \\ .model = &std.Target.{p_}.cpu.{p_},48 \\ .model = &std.Target.{p_}.cpu.{p_},
49 \\ .features = std.Target.{p_}.featureSet(&[_]std.Target.{p_}.Feature{{49 \\ .features = std.Target.{p_}.featureSet(&.{{
50 \\50 \\
51 , .{51 , .{
52 build_options.version,52 build_options.version,
...@@ -60,7 +60,6 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {...@@ -60,7 +60,6 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
60 std.zig.fmtId(generic_arch_name),60 std.zig.fmtId(generic_arch_name),
61 std.zig.fmtId(target.cpu.model.name),61 std.zig.fmtId(target.cpu.model.name),
62 std.zig.fmtId(generic_arch_name),62 std.zig.fmtId(generic_arch_name),
63 std.zig.fmtId(generic_arch_name),
64 });63 });
6564
66 for (target.cpu.arch.allFeaturesList(), 0..) |feature, index_usize| {65 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 {...@@ -73,7 +72,7 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
73 try buffer.writer().print(72 try buffer.writer().print(
74 \\ }}),73 \\ }}),
75 \\}};74 \\}};
76 \\pub const os = std.Target.Os{{75 \\pub const os: std.Target.Os = .{{
77 \\ .tag = .{p_},76 \\ .tag = .{p_},
78 \\ .version_range = .{{77 \\ .version_range = .{{
79 ,78 ,
...@@ -196,13 +195,13 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {...@@ -196,13 +195,13 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
196195
197 if (target.dynamic_linker.get()) |dl| {196 if (target.dynamic_linker.get()) |dl| {
198 try buffer.writer().print(197 try buffer.writer().print(
199 \\ .dynamic_linker = std.Target.DynamicLinker.init("{s}"),198 \\ .dynamic_linker = .init("{s}"),
200 \\}};199 \\}};
201 \\200 \\
202 , .{dl});201 , .{dl});
203 } else {202 } else {
204 try buffer.appendSlice(203 try buffer.appendSlice(
205 \\ .dynamic_linker = std.Target.DynamicLinker.none,204 \\ .dynamic_linker = .none,
206 \\};205 \\};
207 \\206 \\
208 );207 );
...@@ -216,8 +215,8 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {...@@ -216,8 +215,8 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
216 const link_libc = opts.link_libc;215 const link_libc = opts.link_libc;
217216
218 try buffer.writer().print(217 try buffer.writer().print(
219 \\pub const object_format = std.Target.ObjectFormat.{p_};218 \\pub const object_format: std.Target.ObjectFormat = .{p_};
220 \\pub const mode = std.builtin.OptimizeMode.{p_};219 \\pub const mode: std.builtin.OptimizeMode = .{p_};
221 \\pub const link_libc = {};220 \\pub const link_libc = {};
222 \\pub const link_libcpp = {};221 \\pub const link_libcpp = {};
223 \\pub const have_error_return_tracing = {};222 \\pub const have_error_return_tracing = {};
...@@ -227,7 +226,7 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {...@@ -227,7 +226,7 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
227 \\pub const position_independent_code = {};226 \\pub const position_independent_code = {};
228 \\pub const position_independent_executable = {};227 \\pub const position_independent_executable = {};
229 \\pub const strip_debug_info = {};228 \\pub const strip_debug_info = {};
230 \\pub const code_model = std.builtin.CodeModel.{p_};229 \\pub const code_model: std.builtin.CodeModel = .{p_};
231 \\pub const omit_frame_pointer = {};230 \\pub const omit_frame_pointer = {};
232 \\231 \\
233 , .{232 , .{
...@@ -248,7 +247,7 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {...@@ -248,7 +247,7 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
248247
249 if (target.os.tag == .wasi) {248 if (target.os.tag == .wasi) {
250 try buffer.writer().print(249 try buffer.writer().print(
251 \\pub const wasi_exec_model = std.builtin.WasiExecModel.{p_};250 \\pub const wasi_exec_model: std.builtin.WasiExecModel = .{p_};
252 \\251 \\
253 , .{std.zig.fmtId(@tagName(opts.wasi_exec_model))});252 , .{std.zig.fmtId(@tagName(opts.wasi_exec_model))});
254 }253 }