mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
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.
This commit is contained in:
parent
476ba04753
commit
3da6043e2c
38
src/main.zig
38
src/main.zig
@ -52,7 +52,7 @@ pub fn wasi_cwd() fs.Dir {
|
|||||||
return .{ .fd = cwd_fd };
|
return .{ .fd = cwd_fd };
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getWasiPreopen(name: []const u8) Compilation.Directory {
|
fn getWasiPreopen(name: []const u8) Compilation.Directory {
|
||||||
return .{
|
return .{
|
||||||
.path = name,
|
.path = name,
|
||||||
.handle = .{
|
.handle = .{
|
||||||
@ -68,11 +68,11 @@ pub fn fatal(comptime format: []const u8, args: anytype) noreturn {
|
|||||||
|
|
||||||
/// There are many assumptions in the entire codebase that Zig source files can
|
/// There are many assumptions in the entire codebase that Zig source files can
|
||||||
/// be byte-indexed with a u32 integer.
|
/// be byte-indexed with a u32 integer.
|
||||||
pub const max_src_size = std.math.maxInt(u32);
|
const max_src_size = std.math.maxInt(u32);
|
||||||
|
|
||||||
pub const debug_extensions_enabled = builtin.mode == .Debug;
|
const debug_extensions_enabled = builtin.mode == .Debug;
|
||||||
|
|
||||||
pub const Color = enum {
|
const Color = enum {
|
||||||
auto,
|
auto,
|
||||||
off,
|
off,
|
||||||
on,
|
on,
|
||||||
@ -234,7 +234,7 @@ fn verifyLibcxxCorrectlyLinked() void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
|
fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
|
||||||
if (args.len <= 1) {
|
if (args.len <= 1) {
|
||||||
std.log.info("{s}", .{usage});
|
std.log.info("{s}", .{usage});
|
||||||
fatal("expected command argument", .{});
|
fatal("expected command argument", .{});
|
||||||
@ -778,7 +778,7 @@ const CliModule = struct {
|
|||||||
rc_source_files_start: usize,
|
rc_source_files_start: usize,
|
||||||
rc_source_files_end: usize,
|
rc_source_files_end: usize,
|
||||||
|
|
||||||
pub const Dep = struct {
|
const Dep = struct {
|
||||||
key: []const u8,
|
key: []const u8,
|
||||||
value: []const u8,
|
value: []const u8,
|
||||||
};
|
};
|
||||||
@ -4933,7 +4933,7 @@ fn detectRcIncludeDirs(arena: Allocator, zig_lib_dir: []const u8, auto_includes:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const usage_libc =
|
const usage_libc =
|
||||||
\\Usage: zig libc
|
\\Usage: zig libc
|
||||||
\\
|
\\
|
||||||
\\ Detect the native libc installation and print the resulting
|
\\ Detect the native libc installation and print the resulting
|
||||||
@ -4952,7 +4952,7 @@ pub const usage_libc =
|
|||||||
\\
|
\\
|
||||||
;
|
;
|
||||||
|
|
||||||
pub fn cmdLibC(gpa: Allocator, args: []const []const u8) !void {
|
fn cmdLibC(gpa: Allocator, args: []const []const u8) !void {
|
||||||
var input_file: ?[]const u8 = null;
|
var input_file: ?[]const u8 = null;
|
||||||
var target_arch_os_abi: []const u8 = "native";
|
var target_arch_os_abi: []const u8 = "native";
|
||||||
var print_includes: bool = false;
|
var print_includes: bool = false;
|
||||||
@ -5063,7 +5063,7 @@ pub fn cmdLibC(gpa: Allocator, args: []const []const u8) !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const usage_init =
|
const usage_init =
|
||||||
\\Usage: zig init
|
\\Usage: zig init
|
||||||
\\
|
\\
|
||||||
\\ Initializes a `zig build` project in the current working
|
\\ Initializes a `zig build` project in the current working
|
||||||
@ -5075,7 +5075,7 @@ pub const usage_init =
|
|||||||
\\
|
\\
|
||||||
;
|
;
|
||||||
|
|
||||||
pub fn cmdInit(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
|
fn cmdInit(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
|
||||||
{
|
{
|
||||||
var i: usize = 0;
|
var i: usize = 0;
|
||||||
while (i < args.len) : (i += 1) {
|
while (i < args.len) : (i += 1) {
|
||||||
@ -5126,7 +5126,7 @@ pub fn cmdInit(gpa: Allocator, arena: Allocator, args: []const []const u8) !void
|
|||||||
return cleanExit();
|
return cleanExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const usage_build =
|
const usage_build =
|
||||||
\\Usage: zig build [steps] [options]
|
\\Usage: zig build [steps] [options]
|
||||||
\\
|
\\
|
||||||
\\ Build a project from build.zig.
|
\\ Build a project from build.zig.
|
||||||
@ -5150,7 +5150,7 @@ pub const usage_build =
|
|||||||
\\
|
\\
|
||||||
;
|
;
|
||||||
|
|
||||||
pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
|
fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
|
||||||
var progress: std.Progress = .{ .dont_print_on_dumb = true };
|
var progress: std.Progress = .{ .dont_print_on_dumb = true };
|
||||||
|
|
||||||
var build_file: ?[]const u8 = null;
|
var build_file: ?[]const u8 = null;
|
||||||
@ -5772,7 +5772,7 @@ fn readSourceFileToEndAlloc(
|
|||||||
return source_code;
|
return source_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const usage_fmt =
|
const usage_fmt =
|
||||||
\\Usage: zig fmt [file]...
|
\\Usage: zig fmt [file]...
|
||||||
\\
|
\\
|
||||||
\\ Formats the input files and modifies them in-place.
|
\\ Formats the input files and modifies them in-place.
|
||||||
@ -5803,7 +5803,7 @@ const Fmt = struct {
|
|||||||
const SeenMap = std.AutoHashMap(fs.File.INode, void);
|
const SeenMap = std.AutoHashMap(fs.File.INode, void);
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn cmdFmt(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
|
fn cmdFmt(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
|
||||||
var color: Color = .auto;
|
var color: Color = .auto;
|
||||||
var stdin_flag: bool = false;
|
var stdin_flag: bool = false;
|
||||||
var check_flag: bool = false;
|
var check_flag: bool = false;
|
||||||
@ -6190,7 +6190,7 @@ pub fn putAstErrorsIntoBundle(
|
|||||||
try Compilation.addZirErrorMessages(wip_errors, &file);
|
try Compilation.addZirErrorMessages(wip_errors, &file);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const info_zen =
|
const info_zen =
|
||||||
\\
|
\\
|
||||||
\\ * Communicate intent precisely.
|
\\ * Communicate intent precisely.
|
||||||
\\ * Edge cases matter.
|
\\ * Edge cases matter.
|
||||||
@ -6655,7 +6655,7 @@ const usage_ast_check =
|
|||||||
\\
|
\\
|
||||||
;
|
;
|
||||||
|
|
||||||
pub fn cmdAstCheck(
|
fn cmdAstCheck(
|
||||||
gpa: Allocator,
|
gpa: Allocator,
|
||||||
arena: Allocator,
|
arena: Allocator,
|
||||||
args: []const []const u8,
|
args: []const []const u8,
|
||||||
@ -6816,7 +6816,7 @@ pub fn cmdAstCheck(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// This is only enabled for debug builds.
|
/// This is only enabled for debug builds.
|
||||||
pub fn cmdDumpZir(
|
fn cmdDumpZir(
|
||||||
gpa: Allocator,
|
gpa: Allocator,
|
||||||
arena: Allocator,
|
arena: Allocator,
|
||||||
args: []const []const u8,
|
args: []const []const u8,
|
||||||
@ -6876,7 +6876,7 @@ pub fn cmdDumpZir(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// This is only enabled for debug builds.
|
/// This is only enabled for debug builds.
|
||||||
pub fn cmdChangelist(
|
fn cmdChangelist(
|
||||||
gpa: Allocator,
|
gpa: Allocator,
|
||||||
arena: Allocator,
|
arena: Allocator,
|
||||||
args: []const []const u8,
|
args: []const []const u8,
|
||||||
@ -7377,7 +7377,7 @@ fn parseRcIncludes(arg: []const u8) Compilation.RcIncludes {
|
|||||||
fatal("unsupported rc includes type: '{s}'", .{arg});
|
fatal("unsupported rc includes type: '{s}'", .{arg});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const usage_fetch =
|
const usage_fetch =
|
||||||
\\Usage: zig fetch [options] <url>
|
\\Usage: zig fetch [options] <url>
|
||||||
\\Usage: zig fetch [options] <path>
|
\\Usage: zig fetch [options] <path>
|
||||||
\\
|
\\
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user