diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-12-05 16:09:07 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-01-01 17:51:18 -0700 |
| commit | b92e30ff0bd2b77a486451b21d17666a311407f3 (patch) | |
| tree | cd2504c6815b27486e554c2541d4496d7e8f91ab /test/tests.zig | |
| parent | f5613a0e3589fcca51411ce379f3c90eace99fa6 (diff) | |
| download | zig-b92e30ff0bd2b77a486451b21d17666a311407f3.tar.gz zig-b92e30ff0bd2b77a486451b21d17666a311407f3.zip | |
std.Build.ResolvedTarget: rename target field to result
This change is seemingly insignificant but I actually agonized over this
for three days. Some other things I considered:
* (status quo in master branch) make Compile step creation functions
accept a Target.Query and delete the ResolvedTarget struct.
- downside: redundantly resolve target queries many times
* same as before but additionally add a hash map to cache target query
resolutions.
- downside: now there is a hash map that doesn't actually need to
exist, just to make the API more ergonomic.
* add is_native_os and is_native_abi fields to std.Target and use it
directly as the result of resolving a target query.
- downside: they really don't belong there. They would be available
as comptime booleans via `@import("builtin")` but they should not
be exposed that way.
With this change the downsides are:
* the option name of addExecutable and friends is `target` instead of
`resolved_target` matching the type name.
- upside: this does not break compatibility with existing build
scripts
* you likely end up seeing `target.result.cpu.arch` rather than
`target.cpu.arch`.
- upside: this is an improvement over `target.target.cpu.arch` which
it was before this commit.
- downside: `b.host.target` is now `b.host.result`.
Diffstat (limited to 'test/tests.zig')
| -rw-r--r-- | test/tests.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/tests.zig b/test/tests.zig index 64c0f3a42e..b2fb1e4bca 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -1043,7 +1043,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { continue; const resolved_target = b.resolveTargetQuery(test_target.target); - const target = resolved_target.target; + const target = resolved_target.result; if (options.skip_cross_glibc and !test_target.target.isNative() and target.isGnuLibC() and test_target.link_libc == true) @@ -1229,7 +1229,7 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S if (skip_non_native and !c_abi_target.target.isNative()) continue; const resolved_target = b.resolveTargetQuery(c_abi_target.target); - const target = resolved_target.target; + const target = resolved_target.result; if (target.os.tag == .windows and target.cpu.arch == .aarch64) { // https://github.com/ziglang/zig/issues/14908 |
