From 51584a2f7842ae10c9859b76ba5722ddf3f58e24 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 30 Jun 2023 09:49:12 -0700 Subject: [PATCH] update zig --- build.zig | 5 ++--- flake.lock | 14 +++++++------- flake.nix | 2 +- src/autorelease.zig | 2 +- src/class.zig | 2 +- src/msg_send.zig | 2 +- src/object.zig | 2 +- vendor/mach-glfw | 2 +- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/build.zig b/build.zig index ee0df79..0e2bf9b 100644 --- a/build.zig +++ b/build.zig @@ -23,17 +23,16 @@ pub fn build(b: *std.Build) !void { const tests = b.addTest(.{ .name = "objc-test", - .kind = .test_exe, .root_source_file = .{ .path = "src/main.zig" }, .target = target, .optimize = optimize, }); tests.linkSystemLibrary("objc"); system_sdk.include(b, tests, .{}); - tests.install(); + b.installArtifact(tests); const test_step = b.step("test", "Run tests"); - const tests_run = tests.run(); + const tests_run = b.addRunArtifact(tests); test_step.dependOn(&tests_run.step); } diff --git a/flake.lock b/flake.lock index 7f61c82..c3551db 100644 --- a/flake.lock +++ b/flake.lock @@ -64,16 +64,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1672580127, - "narHash": "sha256-3lW3xZslREhJogoOkjeZtlBtvFMyxHku7I/9IVehhT8=", + "lastModified": 1688141187, + "narHash": "sha256-MTeum0f3Hz5yss2aoIAIjnx/SKg6PqMUd3ishL8awKU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0874168639713f547c05947c76124f78441ea46c", + "rev": "2847fac7f4f0d614ba9efd624eb93c2da8173898", "type": "github" }, "original": { "owner": "nixos", - "ref": "release-22.05", + "ref": "release-23.05", "repo": "nixpkgs", "type": "github" } @@ -109,11 +109,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1677457546, - "narHash": "sha256-R2k5sOzf6dEg/PbMfZNYFjmJQY1Hbd/4sc8H36I3EAM=", + "lastModified": 1688126918, + "narHash": "sha256-A4j6rWShGZf2wf7RwTd1sWhN9qLAINDYsExqZD6N09k=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "2b07e4e3e3eb07134ac61049abdc1da1ff6c5516", + "rev": "601ed4533722f87b9e97580d30ddd687e58c6b16", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index db48258..69591c9 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "Objective-C runtime bindings for Zig"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/release-22.05"; + nixpkgs.url = "github:nixos/nixpkgs/release-23.05"; flake-utils.url = "github:numtide/flake-utils"; zig.url = "github:mitchellh/zig-overlay"; diff --git a/src/autorelease.zig b/src/autorelease.zig index 5ae1f7a..575cba1 100644 --- a/src/autorelease.zig +++ b/src/autorelease.zig @@ -3,7 +3,7 @@ const std = @import("std"); pub const AutoreleasePool = opaque { /// Create a new autorelease pool. To clean it up, call deinit. pub inline fn init() *AutoreleasePool { - return @ptrCast(*AutoreleasePool, objc_autoreleasePoolPush().?); + return @ptrCast(objc_autoreleasePoolPush().?); } pub inline fn deinit(self: *AutoreleasePool) void { diff --git a/src/class.zig b/src/class.zig index c6a3103..ac6973e 100644 --- a/src/class.zig +++ b/src/class.zig @@ -25,7 +25,7 @@ pub const Class = struct { /// Describes the properties declared by a class. This must be freed. pub fn copyPropertyList(self: Class) []objc.Property { var count: c_uint = undefined; - const list = @ptrCast([*c]objc.Property, c.class_copyPropertyList(self.value, &count)); + const list = @as([*c]objc.Property, @ptrCast(c.class_copyPropertyList(self.value, &count))); if (count == 0) return list[0..0]; return list[0..count]; } diff --git a/src/msg_send.zig b/src/msg_send.zig index e154a1f..6e00989 100644 --- a/src/msg_send.zig +++ b/src/msg_send.zig @@ -79,7 +79,7 @@ pub fn MsgSend(comptime T: type) type { const Fn = MsgSendFn(RealReturn, @TypeOf(target.value), @TypeOf(args)); // Due to this stage2 Zig issue[1], this must be var for now. // [1]: https://github.com/ziglang/zig/issues/13598 - var msg_send_ptr = @ptrCast(*const Fn, msg_send_fn); + var msg_send_ptr: *const Fn = @ptrCast(msg_send_fn); const result = @call(.auto, msg_send_ptr, .{ target.value, sel.value } ++ args); if (!is_object) return result; diff --git a/src/object.zig b/src/object.zig index 95d6237..3ca3118 100644 --- a/src/object.zig +++ b/src/object.zig @@ -12,7 +12,7 @@ pub const Object = struct { /// Convert a raw "id" into an Object. id must fit the size of the /// normal C "id" type (i.e. a `usize`). pub fn fromId(id: anytype) Object { - return .{ .value = @ptrCast(c.id, @alignCast(@alignOf(c.id), id)) }; + return .{ .value = @ptrCast(@alignCast(id)) }; } /// Returns the class of an object. diff --git a/vendor/mach-glfw b/vendor/mach-glfw index 871de93..70ff87b 160000 --- a/vendor/mach-glfw +++ b/vendor/mach-glfw @@ -1 +1 @@ -Subproject commit 871de9334926273b41c80b0fb13a74d8438eb4e7 +Subproject commit 70ff87ba8af0820bbcfdbdf3b15555cb4c19f7ab