update zig

This commit is contained in:
Mitchell Hashimoto 2023-06-30 09:49:12 -07:00
parent 1e3537ab97
commit 51584a2f78
No known key found for this signature in database
GPG key ID: 523D5DC389D273BC
8 changed files with 15 additions and 16 deletions

View file

@ -23,17 +23,16 @@ pub fn build(b: *std.Build) !void {
const tests = b.addTest(.{ const tests = b.addTest(.{
.name = "objc-test", .name = "objc-test",
.kind = .test_exe,
.root_source_file = .{ .path = "src/main.zig" }, .root_source_file = .{ .path = "src/main.zig" },
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });
tests.linkSystemLibrary("objc"); tests.linkSystemLibrary("objc");
system_sdk.include(b, tests, .{}); system_sdk.include(b, tests, .{});
tests.install(); b.installArtifact(tests);
const test_step = b.step("test", "Run 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); test_step.dependOn(&tests_run.step);
} }

14
flake.lock generated
View file

@ -64,16 +64,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1672580127, "lastModified": 1688141187,
"narHash": "sha256-3lW3xZslREhJogoOkjeZtlBtvFMyxHku7I/9IVehhT8=", "narHash": "sha256-MTeum0f3Hz5yss2aoIAIjnx/SKg6PqMUd3ishL8awKU=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0874168639713f547c05947c76124f78441ea46c", "rev": "2847fac7f4f0d614ba9efd624eb93c2da8173898",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "release-22.05", "ref": "release-23.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -109,11 +109,11 @@
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1677457546, "lastModified": 1688126918,
"narHash": "sha256-R2k5sOzf6dEg/PbMfZNYFjmJQY1Hbd/4sc8H36I3EAM=", "narHash": "sha256-A4j6rWShGZf2wf7RwTd1sWhN9qLAINDYsExqZD6N09k=",
"owner": "mitchellh", "owner": "mitchellh",
"repo": "zig-overlay", "repo": "zig-overlay",
"rev": "2b07e4e3e3eb07134ac61049abdc1da1ff6c5516", "rev": "601ed4533722f87b9e97580d30ddd687e58c6b16",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -2,7 +2,7 @@
description = "Objective-C runtime bindings for Zig"; description = "Objective-C runtime bindings for Zig";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/release-22.05"; nixpkgs.url = "github:nixos/nixpkgs/release-23.05";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
zig.url = "github:mitchellh/zig-overlay"; zig.url = "github:mitchellh/zig-overlay";

View file

@ -3,7 +3,7 @@ const std = @import("std");
pub const AutoreleasePool = opaque { pub const AutoreleasePool = opaque {
/// Create a new autorelease pool. To clean it up, call deinit. /// Create a new autorelease pool. To clean it up, call deinit.
pub inline fn init() *AutoreleasePool { pub inline fn init() *AutoreleasePool {
return @ptrCast(*AutoreleasePool, objc_autoreleasePoolPush().?); return @ptrCast(objc_autoreleasePoolPush().?);
} }
pub inline fn deinit(self: *AutoreleasePool) void { pub inline fn deinit(self: *AutoreleasePool) void {

View file

@ -25,7 +25,7 @@ pub const Class = struct {
/// Describes the properties declared by a class. This must be freed. /// Describes the properties declared by a class. This must be freed.
pub fn copyPropertyList(self: Class) []objc.Property { pub fn copyPropertyList(self: Class) []objc.Property {
var count: c_uint = undefined; 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]; if (count == 0) return list[0..0];
return list[0..count]; return list[0..count];
} }

View file

@ -79,7 +79,7 @@ pub fn MsgSend(comptime T: type) type {
const Fn = MsgSendFn(RealReturn, @TypeOf(target.value), @TypeOf(args)); const Fn = MsgSendFn(RealReturn, @TypeOf(target.value), @TypeOf(args));
// Due to this stage2 Zig issue[1], this must be var for now. // Due to this stage2 Zig issue[1], this must be var for now.
// [1]: https://github.com/ziglang/zig/issues/13598 // [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); const result = @call(.auto, msg_send_ptr, .{ target.value, sel.value } ++ args);
if (!is_object) return result; if (!is_object) return result;

View file

@ -12,7 +12,7 @@ pub const Object = struct {
/// Convert a raw "id" into an Object. id must fit the size of the /// Convert a raw "id" into an Object. id must fit the size of the
/// normal C "id" type (i.e. a `usize`). /// normal C "id" type (i.e. a `usize`).
pub fn fromId(id: anytype) Object { 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. /// Returns the class of an object.

2
vendor/mach-glfw vendored

@ -1 +1 @@
Subproject commit 871de9334926273b41c80b0fb13a74d8438eb4e7 Subproject commit 70ff87ba8af0820bbcfdbdf3b15555cb4c19f7ab