diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-10-23 03:19:03 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-23 03:19:03 -0400 |
| commit | 94d61ce964cd23fcf46dabeddc19837b4dd3209f (patch) | |
| tree | 00fc6af0a362d7d5744744e3f5e8008136957401 /src/main.zig | |
| parent | b82459fa435c366c6af0fee96c3d9b95c24078f9 (diff) | |
| parent | ed82e4f7ac057286444135dda79fb7c6a579573a (diff) | |
| download | zig-94d61ce964cd23fcf46dabeddc19837b4dd3209f.tar.gz zig-94d61ce964cd23fcf46dabeddc19837b4dd3209f.zip | |
Merge pull request #17651 from Vexu/error-limit
Make distinct error limit configurable (attempt #2)
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig index 9ab5b8c38e..e9cdc5b550 100644 --- a/src/main.zig +++ b/src/main.zig @@ -421,6 +421,7 @@ const usage_build_generic = \\ --deps [dep],[dep],... Set dependency names for the root package \\ dep: [[import=]name] \\ --main-mod-path Set the directory of the root module + \\ --error-limit [num] Set the maximum amount of distinct error values \\ -fPIC Force-enable Position Independent Code \\ -fno-PIC Force-disable Position Independent Code \\ -fPIE Force-enable Position Independent Executable @@ -911,6 +912,8 @@ fn buildOutputType( var error_tracing: ?bool = null; var pdb_out_path: ?[]const u8 = null; var dwarf_format: ?std.dwarf.Format = null; + var error_limit: ?Module.ErrorInt = null; + // e.g. -m3dnow or -mno-outline-atomics. They correspond to std.Target llvm cpu feature names. // This array is populated by zig cc frontend and then has to be converted to zig-style // CPU features. @@ -1040,6 +1043,11 @@ fn buildOutputType( root_deps_str = args_iter.nextOrFatal(); } else if (mem.eql(u8, arg, "--main-mod-path")) { main_mod_path = args_iter.nextOrFatal(); + } else if (mem.eql(u8, arg, "--error-limit")) { + const next_arg = args_iter.nextOrFatal(); + error_limit = std.fmt.parseUnsigned(Module.ErrorInt, next_arg, 0) catch |err| { + fatal("unable to parse error limit '{s}': {s}", .{ next_arg, @errorName(err) }); + }; } else if (mem.eql(u8, arg, "-cflags")) { extra_cflags.shrinkRetainingCapacity(0); while (true) { @@ -3546,6 +3554,7 @@ fn buildOutputType( .reference_trace = reference_trace, .error_tracing = error_tracing, .pdb_out_path = pdb_out_path, + .error_limit = error_limit, }) catch |err| switch (err) { error.LibCUnavailable => { const target = target_info.target; |
