aboutsummaryrefslogtreecommitdiff
path: root/lib/std/builtin.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-10-13 17:56:47 +0100
committermlugg <mlugg@mlugg.co.uk>2024-10-19 19:15:23 +0100
commit4be0cf30fc10420c2b5fa97a3b25a07b7a0ce7f3 (patch)
tree0c239f9b68fbbc13ae94462756d466ef774a9772 /lib/std/builtin.zig
parentec19086aa0491024622c444b0d9310560de9e6f0 (diff)
downloadzig-4be0cf30fc10420c2b5fa97a3b25a07b7a0ce7f3.tar.gz
zig-4be0cf30fc10420c2b5fa97a3b25a07b7a0ce7f3.zip
test: update for `CallingConvention` changes
This also includes some compiler and std changes to correct error messages which weren't properly updated before.
Diffstat (limited to 'lib/std/builtin.zig')
-rw-r--r--lib/std/builtin.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index 0753417f58..d016a4f136 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -173,7 +173,7 @@ pub const CallingConvention = union(enum(u8)) {
/// Functions marked as `extern` or `export` are given this calling convention by default.
pub const c = builtin.target.defaultCCallingConvention().?;
- pub const winapi: CallingConvention = switch (builtin.target.arch) {
+ pub const winapi: CallingConvention = switch (builtin.target.cpu.arch) {
.x86_64 => .{ .x86_64_win = .{} },
.x86 => .{ .x86_stdcall = .{} },
.aarch64, .aarch64_be => .{ .aarch64_aapcs_win = .{} },
@@ -481,7 +481,9 @@ pub const CallingConvention = union(enum(u8)) {
/// Returns the array of `std.Target.Cpu.Arch` to which this `CallingConvention` applies.
/// Asserts that `cc` is not `.auto`, `.@"async"`, `.naked`, or `.@"inline"`.
- pub const archs = std.Target.Cpu.Arch.fromCallconv;
+ pub fn archs(cc: CallingConvention) []const std.Target.Cpu.Arch {
+ return std.Target.Cpu.Arch.fromCallconv(cc);
+ }
pub fn eql(a: CallingConvention, b: CallingConvention) bool {
return std.meta.eql(a, b);
@@ -490,7 +492,7 @@ pub const CallingConvention = union(enum(u8)) {
pub fn withStackAlign(cc: CallingConvention, incoming_stack_alignment: u64) CallingConvention {
const tag: CallingConvention.Tag = cc;
var result = cc;
- @field(result, tag).incoming_stack_alignment = incoming_stack_alignment;
+ @field(result, @tagName(tag)).incoming_stack_alignment = incoming_stack_alignment;
return result;
}
};