authorgravatar for manlio.perillo@gmail.comManlio Perillo <manlio.perillo@gmail.com> 2024-02-04 16:29:53+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-06 16:09:55-08:00
log3da6043e2c3fa657cc7261e8cffdf3564c02dda9
tree9b27b0479dc923db70201752f72fabb2f7a69a13
parent476ba04753ede5f81c0d411f017383a1f50d5e80

compiler: remove unnecessary pub declarations in main.zig

Some declarations, like zig subcommands and usage strings, are unnecessary marked as public, even thought they are only referenced by main.zig.

1 files changed, 19 insertions(+), 19 deletions(-)

src/main.zig+19-19
...@@ -52,7 +52,7 @@ pub fn wasi_cwd() fs.Dir {...@@ -52,7 +52,7 @@ pub fn wasi_cwd() fs.Dir {
52 return .{ .fd = cwd_fd };52 return .{ .fd = cwd_fd };
53}53}
5454
55pub fn getWasiPreopen(name: []const u8) Compilation.Directory {55fn getWasiPreopen(name: []const u8) Compilation.Directory {
56 return .{56 return .{
57 .path = name,57 .path = name,
58 .handle = .{58 .handle = .{
...@@ -68,11 +68,11 @@ pub fn fatal(comptime format: []const u8, args: anytype) noreturn {...@@ -68,11 +68,11 @@ pub fn fatal(comptime format: []const u8, args: anytype) noreturn {
6868
69/// There are many assumptions in the entire codebase that Zig source files can69/// There are many assumptions in the entire codebase that Zig source files can
70/// be byte-indexed with a u32 integer.70/// be byte-indexed with a u32 integer.
71pub const max_src_size = std.math.maxInt(u32);71const max_src_size = std.math.maxInt(u32);
7272
73pub const debug_extensions_enabled = builtin.mode == .Debug;73const debug_extensions_enabled = builtin.mode == .Debug;
7474
75pub const Color = enum {75const Color = enum {
76 auto,76 auto,
77 off,77 off,
78 on,78 on,
...@@ -234,7 +234,7 @@ fn verifyLibcxxCorrectlyLinked() void {...@@ -234,7 +234,7 @@ fn verifyLibcxxCorrectlyLinked() void {
234 }234 }
235}235}
236236
237pub fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {237fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
238 if (args.len <= 1) {238 if (args.len <= 1) {
239 std.log.info("{s}", .{usage});239 std.log.info("{s}", .{usage});
240 fatal("expected command argument", .{});240 fatal("expected command argument", .{});
...@@ -778,7 +778,7 @@ const CliModule = struct {...@@ -778,7 +778,7 @@ const CliModule = struct {
778 rc_source_files_start: usize,778 rc_source_files_start: usize,
779 rc_source_files_end: usize,779 rc_source_files_end: usize,
780780
781 pub const Dep = struct {781 const Dep = struct {
782 key: []const u8,782 key: []const u8,
783 value: []const u8,783 value: []const u8,
784 };784 };
...@@ -4933,7 +4933,7 @@ fn detectRcIncludeDirs(arena: Allocator, zig_lib_dir: []const u8, auto_includes:...@@ -4933,7 +4933,7 @@ fn detectRcIncludeDirs(arena: Allocator, zig_lib_dir: []const u8, auto_includes:
4933 }4933 }
4934}4934}
49354935
4936pub const usage_libc =4936const usage_libc =
4937 \\Usage: zig libc4937 \\Usage: zig libc
4938 \\4938 \\
4939 \\ Detect the native libc installation and print the resulting4939 \\ Detect the native libc installation and print the resulting
...@@ -4952,7 +4952,7 @@ pub const usage_libc =...@@ -4952,7 +4952,7 @@ pub const usage_libc =
4952 \\4952 \\
4953;4953;
49544954
4955pub fn cmdLibC(gpa: Allocator, args: []const []const u8) !void {4955fn cmdLibC(gpa: Allocator, args: []const []const u8) !void {
4956 var input_file: ?[]const u8 = null;4956 var input_file: ?[]const u8 = null;
4957 var target_arch_os_abi: []const u8 = "native";4957 var target_arch_os_abi: []const u8 = "native";
4958 var print_includes: bool = false;4958 var print_includes: bool = false;
...@@ -5063,7 +5063,7 @@ pub fn cmdLibC(gpa: Allocator, args: []const []const u8) !void {...@@ -5063,7 +5063,7 @@ pub fn cmdLibC(gpa: Allocator, args: []const []const u8) !void {
5063 }5063 }
5064}5064}
50655065
5066pub const usage_init =5066const usage_init =
5067 \\Usage: zig init5067 \\Usage: zig init
5068 \\5068 \\
5069 \\ Initializes a `zig build` project in the current working5069 \\ Initializes a `zig build` project in the current working
...@@ -5075,7 +5075,7 @@ pub const usage_init =...@@ -5075,7 +5075,7 @@ pub const usage_init =
5075 \\5075 \\
5076;5076;
50775077
5078pub fn cmdInit(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {5078fn cmdInit(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
5079 {5079 {
5080 var i: usize = 0;5080 var i: usize = 0;
5081 while (i < args.len) : (i += 1) {5081 while (i < args.len) : (i += 1) {
...@@ -5126,7 +5126,7 @@ pub fn cmdInit(gpa: Allocator, arena: Allocator, args: []const []const u8) !void...@@ -5126,7 +5126,7 @@ pub fn cmdInit(gpa: Allocator, arena: Allocator, args: []const []const u8) !void
5126 return cleanExit();5126 return cleanExit();
5127}5127}
51285128
5129pub const usage_build =5129const usage_build =
5130 \\Usage: zig build [steps] [options]5130 \\Usage: zig build [steps] [options]
5131 \\5131 \\
5132 \\ Build a project from build.zig.5132 \\ Build a project from build.zig.
...@@ -5150,7 +5150,7 @@ pub const usage_build =...@@ -5150,7 +5150,7 @@ pub const usage_build =
5150 \\5150 \\
5151;5151;
51525152
5153pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {5153fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
5154 var progress: std.Progress = .{ .dont_print_on_dumb = true };5154 var progress: std.Progress = .{ .dont_print_on_dumb = true };
51555155
5156 var build_file: ?[]const u8 = null;5156 var build_file: ?[]const u8 = null;
...@@ -5772,7 +5772,7 @@ fn readSourceFileToEndAlloc(...@@ -5772,7 +5772,7 @@ fn readSourceFileToEndAlloc(
5772 return source_code;5772 return source_code;
5773}5773}
57745774
5775pub const usage_fmt =5775const usage_fmt =
5776 \\Usage: zig fmt [file]...5776 \\Usage: zig fmt [file]...
5777 \\5777 \\
5778 \\ Formats the input files and modifies them in-place.5778 \\ Formats the input files and modifies them in-place.
...@@ -5803,7 +5803,7 @@ const Fmt = struct {...@@ -5803,7 +5803,7 @@ const Fmt = struct {
5803 const SeenMap = std.AutoHashMap(fs.File.INode, void);5803 const SeenMap = std.AutoHashMap(fs.File.INode, void);
5804};5804};
58055805
5806pub fn cmdFmt(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {5806fn cmdFmt(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
5807 var color: Color = .auto;5807 var color: Color = .auto;
5808 var stdin_flag: bool = false;5808 var stdin_flag: bool = false;
5809 var check_flag: bool = false;5809 var check_flag: bool = false;
...@@ -6190,7 +6190,7 @@ pub fn putAstErrorsIntoBundle(...@@ -6190,7 +6190,7 @@ pub fn putAstErrorsIntoBundle(
6190 try Compilation.addZirErrorMessages(wip_errors, &file);6190 try Compilation.addZirErrorMessages(wip_errors, &file);
6191}6191}
61926192
6193pub const info_zen =6193const info_zen =
6194 \\6194 \\
6195 \\ * Communicate intent precisely.6195 \\ * Communicate intent precisely.
6196 \\ * Edge cases matter.6196 \\ * Edge cases matter.
...@@ -6655,7 +6655,7 @@ const usage_ast_check =...@@ -6655,7 +6655,7 @@ const usage_ast_check =
6655 \\6655 \\
6656;6656;
66576657
6658pub fn cmdAstCheck(6658fn cmdAstCheck(
6659 gpa: Allocator,6659 gpa: Allocator,
6660 arena: Allocator,6660 arena: Allocator,
6661 args: []const []const u8,6661 args: []const []const u8,
...@@ -6816,7 +6816,7 @@ pub fn cmdAstCheck(...@@ -6816,7 +6816,7 @@ pub fn cmdAstCheck(
6816}6816}
68176817
6818/// This is only enabled for debug builds.6818/// This is only enabled for debug builds.
6819pub fn cmdDumpZir(6819fn cmdDumpZir(
6820 gpa: Allocator,6820 gpa: Allocator,
6821 arena: Allocator,6821 arena: Allocator,
6822 args: []const []const u8,6822 args: []const []const u8,
...@@ -6876,7 +6876,7 @@ pub fn cmdDumpZir(...@@ -6876,7 +6876,7 @@ pub fn cmdDumpZir(
6876}6876}
68776877
6878/// This is only enabled for debug builds.6878/// This is only enabled for debug builds.
6879pub fn cmdChangelist(6879fn cmdChangelist(
6880 gpa: Allocator,6880 gpa: Allocator,
6881 arena: Allocator,6881 arena: Allocator,
6882 args: []const []const u8,6882 args: []const []const u8,
...@@ -7377,7 +7377,7 @@ fn parseRcIncludes(arg: []const u8) Compilation.RcIncludes {...@@ -7377,7 +7377,7 @@ fn parseRcIncludes(arg: []const u8) Compilation.RcIncludes {
7377 fatal("unsupported rc includes type: '{s}'", .{arg});7377 fatal("unsupported rc includes type: '{s}'", .{arg});
7378}7378}
73797379
7380pub const usage_fetch =7380const usage_fetch =
7381 \\Usage: zig fetch [options] <url>7381 \\Usage: zig fetch [options] <url>
7382 \\Usage: zig fetch [options] <path>7382 \\Usage: zig fetch [options] <path>
7383 \\7383 \\