From 881dfecde191c6a7a872cef952700b8e5f9ad508 Mon Sep 17 00:00:00 2001 From: PauloCampana Date: Sun, 10 Nov 2024 22:03:10 -0300 Subject: [PATCH] #20505 #21094 fix compiler errors --- lib/std/c.zig | 5 ++--- lib/std/os/windows.zig | 6 +++--- lib/std/posix.zig | 5 ++--- lib/std/valgrind.zig | 4 ++-- lib/std/valgrind/memcheck.zig | 12 ++++++------ 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/lib/std/c.zig b/lib/std/c.zig index c1523cd68a54..308ca4d1628d 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -8723,7 +8723,7 @@ pub const NOTE = switch (native_os) { pub const EXIT_DETAIL = 0x02000000; /// mask for signal & exit status pub const PDATAMASK = 0x000fffff; - pub const PCTRLMASK = (~PDATAMASK); + pub const PCTRLMASK = 0xf0000000; pub const EXIT_DETAIL_MASK = 0x00070000; pub const EXIT_DECRYPTFAIL = 0x00010000; pub const EXIT_MEMORY = 0x00020000; @@ -8857,7 +8857,7 @@ pub const NOTE = switch (native_os) { pub const EXEC = 0x20000000; /// mask for signal & exit status pub const PDATAMASK = 0x000fffff; - pub const PCTRLMASK = (~PDATAMASK); + pub const PCTRLMASK = 0xf0000000; /// data is seconds pub const SECONDS = 0x00000001; /// data is milliseconds @@ -9579,7 +9579,6 @@ pub const system_info = haiku.system_info; pub const team_id = haiku.team_id; pub const team_info = haiku.team_info; pub const thread_id = haiku.thread_id; -pub const vregs = haiku.vregs; pub const AUTH = openbsd.AUTH; pub const BI = openbsd.BI; diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index d27736135265..28c89ae7d8d7 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -1107,7 +1107,7 @@ pub fn DeleteFile(sub_path_w: []const u16, options: DeleteFileOptions) DeleteFil pub const MoveFileError = error{ FileNotFound, AccessDenied, Unexpected }; -pub fn MoveFileEx(old_path: []const u8, new_path: []const u8, flags: DWORD) MoveFileError!void { +pub fn MoveFileEx(old_path: []const u8, new_path: []const u8, flags: DWORD) (MoveFileError || Wtf8ToPrefixedFileWError)!void { const old_path_w = try sliceToPrefixedFileW(null, old_path); const new_path_w = try sliceToPrefixedFileW(null, new_path); return MoveFileExW(old_path_w.span().ptr, new_path_w.span().ptr, flags); @@ -1515,7 +1515,7 @@ pub const GetFileAttributesError = error{ Unexpected, }; -pub fn GetFileAttributes(filename: []const u8) GetFileAttributesError!DWORD { +pub fn GetFileAttributes(filename: []const u8) (GetFileAttributesError || Wtf8ToPrefixedFileWError)!DWORD { const filename_w = try sliceToPrefixedFileW(null, filename); return GetFileAttributesW(filename_w.span().ptr); } @@ -1664,7 +1664,7 @@ pub fn getpeername(s: ws2_32.SOCKET, name: *ws2_32.sockaddr, namelen: *ws2_32.so pub fn sendmsg( s: ws2_32.SOCKET, - msg: *const ws2_32.WSAMSG, + msg: *ws2_32.WSAMSG_const, flags: u32, ) i32 { var bytes_send: DWORD = undefined; diff --git a/lib/std/posix.zig b/lib/std/posix.zig index 8eb6ed256be5..994edda42b64 100644 --- a/lib/std/posix.zig +++ b/lib/std/posix.zig @@ -154,7 +154,6 @@ pub const socklen_t = system.socklen_t; pub const stack_t = system.stack_t; pub const time_t = system.time_t; pub const timespec = system.timespec; -pub const timestamp_t = system.timestamp_t; pub const timeval = system.timeval; pub const timezone = system.timezone; pub const ucontext_t = system.ucontext_t; @@ -5595,7 +5594,7 @@ pub const ClockGetTimeError = error{UnsupportedClock} || UnexpectedError; /// TODO: change this to return the timespec as a return value pub fn clock_gettime(clock_id: clockid_t, tp: *timespec) ClockGetTimeError!void { if (native_os == .wasi and !builtin.link_libc) { - var ts: timestamp_t = undefined; + var ts: wasi.timestamp_t = undefined; switch (system.clock_time_get(clock_id, 1, &ts)) { .SUCCESS => { tp.* = .{ @@ -5636,7 +5635,7 @@ pub fn clock_gettime(clock_id: clockid_t, tp: *timespec) ClockGetTimeError!void pub fn clock_getres(clock_id: clockid_t, res: *timespec) ClockGetTimeError!void { if (native_os == .wasi and !builtin.link_libc) { - var ts: timestamp_t = undefined; + var ts: wasi.timestamp_t = undefined; switch (system.clock_res_get(@bitCast(clock_id), &ts)) { .SUCCESS => res.* = .{ .sec = @intCast(ts / std.time.ns_per_s), diff --git a/lib/std/valgrind.zig b/lib/std/valgrind.zig index 241f4c732a82..7b7dc4deefbc 100644 --- a/lib/std/valgrind.zig +++ b/lib/std/valgrind.zig @@ -121,7 +121,7 @@ pub fn discardTranslations(qzz: []const u8) void { } pub fn innerThreads(qzz: [*]u8) void { - doClientRequestStmt(.InnerThreads, qzz, 0, 0, 0, 0); + doClientRequestStmt(.InnerThreads, @intFromPtr(qzz), 0, 0, 0, 0); } pub fn nonSimdCall0(func: fn (usize) usize) usize { @@ -273,7 +273,7 @@ pub fn enableErrorReporting() void { /// If no connection is opened, output will go to the log output. /// Returns 1 if command not recognised, 0 otherwise. pub fn monitorCommand(command: [*]u8) bool { - return doClientRequestExpr(0, .GdbMonitorCommand, @intFromPtr(command.ptr), 0, 0, 0, 0) != 0; + return doClientRequestExpr(0, .GdbMonitorCommand, @intFromPtr(command), 0, 0, 0, 0) != 0; } pub const memcheck = @import("valgrind/memcheck.zig"); diff --git a/lib/std/valgrind/memcheck.zig b/lib/std/valgrind/memcheck.zig index 950026afc533..d0e0f0bd8cdd 100644 --- a/lib/std/valgrind/memcheck.zig +++ b/lib/std/valgrind/memcheck.zig @@ -90,26 +90,26 @@ pub fn checkMemIsDefined(qzz: []const u8) usize { /// Do a full memory leak check (like --leak-check=full) mid-execution. pub fn doLeakCheck() void { - doClientRequestStmt(.DO_LEAK_CHECK, 0, 0, 0, 0, 0); + doClientRequestStmt(.DoLeakCheck, 0, 0, 0, 0, 0); } /// Same as doLeakCheck() but only showing the entries for /// which there was an increase in leaked bytes or leaked nr of blocks /// since the previous leak search. pub fn doAddedLeakCheck() void { - doClientRequestStmt(.DO_LEAK_CHECK, 0, 1, 0, 0, 0); + doClientRequestStmt(.DoLeakCheck, 0, 1, 0, 0, 0); } /// Same as doAddedLeakCheck() but showing entries with /// increased or decreased leaked bytes/blocks since previous leak /// search. pub fn doChangedLeakCheck() void { - doClientRequestStmt(.DO_LEAK_CHECK, 0, 2, 0, 0, 0); + doClientRequestStmt(.DoLeakCheck, 0, 2, 0, 0, 0); } /// Do a summary memory leak check (like --leak-check=summary) mid-execution. pub fn doQuickLeakCheck() void { - doClientRequestStmt(.DO_LEAK_CHECK, 1, 0, 0, 0, 0); + doClientRequestStmt(.DoLeakCheck, 1, 0, 0, 0, 0); } /// Return number of leaked, dubious, reachable and suppressed bytes found by @@ -191,7 +191,7 @@ test countLeakBlocks { /// impossible to segfault your system by using this call. pub fn getVbits(zza: []u8, zzvbits: []u8) u2 { std.debug.assert(zzvbits.len >= zza.len / 8); - return @as(u2, @intCast(doClientRequestExpr(0, .GetVbits, @intFromPtr(zza.ptr), @intFromPtr(zzvbits), zza.len, 0, 0))); + return @as(u2, @intCast(doClientRequestExpr(0, .GetVbits, @intFromPtr(zza.ptr), @intFromPtr(zzvbits.ptr), zza.len, 0, 0))); } /// Set the validity data for addresses zza, copying it @@ -204,7 +204,7 @@ pub fn getVbits(zza: []u8, zzvbits: []u8) u2 { /// impossible to segfault your system by using this call. pub fn setVbits(zzvbits: []u8, zza: []u8) u2 { std.debug.assert(zzvbits.len >= zza.len / 8); - return @as(u2, @intCast(doClientRequestExpr(0, .SetVbits, @intFromPtr(zza.ptr), @intFromPtr(zzvbits), zza.len, 0, 0))); + return @as(u2, @intCast(doClientRequestExpr(0, .SetVbits, @intFromPtr(zza.ptr), @intFromPtr(zzvbits.ptr), zza.len, 0, 0))); } /// Disable and re-enable reporting of addressing errors in the