zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit a874e729df771c23576e8fcab9d58e45a20dc1bd (tree)
parent 996b4118097c747e65ef1127091f7e48a54bfafc
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed, 20 May 2026 21:12:01 -0700

zig build: remove "cc args" from Run steps

Not sure what I was thinking. This is silly, translate-c package simply
needs to pass this data (link_libc and target) to the CLI application,
which can then do the appropriate behavior.

Diffstat:
Mlib/compiler/Maker/Step/Run.zig | 3---
Mlib/compiler/configurer.zig | 45---------------------------------------------
Mlib/std/Build/Configuration.zig | 6+-----
Mlib/std/Build/Step/Run.zig | 23-----------------------
4 files changed, 1 insertion(+), 76 deletions(-)

diff --git a/lib/compiler/Maker/Step/Run.zig b/lib/compiler/Maker/Step/Run.zig @@ -177,9 +177,6 @@ pub fn make( man.hash.addListOfBytes(run_args); } }, - .cc_args => { - @panic("TODO Run make cc_args"); - }, } } diff --git a/lib/compiler/configurer.zig b/lib/compiler/configurer.zig @@ -313,8 +313,6 @@ const Serialize = struct { .producer = true, .generated = false, .dep_file = false, - .target_query = false, - .link_libc = false, }, .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null }, .suffix = .{ .value = null }, @@ -322,7 +320,6 @@ const Serialize = struct { .path = .{ .value = null }, .producer = .{ .value = stepIndex(s, &a.artifact.step) }, .generated = .{ .value = null }, - .target_query = .{ .value = null }, }, .lazy_path => |a| .{ .flags = .{ @@ -334,8 +331,6 @@ const Serialize = struct { .producer = false, .generated = false, .dep_file = false, - .target_query = false, - .link_libc = false, }, .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null }, .suffix = .{ .value = null }, @@ -343,7 +338,6 @@ const Serialize = struct { .path = .{ .value = try addLazyPath(s, a.lazy_path) }, .producer = .{ .value = null }, .generated = .{ .value = null }, - .target_query = .{ .value = null }, }, .decorated_directory => |a| .{ .flags = .{ @@ -355,8 +349,6 @@ const Serialize = struct { .producer = false, .generated = false, .dep_file = false, - .target_query = false, - .link_libc = false, }, .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null }, .suffix = .{ .value = if (a.suffix.len != 0) try wc.addString(a.suffix) else null }, @@ -364,7 +356,6 @@ const Serialize = struct { .path = .{ .value = try addLazyPath(s, a.lazy_path) }, .producer = .{ .value = null }, .generated = .{ .value = null }, - .target_query = .{ .value = null }, }, .file_content => |a| .{ .flags = .{ @@ -376,8 +367,6 @@ const Serialize = struct { .producer = false, .generated = false, .dep_file = false, - .target_query = false, - .link_libc = false, }, .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null }, .suffix = .{ .value = null }, @@ -385,7 +374,6 @@ const Serialize = struct { .path = .{ .value = try addLazyPath(s, a.lazy_path) }, .producer = .{ .value = null }, .generated = .{ .value = null }, - .target_query = .{ .value = null }, }, .bytes => |a| .{ .flags = .{ @@ -397,8 +385,6 @@ const Serialize = struct { .producer = false, .generated = false, .dep_file = false, - .target_query = false, - .link_libc = false, }, .prefix = .{ .value = try wc.addString(a) }, .suffix = .{ .value = null }, @@ -406,7 +392,6 @@ const Serialize = struct { .path = .{ .value = null }, .producer = .{ .value = null }, .generated = .{ .value = null }, - .target_query = .{ .value = null }, }, .output_file, .output_file_dep => |a, tag| .{ .flags = .{ @@ -418,8 +403,6 @@ const Serialize = struct { .producer = false, .generated = true, .dep_file = tag == .output_file_dep, - .target_query = false, - .link_libc = false, }, .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null }, .suffix = .{ .value = null }, @@ -427,7 +410,6 @@ const Serialize = struct { .path = .{ .value = null }, .producer = .{ .value = null }, .generated = .{ .value = a.generated_file }, - .target_query = .{ .value = null }, }, .output_directory => |a| .{ .flags = .{ @@ -439,8 +421,6 @@ const Serialize = struct { .producer = false, .generated = true, .dep_file = false, - .target_query = false, - .link_libc = false, }, .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null }, .suffix = .{ .value = null }, @@ -448,7 +428,6 @@ const Serialize = struct { .path = .{ .value = null }, .producer = .{ .value = null }, .generated = .{ .value = a.generated_file }, - .target_query = .{ .value = null }, }, .passthru => .{ .flags = .{ @@ -460,8 +439,6 @@ const Serialize = struct { .producer = false, .generated = false, .dep_file = false, - .target_query = false, - .link_libc = false, }, .prefix = .{ .value = null }, .suffix = .{ .value = null }, @@ -469,28 +446,6 @@ const Serialize = struct { .path = .{ .value = null }, .producer = .{ .value = null }, .generated = .{ .value = null }, - .target_query = .{ .value = null }, - }, - .cc_args => |a| .{ - .flags = .{ - .tag = .cc_args, - .prefix = false, - .suffix = false, - .basename = false, - .path = false, - .producer = false, - .generated = false, - .dep_file = false, - .target_query = a.target_query != .none, - .link_libc = a.link_libc, - }, - .prefix = .{ .value = null }, - .suffix = .{ .value = null }, - .basename = .{ .value = null }, - .path = .{ .value = null }, - .producer = .{ .value = null }, - .generated = .{ .value = null }, - .target_query = .{ .value = a.target_query.unwrap() }, }, }); } diff --git a/lib/std/Build/Configuration.zig b/lib/std/Build/Configuration.zig @@ -586,7 +586,6 @@ pub const Step = extern struct { /// Always a compile step. producer: Storage.FlagOptional(.flags, .producer, Step.Index), generated: Storage.FlagOptional(.flags, .generated, GeneratedFileIndex), - target_query: Storage.FlagOptional(.flags, .target_query, TargetQuery.Index), pub const Flags = packed struct(u32) { tag: Arg.Tag, @@ -597,9 +596,7 @@ pub const Step = extern struct { producer: bool, generated: bool, dep_file: bool, - target_query: bool, - link_libc: bool, - _: u19 = 0, + _: u21 = 0, }; pub const Tag = enum(u4) { @@ -613,7 +610,6 @@ pub const Step = extern struct { output_file, output_directory, passthru, - cc_args, }; pub const Index = IndexType(@This()); diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig @@ -143,13 +143,6 @@ pub const Arg = union(enum) { output_directory: *Output, /// The arguments passed after "--" on the "zig build" CLI. passthru, - /// Adds standard "-isystem" and "-iframework" arguments corresponding to the libc of the target. - cc_args: CcArgs, -}; - -pub const CcArgs = struct { - link_libc: bool, - target_query: Configuration.TargetQuery.OptionalIndex, }; pub const PrefixedArtifact = struct { @@ -536,22 +529,6 @@ pub fn addPassthruArgs(run: *Run) void { run.argv.append(arena, .passthru) catch @panic("OOM"); } -pub const AddCcArgs = struct { - link_libc: bool = false, - target_query: ?*const std.Target.Query = null, -}; - -/// Appends C compiler flags for the target and for including libc. -pub fn addCcArgs(run: *Run, options: AddCcArgs) void { - const graph = run.step.owner.graph; - const arena = graph.arena; - const wc = &graph.wip_configuration; - run.argv.append(arena, .{ .cc_args = .{ - .link_libc = options.link_libc, - .target_query = if (options.target_query) |q| wc.addTargetQuery(q) catch @panic("OOM") else .none, - } }) catch @panic("OOM"); -} - pub fn setStdIn(run: *Run, stdin: StdIn) void { switch (stdin) { .lazy_path => |lazy_path| lazy_path.addStepDependencies(&run.step),