authorgravatar for justus@klausecker.deJustus Klausecker <justus@klausecker.de> 2025-08-21 11:33:34+02:00
committergravatar for justus@klausecker.deJustus Klausecker <justus@klausecker.de> 2025-08-21 11:33:34+02:00
logda4c9af354b1bca2fb05ef2757c7f9ad11728ac6
tree6fecb352d6f4a6626ab37740b5a09cff62725cca
parent590d264bdf340fa1e6549ce1988f9ccb7418f4d7

make some compile errors aliases instead


1 files changed, 13 insertions(+), 7 deletions(-)

lib/std/c/darwin.zig+13-7
......@@ -133,7 +133,11 @@ pub const MACH = struct {
133133 /// Send 64-bit code and subcode in the exception header */
134134 CODES: bool = false,
135135
136 pub const MASK = @compileError("use MACH.EXCEPTION and set/check all named fields");
136 pub const MASK: exception_mask_t = @bitCast(MACH.EXCEPTION{
137 .BACKTRACE_PREFERRED = true,
138 .ERRORS = true,
139 .CODES = true,
140 });
137141 };
138142
139143 pub const MSG = packed struct(kern_return_t) {
......@@ -155,16 +159,16 @@ pub const MACH = struct {
155159 .IPC_SPACE = true,
156160 });
157161
158 pub const TIMEOUT_NONE = @compileError("use mach_msg_timeout_t.NONE");
159 pub const OPTION_NONE = @compileError("use MACH.RCV and/or MACH.SEND with their default values");
162 pub const TIMEOUT_NONE: mach_msg_timeout_t = .NONE;
163 pub const OPTION_NONE: mach_msg_option_t = .NONE;
160164 pub const STRICT_REPLY = @compileError("use MACH.RCV.STRICT_REPLY and/or MACH.SEND.STRICT_REPLY");
161165
162 pub const TYPE = @compileError("use mach_msg_type_name_t members");
166 pub const TYPE = mach_msg_type_name_t;
163167 };
164168
165169 pub const PORT = struct {
166170 pub const NULL: mach_port_t = 0;
167 pub const RIGHT = @compileError("use mach_port_right_t members");
171 pub const RIGHT = mach_port_right_t;
168172 };
169173
170174 pub const RCV = packed struct(integer_t) {
......@@ -222,8 +226,8 @@ pub const MACH = struct {
222226 };
223227};
224228
225pub const MACH_MSG_TYPE = @compileError("use use mach_msg_type_name_t members");
226pub const MACH_PORT_RIGHT = @compileError("use mach_port_right_t members");
229pub const MACH_MSG_TYPE = @compileError("use MACH.MSG.TYPE");
230pub const MACH_PORT_RIGHT = @compileError("use MACH.PORT.RIGHT");
227231pub const MACH_TASK_BASIC_INFO = @compileError("use MACH.TASK.BASIC.INFO");
228232pub const MACH_TASK_BASIC_INFO_COUNT = @compileError("use MACH.TASK.BASIC.INFO_COUNT");
229233
......@@ -522,6 +526,8 @@ pub const mach_msg_option_t = packed union {
522526 RCV: MACH.RCV,
523527 SEND: MACH.SEND,
524528
529 pub const NONE: mach_msg_option_t = @bitCast(@as(integer_t, 0));
530
525531 pub fn sendAndRcv(send: MACH.SEND, rcv: MACH.RCV) mach_msg_option_t {
526532 return @bitCast(@as(integer_t, @bitCast(send)) | @as(integer_t, @bitCast(rcv)));
527533 }