From 2ab0c7391a871a3063f825e08e02ea2a8e9269e9 Mon Sep 17 00:00:00 2001 From: Vignesh Rajagopalan Date: Mon, 12 Oct 2020 14:29:43 +0530 Subject: [PATCH] Rename .macosx to .macos --- lib/std/c.zig | 8 +++---- lib/std/debug.zig | 4 ++-- lib/std/dynamic_library.zig | 4 ++-- lib/std/event/loop.zig | 24 ++++++++++----------- lib/std/fs.zig | 10 ++++----- lib/std/fs/get_app_data_dir.zig | 2 +- lib/std/fs/test.zig | 2 +- lib/std/fs/watch.zig | 8 +++---- lib/std/os.zig | 18 ++++++++-------- lib/std/os/bits.zig | 2 +- lib/std/os/test.zig | 2 +- lib/std/packed_int_array.zig | 4 ++-- lib/std/process.zig | 6 +++--- lib/std/special/compiler_rt/clear_cache.zig | 2 +- lib/std/target.zig | 16 +++++++------- lib/std/time.zig | 2 +- lib/std/zig/cross_target.zig | 6 +++--- lib/std/zig/system.zig | 2 +- src/codegen/llvm.zig | 2 +- src/link/MachO.zig | 2 +- src/target.zig | 6 +++--- src/type.zig | 2 +- src/zig_llvm.cpp | 4 +++- test/stack_traces.zig | 2 +- test/stage2/test.zig | 2 +- test/tests.zig | 2 +- 26 files changed, 73 insertions(+), 71 deletions(-) diff --git a/lib/std/c.zig b/lib/std/c.zig index a75fcaa84b65e477b6af5c77d7ad703ca87ce540..1fd3c593ccd4e791b656a6276fd1bf77261fdc2d 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -22,7 +22,7 @@ pub usingnamespace @import("os/bits.zig"); pub usingnamespace switch (std.Target.current.os.tag) { .linux => @import("c/linux.zig"), .windows => @import("c/windows.zig"), - .macosx, .ios, .tvos, .watchos => @import("c/darwin.zig"), + .macos, .ios, .tvos, .watchos => @import("c/darwin.zig"), .freebsd, .kfreebsd => @import("c/freebsd.zig"), .netbsd => @import("c/netbsd.zig"), .dragonfly => @import("c/dragonfly.zig"), @@ -122,7 +122,7 @@ pub extern "c" fn readlink(noalias path: [*:0]const u8, noalias buf: [*]u8, bufs pub extern "c" fn readlinkat(dirfd: fd_t, noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize; pub usingnamespace switch (builtin.os.tag) { - .macosx, .ios, .watchos, .tvos => struct { + .macos, .ios, .watchos, .tvos => struct { pub const realpath = @"realpath$DARWIN_EXTSN"; pub const fstatat = @"fstatat$INODE64"; }, @@ -189,7 +189,7 @@ pub usingnamespace switch (builtin.os.tag) { pub const sigprocmask = __sigprocmask14; pub const stat = __stat50; }, - .macosx, .ios, .watchos, .tvos => struct { + .macos, .ios, .watchos, .tvos => struct { // XXX: close -> close$NOCANCEL // XXX: getdirentries -> _getdirentries64 pub extern "c" fn clock_getres(clk_id: c_int, tp: *timespec) c_int; @@ -252,7 +252,7 @@ pub usingnamespace switch (builtin.os.tag) { .linux, .freebsd, .kfreebsd, .netbsd, .openbsd => struct { pub extern "c" fn malloc_usable_size(?*const c_void) usize; }, - .macosx, .ios, .watchos, .tvos => struct { + .macos, .ios, .watchos, .tvos => struct { pub extern "c" fn malloc_size(?*const c_void) usize; }, else => struct {}, diff --git a/lib/std/debug.zig b/lib/std/debug.zig index be57c0b2fd67fbf2e124ed17fafaeb0013284147..8dc29388949e482c7db5e354c6afccadb248e52d 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -654,7 +654,7 @@ pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo { .freebsd, .netbsd, .dragonfly, - .macosx, + .macos, .windows, => return DebugInfo.init(allocator), else => @compileError("openSelfDebugInfo unsupported for this platform"), @@ -1320,7 +1320,7 @@ const SymbolInfo = struct { }; pub const ModuleDebugInfo = switch (builtin.os.tag) { - .macosx, .ios, .watchos, .tvos => struct { + .macos, .ios, .watchos, .tvos => struct { base_address: usize, mapped_memory: []const u8, symbols: []const MachoSymbol, diff --git a/lib/std/dynamic_library.zig b/lib/std/dynamic_library.zig index 238854f07f88e92f51c0996bbb36bc3bc6784e51..07be46a8e1a4ecd2de576de0926ce9e43356a879 100644 --- a/lib/std/dynamic_library.zig +++ b/lib/std/dynamic_library.zig @@ -19,7 +19,7 @@ const max = std.math.max; pub const DynLib = switch (builtin.os.tag) { .linux => if (builtin.link_libc) DlDynlib else ElfDynLib, .windows => WindowsDynLib, - .macosx, .tvos, .watchos, .ios, .freebsd => DlDynlib, + .macos, .tvos, .watchos, .ios, .freebsd => DlDynlib, else => void, }; @@ -404,7 +404,7 @@ test "dynamic_library" { const libname = switch (builtin.os.tag) { .linux, .freebsd => "invalid_so.so", .windows => "invalid_dll.dll", - .macosx, .tvos, .watchos, .ios => "invalid_dylib.dylib", + .macos, .tvos, .watchos, .ios => "invalid_dylib.dylib", else => return error.SkipZigTest, }; diff --git a/lib/std/event/loop.zig b/lib/std/event/loop.zig index a064f711e259d361fd59471a4dbb0ffe51b4bf74..5b1033553553b717c5174e7165108745d06574dc 100644 --- a/lib/std/event/loop.zig +++ b/lib/std/event/loop.zig @@ -66,7 +66,7 @@ pub const Loop = struct { }; pub const EventFd = switch (builtin.os.tag) { - .macosx, .freebsd, .netbsd, .dragonfly => KEventFd, + .macos, .freebsd, .netbsd, .dragonfly => KEventFd, .linux => struct { base: ResumeNode, epoll_op: u32, @@ -85,7 +85,7 @@ pub const Loop = struct { }; pub const Basic = switch (builtin.os.tag) { - .macosx, .freebsd, .netbsd, .dragonfly => KEventBasic, + .macos, .freebsd, .netbsd, .dragonfly => KEventBasic, .linux => struct { base: ResumeNode, }, @@ -259,7 +259,7 @@ pub const Loop = struct { self.extra_threads[extra_thread_index] = try Thread.spawn(self, workerRun); } }, - .macosx, .freebsd, .netbsd, .dragonfly => { + .macos, .freebsd, .netbsd, .dragonfly => { self.os_data.kqfd = try os.kqueue(); errdefer os.close(self.os_data.kqfd); @@ -384,7 +384,7 @@ pub const Loop = struct { while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd); os.close(self.os_data.epollfd); }, - .macosx, .freebsd, .netbsd, .dragonfly => { + .macos, .freebsd, .netbsd, .dragonfly => { os.close(self.os_data.kqfd); }, .windows => { @@ -478,7 +478,7 @@ pub const Loop = struct { .linux => { self.linuxWaitFd(fd, os.EPOLLET | os.EPOLLONESHOT | os.EPOLLIN); }, - .macosx, .freebsd, .netbsd, .dragonfly => { + .macos, .freebsd, .netbsd, .dragonfly => { self.bsdWaitKev(@intCast(usize, fd), os.EVFILT_READ, os.EV_ONESHOT); }, else => @compileError("Unsupported OS"), @@ -490,7 +490,7 @@ pub const Loop = struct { .linux => { self.linuxWaitFd(fd, os.EPOLLET | os.EPOLLONESHOT | os.EPOLLOUT); }, - .macosx, .freebsd, .netbsd, .dragonfly => { + .macos, .freebsd, .netbsd, .dragonfly => { self.bsdWaitKev(@intCast(usize, fd), os.EVFILT_WRITE, os.EV_ONESHOT); }, else => @compileError("Unsupported OS"), @@ -502,7 +502,7 @@ pub const Loop = struct { .linux => { self.linuxWaitFd(fd, os.EPOLLET | os.EPOLLONESHOT | os.EPOLLOUT | os.EPOLLIN); }, - .macosx, .freebsd, .netbsd, .dragonfly => { + .macos, .freebsd, .netbsd, .dragonfly => { self.bsdWaitKev(@intCast(usize, fd), os.EVFILT_READ, os.EV_ONESHOT); self.bsdWaitKev(@intCast(usize, fd), os.EVFILT_WRITE, os.EV_ONESHOT); }, @@ -571,7 +571,7 @@ pub const Loop = struct { const eventfd_node = &resume_stack_node.data; eventfd_node.base.handle = next_tick_node.data; switch (builtin.os.tag) { - .macosx, .freebsd, .netbsd, .dragonfly => { + .macos, .freebsd, .netbsd, .dragonfly => { const kevent_array = @as(*const [1]os.Kevent, &eventfd_node.kevent); const empty_kevs = &[0]os.Kevent{}; _ = os.kevent(self.os_data.kqfd, kevent_array, empty_kevs, null) catch { @@ -633,7 +633,7 @@ pub const Loop = struct { if (!builtin.single_threaded) { switch (builtin.os.tag) { .linux, - .macosx, + .macos, .freebsd, .netbsd, .dragonfly, @@ -725,7 +725,7 @@ pub const Loop = struct { } return; }, - .macosx, .freebsd, .netbsd, .dragonfly => { + .macos, .freebsd, .netbsd, .dragonfly => { const final_kevent = @as(*const [1]os.Kevent, &self.os_data.final_kevent); const empty_kevs = &[0]os.Kevent{}; // cannot fail because we already added it and this just enables it @@ -1218,7 +1218,7 @@ pub const Loop = struct { } } }, - .macosx, .freebsd, .netbsd, .dragonfly => { + .macos, .freebsd, .netbsd, .dragonfly => { var eventlist: [1]os.Kevent = undefined; const empty_kevs = &[0]os.Kevent{}; const count = os.kevent(self.os_data.kqfd, empty_kevs, eventlist[0..], null) catch unreachable; @@ -1344,7 +1344,7 @@ pub const Loop = struct { const OsData = switch (builtin.os.tag) { .linux => LinuxOsData, - .macosx, .freebsd, .netbsd, .dragonfly => KEventData, + .macos, .freebsd, .netbsd, .dragonfly => KEventData, .windows => struct { io_port: windows.HANDLE, extra_thread_count: usize, diff --git a/lib/std/fs.zig b/lib/std/fs.zig index 0f8c6e0d2495d0cf914c44d0708bdc736be8e9a7..6fd188e1f9ac220e42054fb515e65b1790c5b832 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -39,7 +39,7 @@ pub const Watch = @import("fs/watch.zig").Watch; /// fit into a UTF-8 encoded array of this length. /// The byte count includes room for a null sentinel byte. pub const MAX_PATH_BYTES = switch (builtin.os.tag) { - .linux, .macosx, .ios, .freebsd, .netbsd, .dragonfly => os.PATH_MAX, + .linux, .macos, .ios, .freebsd, .netbsd, .dragonfly => os.PATH_MAX, // Each UTF-16LE character may be expanded to 3 UTF-8 bytes. // If it would require 4 UTF-8 bytes, then there would be a surrogate // pair in the UTF-16LE, and we (over)account 3 bytes for it that way. @@ -303,7 +303,7 @@ pub const Dir = struct { const IteratorError = error{AccessDenied} || os.UnexpectedError; pub const Iterator = switch (builtin.os.tag) { - .macosx, .ios, .freebsd, .netbsd, .dragonfly => struct { + .macos, .ios, .freebsd, .netbsd, .dragonfly => struct { dir: Dir, seek: i64, buf: [8192]u8, // TODO align(@alignOf(os.dirent)), @@ -318,7 +318,7 @@ pub const Dir = struct { /// with subsequent calls to `next`, as well as when this `Dir` is deinitialized. pub fn next(self: *Self) Error!?Entry { switch (builtin.os.tag) { - .macosx, .ios => return self.nextDarwin(), + .macos, .ios => return self.nextDarwin(), .freebsd, .netbsd, .dragonfly => return self.nextBsd(), else => @compileError("unimplemented"), } @@ -615,7 +615,7 @@ pub const Dir = struct { pub fn iterate(self: Dir) Iterator { switch (builtin.os.tag) { - .macosx, .ios, .freebsd, .netbsd, .dragonfly => return Iterator{ + .macos, .ios, .freebsd, .netbsd, .dragonfly => return Iterator{ .dir = self, .seek = 0, .index = 0, @@ -1302,7 +1302,7 @@ pub const Dir = struct { error.AccessDenied => |e| switch (builtin.os.tag) { // non-Linux POSIX systems return EPERM when trying to delete a directory, so // we need to handle that case specifically and translate the error - .macosx, .ios, .freebsd, .netbsd, .dragonfly => { + .macos, .ios, .freebsd, .netbsd, .dragonfly => { // Don't follow symlinks to match unlinkat (which acts on symlinks rather than follows them) const fstat = os.fstatatZ(self.fd, sub_path_c, os.AT_SYMLINK_NOFOLLOW) catch return e; const is_dir = fstat.mode & os.S_IFMT == os.S_IFDIR; diff --git a/lib/std/fs/get_app_data_dir.zig b/lib/std/fs/get_app_data_dir.zig index 17d365f68439f8d9bd173855283b5a80c1b912af..6f8dae07c550bd19342492e932cdfb0882359535 100644 --- a/lib/std/fs/get_app_data_dir.zig +++ b/lib/std/fs/get_app_data_dir.zig @@ -42,7 +42,7 @@ pub fn getAppDataDir(allocator: *mem.Allocator, appname: []const u8) GetAppDataD else => return error.AppDataDirUnavailable, } }, - .macosx => { + .macos => { const home_dir = os.getenv("HOME") orelse { // TODO look in /etc/passwd return error.AppDataDirUnavailable; diff --git a/lib/std/fs/test.zig b/lib/std/fs/test.zig index 60cd380444a1fd9e9675b1da7b41429c6cf891e3..860da8ef16fa72ebc822ed61dd398c0c910a80fc 100644 --- a/lib/std/fs/test.zig +++ b/lib/std/fs/test.zig @@ -143,7 +143,7 @@ fn contains(entries: *const std.ArrayList(Dir.Entry), el: Dir.Entry) bool { test "Dir.realpath smoke test" { switch (builtin.os.tag) { - .linux, .windows, .macosx, .ios, .watchos, .tvos => {}, + .linux, .windows, .macos, .ios, .watchos, .tvos => {}, else => return error.SkipZigTest, } diff --git a/lib/std/fs/watch.zig b/lib/std/fs/watch.zig index 269cdec6d8ebc773de5e302a8de35e8177742a34..8b709c2d4b5186bcaba6cbd03b77b37d7499346d 100644 --- a/lib/std/fs/watch.zig +++ b/lib/std/fs/watch.zig @@ -49,7 +49,7 @@ pub fn Watch(comptime V: type) type { const OsData = switch (builtin.os.tag) { // TODO https://github.com/ziglang/zig/issues/3778 - .macosx, .freebsd, .netbsd, .dragonfly => KqOsData, + .macos, .freebsd, .netbsd, .dragonfly => KqOsData, .linux => LinuxOsData, .windows => WindowsOsData, @@ -160,7 +160,7 @@ pub fn Watch(comptime V: type) type { return self; }, - .macosx, .freebsd, .netbsd, .dragonfly => { + .macos, .freebsd, .netbsd, .dragonfly => { self.* = Self{ .allocator = allocator, .channel = channel, @@ -178,7 +178,7 @@ pub fn Watch(comptime V: type) type { /// All addFile calls and removeFile calls must have completed. pub fn deinit(self: *Self) void { switch (builtin.os.tag) { - .macosx, .freebsd, .netbsd, .dragonfly => { + .macos, .freebsd, .netbsd, .dragonfly => { // TODO we need to cancel the frames before destroying the lock self.os_data.table_lock.deinit(); var it = self.os_data.file_table.iterator(); @@ -229,7 +229,7 @@ pub fn Watch(comptime V: type) type { pub fn addFile(self: *Self, file_path: []const u8, value: V) !?V { switch (builtin.os.tag) { - .macosx, .freebsd, .netbsd, .dragonfly => return addFileKEvent(self, file_path, value), + .macos, .freebsd, .netbsd, .dragonfly => return addFileKEvent(self, file_path, value), .linux => return addFileLinux(self, file_path, value), .windows => return addFileWindows(self, file_path, value), else => @compileError("Unsupported OS"), diff --git a/lib/std/os.zig b/lib/std/os.zig index 9f6c012090fb3a5fb39fd41e9ace890a9bce4da9..bc7dae031cd7a445e7fb205902df86f8e4e74a03 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -62,7 +62,7 @@ pub const system = if (@hasDecl(root, "os") and root.os != @This()) else if (builtin.link_libc) std.c else switch (builtin.os.tag) { - .macosx, .ios, .watchos, .tvos => darwin, + .macos, .ios, .watchos, .tvos => darwin, .freebsd => freebsd, .linux => linux, .netbsd => netbsd, @@ -354,7 +354,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize { // Prevents EINVAL. const max_count = switch (std.Target.current.os.tag) { .linux => 0x7ffff000, - .macosx, .ios, .watchos, .tvos => math.maxInt(i32), + .macos, .ios, .watchos, .tvos => math.maxInt(i32), else => math.maxInt(isize), }; const adjusted_len = math.min(max_count, buf.len); @@ -582,7 +582,7 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void { /// On these systems, the read races with concurrent writes to the same file descriptor. pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize { const have_pread_but_not_preadv = switch (std.Target.current.os.tag) { - .windows, .macosx, .ios, .watchos, .tvos => true, + .windows, .macos, .ios, .watchos, .tvos => true, else => false, }; if (have_pread_but_not_preadv) { @@ -709,7 +709,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { const max_count = switch (std.Target.current.os.tag) { .linux => 0x7ffff000, - .macosx, .ios, .watchos, .tvos => math.maxInt(i32), + .macos, .ios, .watchos, .tvos => math.maxInt(i32), else => math.maxInt(isize), }; const adjusted_len = math.min(max_count, bytes.len); @@ -863,7 +863,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { // Prevent EINVAL. const max_count = switch (std.Target.current.os.tag) { .linux => 0x7ffff000, - .macosx, .ios, .watchos, .tvos => math.maxInt(i32), + .macos, .ios, .watchos, .tvos => math.maxInt(i32), else => math.maxInt(isize), }; const adjusted_len = math.min(max_count, bytes.len); @@ -915,7 +915,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { /// If `iov.len` is larger than will fit in a `u31`, a partial write will occur. pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usize { const have_pwrite_but_not_pwritev = switch (std.Target.current.os.tag) { - .windows, .macosx, .ios, .watchos, .tvos => true, + .windows, .macos, .ios, .watchos, .tvos => true, else => false, }; @@ -4091,7 +4091,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 { const end_index = std.unicode.utf16leToUtf8(out_buffer, wide_slice) catch unreachable; return out_buffer[0..end_index]; }, - .macosx, .ios, .watchos, .tvos => { + .macos, .ios, .watchos, .tvos => { // On macOS, we can use F_GETPATH fcntl command to query the OS for // the path to the file descriptor. @memset(out_buffer, 0, MAX_PATH_BYTES); @@ -4688,7 +4688,7 @@ pub fn sendfile( }); const max_count = switch (std.Target.current.os.tag) { .linux => 0x7ffff000, - .macosx, .ios, .watchos, .tvos => math.maxInt(i32), + .macos, .ios, .watchos, .tvos => math.maxInt(i32), else => math.maxInt(size_t), }; @@ -4846,7 +4846,7 @@ pub fn sendfile( } } }, - .macosx, .ios, .tvos, .watchos => sf: { + .macos, .ios, .tvos, .watchos => sf: { var hdtr_data: std.c.sf_hdtr = undefined; var hdtr: ?*std.c.sf_hdtr = null; if (headers.len != 0 or trailers.len != 0) { diff --git a/lib/std/os/bits.zig b/lib/std/os/bits.zig index 177b7daad2c9a0c1f9d3949625bad5e817fc62c5..3647f67f2aa5149ce43e3abaa74177987fb844ac 100644 --- a/lib/std/os/bits.zig +++ b/lib/std/os/bits.zig @@ -12,7 +12,7 @@ const std = @import("std"); const root = @import("root"); pub usingnamespace switch (std.Target.current.os.tag) { - .macosx, .ios, .tvos, .watchos => @import("bits/darwin.zig"), + .macos, .ios, .tvos, .watchos => @import("bits/darwin.zig"), .dragonfly => @import("bits/dragonfly.zig"), .freebsd => @import("bits/freebsd.zig"), .linux => @import("bits/linux.zig"), diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index aee1b9549a21eee4c07a618be2ac9a174b0ccecd..58c2b311b1514afd7b7cedb9e80f3b8ee6a94608 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -360,7 +360,7 @@ fn iter_fn(info: *dl_phdr_info, size: usize, counter: *usize) IterFnError!void { } test "dl_iterate_phdr" { - if (builtin.os.tag == .windows or builtin.os.tag == .wasi or builtin.os.tag == .macosx) + if (builtin.os.tag == .windows or builtin.os.tag == .wasi or builtin.os.tag == .macos) return error.SkipZigTest; var counter: usize = 0; diff --git a/lib/std/packed_int_array.zig b/lib/std/packed_int_array.zig index f25ff0b1b8fdb2d6f17281ebf24637435ac521bf..2f2b671692b1baa6b8ed08daafd106d28089531a 100644 --- a/lib/std/packed_int_array.zig +++ b/lib/std/packed_int_array.zig @@ -618,7 +618,7 @@ test "PackedIntArray at end of available memory" { if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest; switch (builtin.os.tag) { - .linux, .macosx, .ios, .freebsd, .netbsd, .windows => {}, + .linux, .macos, .ios, .freebsd, .netbsd, .windows => {}, else => return, } const PackedArray = PackedIntArray(u3, 8); @@ -639,7 +639,7 @@ test "PackedIntSlice at end of available memory" { if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest; switch (builtin.os.tag) { - .linux, .macosx, .ios, .freebsd, .netbsd, .windows => {}, + .linux, .macos, .ios, .freebsd, .netbsd, .windows => {}, else => return, } const PackedSlice = PackedIntSlice(u11); diff --git a/lib/std/process.zig b/lib/std/process.zig index 2813d8cbab2d985d954b85da48baaec1a4d201c5..3a499f3e246808da256a8441c3497543b41039ef 100644 --- a/lib/std/process.zig +++ b/lib/std/process.zig @@ -585,7 +585,7 @@ pub const UserInfo = struct { /// POSIX function which gets a uid from username. pub fn getUserInfo(name: []const u8) !UserInfo { return switch (builtin.os.tag) { - .linux, .macosx, .watchos, .tvos, .ios, .freebsd, .netbsd => posixGetUserInfo(name), + .linux, .macos, .watchos, .tvos, .ios, .freebsd, .netbsd => posixGetUserInfo(name), else => @compileError("Unsupported OS"), }; } @@ -688,7 +688,7 @@ pub fn getBaseAddress() usize { const phdr = os.system.getauxval(std.elf.AT_PHDR); return phdr - @sizeOf(std.elf.Ehdr); }, - .macosx, .freebsd, .netbsd => { + .macos, .freebsd, .netbsd => { return @ptrToInt(&std.c._mh_execute_header); }, .windows => return @ptrToInt(os.windows.kernel32.GetModuleHandleW(null)), @@ -733,7 +733,7 @@ pub fn getSelfExeSharedLibPaths(allocator: *Allocator) error{OutOfMemory}![][:0] }.callback); return paths.toOwnedSlice(); }, - .macosx, .ios, .watchos, .tvos => { + .macos, .ios, .watchos, .tvos => { var paths = List.init(allocator); errdefer { const slice = paths.toOwnedSlice(); diff --git a/lib/std/special/compiler_rt/clear_cache.zig b/lib/std/special/compiler_rt/clear_cache.zig index d862f739d3a332b334fa031d47b0bf01a150b587..4b00721868037836a57859879944978e1ae33b81 100644 --- a/lib/std/special/compiler_rt/clear_cache.zig +++ b/lib/std/special/compiler_rt/clear_cache.zig @@ -44,7 +44,7 @@ pub fn clear_cache(start: usize, end: usize) callconv(.C) void { else => false, }; const apple = switch (os) { - .ios, .macosx, .watchos, .tvos => true, + .ios, .macos, .watchos, .tvos => true, else => false, }; if (x86) { diff --git a/lib/std/target.zig b/lib/std/target.zig index 99617c6d0eba57bcacae1c951cbb526c0767fe17..4b9a6b44585c72132d12eaa7e9f41f529065974b 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -31,7 +31,7 @@ pub const Target = struct { kfreebsd, linux, lv2, - macosx, + macos, netbsd, openbsd, solaris, @@ -61,7 +61,7 @@ pub const Target = struct { pub fn isDarwin(tag: Tag) bool { return switch (tag) { - .ios, .macosx, .watchos, .tvos => true, + .ios, .macos, .watchos, .tvos => true, else => false, }; } @@ -234,7 +234,7 @@ pub const Target = struct { .max = .{ .major = 12, .minor = 1 }, }, }, - .macosx => return .{ + .macos => return .{ .semver = .{ .min = .{ .major = 10, .minor = 13 }, .max = .{ .major = 10, .minor = 15, .patch = 3 }, @@ -312,7 +312,7 @@ pub const Target = struct { .windows => return TaggedVersionRange{ .windows = self.version_range.windows }, .freebsd, - .macosx, + .macos, .ios, .tvos, .watchos, @@ -341,7 +341,7 @@ pub const Target = struct { return switch (os.tag) { .freebsd, .netbsd, - .macosx, + .macos, .ios, .tvos, .watchos, @@ -450,7 +450,7 @@ pub const Target = struct { .other, => return .eabi, .openbsd, - .macosx, + .macos, .freebsd, .ios, .tvos, @@ -1277,7 +1277,7 @@ pub const Target = struct { .ios, .tvos, .watchos, - .macosx, + .macos, .uefi, .windows, .emscripten, @@ -1450,7 +1450,7 @@ pub const Target = struct { .ios, .tvos, .watchos, - .macosx, + .macos, .uefi, .windows, .emscripten, diff --git a/lib/std/time.zig b/lib/std/time.zig index ae128f6b0c7d7ac1676c7f6d6868ae8d124a8267..344f192784bf31340e21eefa601019f08d377ae5 100644 --- a/lib/std/time.zig +++ b/lib/std/time.zig @@ -143,7 +143,7 @@ pub const Timer = struct { /// be less precise frequency: switch (builtin.os.tag) { .windows => u64, - .macosx, .ios, .tvos, .watchos => os.darwin.mach_timebase_info_data, + .macos, .ios, .tvos, .watchos => os.darwin.mach_timebase_info_data, else => void, }, resolution: u64, diff --git a/lib/std/zig/cross_target.zig b/lib/std/zig/cross_target.zig index f1ae3457a564b9886b9b15cffa3925b893168fd3..3d39c8338b72217c6e65adc2af3f5e304ce1784b 100644 --- a/lib/std/zig/cross_target.zig +++ b/lib/std/zig/cross_target.zig @@ -137,7 +137,7 @@ pub const CrossTarget = struct { }, .freebsd, - .macosx, + .macos, .ios, .tvos, .watchos, @@ -578,7 +578,7 @@ pub const CrossTarget = struct { const os = switch (self.getOsTag()) { .windows => "windows", .linux => "linux", - .macosx => "macos", + .macos => "macos", else => return error.UnsupportedVcpkgOperatingSystem, }; @@ -718,7 +718,7 @@ pub const CrossTarget = struct { => return error.InvalidOperatingSystemVersion, .freebsd, - .macosx, + .macos, .ios, .tvos, .watchos, diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index b1947058cc75f9118551557ce1113301b1304fe5..33ef137eb6c31b4aeab8c4a434c0c75a7309bb7a 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -267,7 +267,7 @@ pub const NativeTargetInfo = struct { os.version_range.windows.max = @intToEnum(Target.Os.WindowsVersion, version); os.version_range.windows.min = @intToEnum(Target.Os.WindowsVersion, version); }, - .macosx => { + .macos => { var scbuf: [32]u8 = undefined; var size: usize = undefined; diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 01fa0baf0293f829fefb6774cf9fc4e0dafefe5c..f87a7a940c9409187682e8f685267b4ac7d46352 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -69,7 +69,7 @@ pub fn targetTriple(allocator: *Allocator, target: std.Target) ![]u8 { .kfreebsd => "kfreebsd", .linux => "linux", .lv2 => "lv2", - .macosx => "macosx", + .macos => "macosx", .netbsd => "netbsd", .openbsd => "openbsd", .solaris => "solaris", diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 9700a0bdb4946f0b3a87e6b08cfd2873d6206399..0d3de89d580fb5691a29a2ee1c1bd1b6053fa8a1 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -525,7 +525,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { try argv.append(darwinArchString(target.cpu.arch)); switch (target.os.tag) { - .macosx => { + .macos => { try argv.append("-macosx_version_min"); }, .ios, .tvos, .watchos => switch (target.cpu.arch) { diff --git a/src/target.zig b/src/target.zig index d009cf85561710fc4a62180daa68f70cb4127610..ce3a200d2b9cdd7b233c69c92b29208e84ada64d 100644 --- a/src/target.zig +++ b/src/target.zig @@ -123,14 +123,14 @@ pub fn cannotDynamicLink(target: std.Target) bool { /// since this is the stable syscall interface. pub fn osRequiresLibC(target: std.Target) bool { return switch (target.os.tag) { - .freebsd, .netbsd, .dragonfly, .macosx, .ios, .watchos, .tvos => true, + .freebsd, .netbsd, .dragonfly, .macos, .ios, .watchos, .tvos => true, else => false, }; } pub fn libcNeedsLibUnwind(target: std.Target) bool { return switch (target.os.tag) { - .macosx, + .macos, .ios, .watchos, .tvos, @@ -197,7 +197,7 @@ pub fn osToLLVM(os_tag: std.Target.Os.Tag) llvm.OSType { .kfreebsd => .KFreeBSD, .linux => .Linux, .lv2 => .Lv2, - .macosx => .MacOSX, + .macos => .MacOSX, .netbsd => .NetBSD, .openbsd => .OpenBSD, .solaris => .Solaris, diff --git a/src/type.zig b/src/type.zig index c22edaa56134f64b2109572e9c7ac68de676d208..f07df290fc6a2ee0a2097df3bd60a3d0f58ebffa 100644 --- a/src/type.zig +++ b/src/type.zig @@ -3104,7 +3104,7 @@ pub const CType = enum { }, .linux, - .macosx, + .macos, .freebsd, .netbsd, .dragonfly, diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp index 78082d16baa79d2458d98a7826b0c3c358449e78..decd11e0ab074684cf4b06437153ab32eb204cc7 100644 --- a/src/zig_llvm.cpp +++ b/src/zig_llvm.cpp @@ -817,7 +817,9 @@ const char *ZigLLVMGetVendorTypeName(ZigLLVM_VendorType vendor) { } const char *ZigLLVMGetOSTypeName(ZigLLVM_OSType os) { - return (const char*)Triple::getOSTypeName((Triple::OSType)os).bytes_begin(); + const char* name = (const char*)Triple::getOSTypeName((Triple::OSType)os).bytes_begin(); + if (strcmp(name, "macosx") == 0) return "macos"; + return name; } const char *ZigLLVMGetEnvironmentTypeName(ZigLLVM_EnvironmentType env_type) { diff --git a/test/stack_traces.zig b/test/stack_traces.zig index 496be0513820289723129bd97f1e8fff97b999fb..640cc0904c426f90d212a140f7d4d075def2322e 100644 --- a/test/stack_traces.zig +++ b/test/stack_traces.zig @@ -308,7 +308,7 @@ pub fn addCases(cases: *tests.StackTracesContext) void { }, ); }, - .macosx => { + .macos => { cases.addCase( "return", source_return, diff --git a/test/stage2/test.zig b/test/stage2/test.zig index 2e3b570570dc85af3e0c1d25f9f609d0d2a35589..5f5fe76d17bcfc736a1abc8e44f25b49dfc9fb51 100644 --- a/test/stage2/test.zig +++ b/test/stage2/test.zig @@ -13,7 +13,7 @@ const linux_x64 = std.zig.CrossTarget{ const macosx_x64 = std.zig.CrossTarget{ .cpu_arch = .x86_64, - .os_tag = .macosx, + .os_tag = .macos, }; const linux_riscv64 = std.zig.CrossTarget{ diff --git a/test/tests.zig b/test/tests.zig index 58b2b500943a44b2f9d6cdc53fa7bd22b6acf680..09001b02a126410f624d5846f6edd3a68a3fc05f 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -234,7 +234,7 @@ const test_targets = blk: { TestTarget{ .target = .{ .cpu_arch = .x86_64, - .os_tag = .macosx, + .os_tag = .macos, .abi = .gnu, }, // https://github.com/ziglang/zig/issues/3295 -- 2.54.0