From 9ac189b9a02b93dcbe9df15cef1ea68c135fc267 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Mon, 11 Jul 2022 20:51:02 -0700 Subject: [PATCH] Require rust >= 1.33 and drop libc_cfg_target_vendor conditional [ resolve conflicts - Trevor ] --- build.rs | 6 ------ src/unix/mod.rs | 48 +++++++----------------------------------- src/unix/newlib/mod.rs | 20 ++++-------------- 3 files changed, 12 insertions(+), 62 deletions(-) diff --git a/build.rs b/build.rs index 0ee39951c0723..5b709da55e1eb 100644 --- a/build.rs +++ b/build.rs @@ -14,7 +14,6 @@ const ALLOWED_CFGS: &'static [&'static str] = &[ "freebsd13", "freebsd14", "freebsd15", - "libc_cfg_target_vendor", "libc_const_extern_fn", "libc_const_extern_fn_unstable", "libc_deny_warnings", @@ -84,11 +83,6 @@ fn main() { set_cfg("libc_deny_warnings"); } - // Rust >= 1.33 supports cfg(target_vendor). - if rustc_minor_ver >= 33 || rustc_dep_of_std { - set_cfg("libc_cfg_target_vendor"); - } - // Rust >= 1.40 supports #[non_exhaustive]. if rustc_minor_ver >= 40 || rustc_dep_of_std { set_cfg("libc_non_exhaustive"); diff --git a/src/unix/mod.rs b/src/unix/mod.rs index af5925197d2ab..b3cc7424cd0d4 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -642,21 +642,13 @@ extern "C" { pub fn getchar_unlocked() -> ::c_int; pub fn putchar_unlocked(c: ::c_int) -> ::c_int; - #[cfg(not(all( - libc_cfg_target_vendor, - target_arch = "powerpc", - target_vendor = "nintendo" - )))] + #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] #[cfg_attr(target_os = "netbsd", link_name = "__socket30")] #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")] #[cfg_attr(target_os = "solaris", link_name = "__xnet7_socket")] #[cfg_attr(target_os = "espidf", link_name = "lwip_socket")] pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; - #[cfg(not(all( - libc_cfg_target_vendor, - target_arch = "powerpc", - target_vendor = "nintendo" - )))] + #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] #[cfg_attr( all(target_os = "macos", target_arch = "x86"), link_name = "connect$UNIX2003" @@ -673,22 +665,14 @@ extern "C" { )] #[cfg_attr(target_os = "espidf", link_name = "lwip_listen")] pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; - #[cfg(not(all( - libc_cfg_target_vendor, - target_arch = "powerpc", - target_vendor = "nintendo" - )))] + #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] #[cfg_attr( all(target_os = "macos", target_arch = "x86"), link_name = "accept$UNIX2003" )] #[cfg_attr(target_os = "espidf", link_name = "lwip_accept")] pub fn accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int; - #[cfg(not(all( - libc_cfg_target_vendor, - target_arch = "powerpc", - target_vendor = "nintendo" - )))] + #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] #[cfg_attr( all(target_os = "macos", target_arch = "x86"), link_name = "getpeername$UNIX2003" @@ -699,11 +683,7 @@ extern "C" { address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int; - #[cfg(not(all( - libc_cfg_target_vendor, - target_arch = "powerpc", - target_vendor = "nintendo" - )))] + #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] #[cfg_attr( all(target_os = "macos", target_arch = "x86"), link_name = "getsockname$UNIX2003" @@ -736,11 +716,7 @@ extern "C" { protocol: ::c_int, socket_vector: *mut ::c_int, ) -> ::c_int; - #[cfg(not(all( - libc_cfg_target_vendor, - target_arch = "powerpc", - target_vendor = "nintendo" - )))] + #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] #[cfg_attr( all(target_os = "macos", target_arch = "x86"), link_name = "sendto$UNIX2003" @@ -1250,11 +1226,7 @@ extern "C" { pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void; pub fn dlclose(handle: *mut ::c_void) -> ::c_int; - #[cfg(not(all( - libc_cfg_target_vendor, - target_arch = "powerpc", - target_vendor = "nintendo" - )))] + #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] #[cfg_attr( any(target_os = "illumos", target_os = "solaris"), link_name = "__xnet_getaddrinfo" @@ -1266,11 +1238,7 @@ extern "C" { hints: *const addrinfo, res: *mut *mut addrinfo, ) -> ::c_int; - #[cfg(not(all( - libc_cfg_target_vendor, - target_arch = "powerpc", - target_vendor = "nintendo" - )))] + #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] #[cfg_attr(target_os = "espidf", link_name = "lwip_freeaddrinfo")] pub fn freeaddrinfo(res: *mut addrinfo); pub fn hstrerror(errcode: ::c_int) -> *const ::c_char; diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index e68da50aa3c0a..45d1b1a028fad 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -91,7 +91,7 @@ s! { #[cfg(not(any( target_os = "espidf", - all(libc_cfg_target_vendor, target_arch = "powerpc", target_vendor = "nintendo"))))] + all(target_arch = "powerpc", target_vendor = "nintendo"))))] pub ai_addr: *mut sockaddr, pub ai_next: *mut addrinfo, @@ -843,11 +843,7 @@ extern "C" { pub fn rand() -> ::c_int; pub fn srand(seed: ::c_uint); - #[cfg(not(all( - libc_cfg_target_vendor, - target_arch = "powerpc", - target_vendor = "nintendo" - )))] + #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] #[cfg_attr(target_os = "espidf", link_name = "lwip_bind")] pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int; pub fn clock_settime(clock_id: ::clockid_t, tp: *const ::timespec) -> ::c_int; @@ -856,11 +852,7 @@ extern "C" { #[cfg_attr(target_os = "espidf", link_name = "lwip_close")] pub fn closesocket(sockfd: ::c_int) -> ::c_int; pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; - #[cfg(not(all( - libc_cfg_target_vendor, - target_arch = "powerpc", - target_vendor = "nintendo" - )))] + #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] #[cfg_attr(target_os = "espidf", link_name = "lwip_recvfrom")] pub fn recvfrom( fd: ::c_int, @@ -870,11 +862,7 @@ extern "C" { addr: *mut sockaddr, addr_len: *mut socklen_t, ) -> isize; - #[cfg(not(all( - libc_cfg_target_vendor, - target_arch = "powerpc", - target_vendor = "nintendo" - )))] + #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] pub fn getnameinfo( sa: *const sockaddr, salen: socklen_t,