Skip to content

Commit

Permalink
Require rust >= 1.33 and drop libc_cfg_target_vendor conditional
Browse files Browse the repository at this point in the history
[ resolve conflicts - Trevor ]
  • Loading branch information
joshtriplett authored and tgross35 committed Nov 16, 2024
1 parent 9dac79f commit 3d97cdf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 62 deletions.
6 changes: 0 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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");
Expand Down
48 changes: 8 additions & 40 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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;
Expand Down
20 changes: 4 additions & 16 deletions src/unix/newlib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 3d97cdf

Please sign in to comment.