Skip to content

Commit

Permalink
Apply formatting to macro bodies
Browse files Browse the repository at this point in the history
Run `ci/style.sh` with the changes introduced in [1].

[1]: rust-lang#4107

(backport <rust-lang#4107>)

This is the `libc-0.2` version of 49cb0ff ("Apply formatting to macro
bodies"), though not a direct cherry pick.
  • Loading branch information
tgross35 committed Nov 19, 2024
1 parent d8ccae5 commit 50f26e0
Show file tree
Hide file tree
Showing 105 changed files with 2,965 additions and 2,801 deletions.
235 changes: 108 additions & 127 deletions src/fuchsia/mod.rs

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/fuchsia/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ s! {
pub mode: ::mode_t,
pub __seq: ::c_int,
__unused1: ::c_long,
__unused2: ::c_long
__unused2: ::c_long,
}
}

Expand All @@ -85,10 +85,10 @@ cfg_if! {
&& self.uc_mcontext == other.uc_mcontext
&& self.uc_sigmask == other.uc_sigmask
&& self
.__private
.iter()
.zip(other.__private.iter())
.all(|(a,b)| a == b)
.__private
.iter()
.zip(other.__private.iter())
.all(|(a, b)| a == b)
}
}
impl Eq for ucontext_t {}
Expand Down
2 changes: 1 addition & 1 deletion src/psp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ s! {
pub struct sockaddr {
pub sa_len: u8,
pub sa_family: u8,
pub sa_data: [u8;14],
pub sa_data: [u8; 14],
}

pub struct in_addr {
Expand Down
35 changes: 18 additions & 17 deletions src/unix/aix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ s! {
pub d_ino: ::ino_t,
pub d_reclen: ::c_ushort,
pub d_namlen: ::c_ushort,
pub d_name: [::c_char; 256]
pub d_name: [::c_char; 256],
}

pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_cc: [::cc_t; ::NCCS]
pub c_cc: [::cc_t; ::NCCS],
}

pub struct flock64 {
Expand Down Expand Up @@ -139,7 +139,7 @@ s! {
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
pub f_fstr: [::c_char; 32],
pub f_filler: [::c_ulong; 16]
pub f_filler: [::c_ulong; 16],
}

pub struct lconv {
Expand Down Expand Up @@ -180,7 +180,7 @@ s! {
pub tm_year: ::c_int,
pub tm_wday: ::c_int,
pub tm_yday: ::c_int,
pub tm_isdst: ::c_int
pub tm_isdst: ::c_int,
}

pub struct addrinfo {
Expand All @@ -196,7 +196,7 @@ s! {
}

pub struct in_addr {
pub s_addr: in_addr_t
pub s_addr: in_addr_t,
}

pub struct ip_mreq_source {
Expand Down Expand Up @@ -227,7 +227,7 @@ s! {
pub sin_family: sa_family_t,
pub sin_port: in_port_t,
pub sin_addr: in_addr,
pub sin_zero: [::c_char; 8]
pub sin_zero: [::c_char; 8],
}

pub struct sockaddr_in6 {
Expand All @@ -236,7 +236,7 @@ s! {
pub sin6_port: ::uint16_t,
pub sin6_flowinfo: ::uint32_t,
pub sin6_addr: ::in6_addr,
pub sin6_scope_id: ::uint32_t
pub sin6_scope_id: ::uint32_t,
}

pub struct sockaddr_storage {
Expand All @@ -250,7 +250,7 @@ s! {
pub struct sockaddr_un {
pub sun_len: ::c_uchar,
pub sun_family: sa_family_t,
pub sun_path: [::c_char; 1023]
pub sun_path: [::c_char; 1023],
}

pub struct st_timespec {
Expand Down Expand Up @@ -286,7 +286,7 @@ s! {
pub pw_gid: ::gid_t,
pub pw_gecos: *mut ::c_char,
pub pw_dir: *mut ::c_char,
pub pw_shell: *mut ::c_char
pub pw_shell: *mut ::c_char,
}

pub struct utsname {
Expand All @@ -313,7 +313,7 @@ s! {
pub sigev_value: ::sigval,
pub sigev_signo: ::c_int,
pub sigev_notify: ::c_int,
pub sigev_notify_function: extern fn(val: ::sigval),
pub sigev_notify_function: extern "C" fn(val: ::sigval),
pub sigev_notify_attributes: *mut pthread_attr_t,
}

Expand Down Expand Up @@ -536,8 +536,8 @@ s! {

s_no_extra_traits! {
pub union __sigaction_sa_union {
pub __su_handler: extern fn(c: ::c_int),
pub __su_sigaction: extern fn(c: ::c_int, info: *mut siginfo_t, ptr: *mut ::c_void),
pub __su_handler: extern "C" fn(c: ::c_int),
pub __su_sigaction: extern "C" fn(c: ::c_int, info: *mut siginfo_t, ptr: *mut ::c_void),
}

pub struct sigaction {
Expand Down Expand Up @@ -2514,8 +2514,9 @@ f! {
if cmsg.is_null() {
CMSG_FIRSTHDR(mhdr)
} else {
if (cmsg as usize + (*cmsg).cmsg_len as usize + ::mem::size_of::<::cmsghdr>()) >
((*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize) {
if (cmsg as usize + (*cmsg).cmsg_len as usize + ::mem::size_of::<::cmsghdr>())
> ((*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize)
{
0 as *mut ::cmsghdr
} else {
// AIX does not have any alignment/padding for ancillary data, so we don't need _CMSG_ALIGN here.
Expand Down Expand Up @@ -2546,20 +2547,20 @@ f! {
let bits = ::mem::size_of::<::c_long>() * 8;
let fd = fd as usize;
(*set).fds_bits[fd / bits] |= 1 << (fd % bits);
return
return;
}

pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let bits = ::mem::size_of::<::c_long>() * 8;
let fd = fd as usize;
(*set).fds_bits[fd / bits] &= !(1 << (fd % bits));
return
return;
}

pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
let bits = ::mem::size_of::<::c_long>() * 8;
let fd = fd as usize;
return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0
return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0;
}

pub fn major(dev: ::dev_t) -> ::c_uint {
Expand Down
37 changes: 24 additions & 13 deletions src/unix/aix/powerpc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ s! {
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
pub f_fstr: [::c_char; 32],
pub f_filler: [::c_ulong; 16]
pub f_filler: [::c_ulong; 16],
}

pub struct pthread_rwlock_t {
Expand Down Expand Up @@ -206,14 +206,28 @@ s_no_extra_traits! {
}

pub struct fileops_t {
pub fo_rw: extern fn(file: *mut file, rw: ::uio_rw, io: *mut ::c_void, ext: ::c_long,
secattr: *mut ::c_void) -> ::c_int,
pub fo_ioctl: extern fn(file: *mut file, a: ::c_long, b: ::caddr_t, c: ::c_long,
d: ::c_long) -> ::c_int,
pub fo_select: extern fn(file: *mut file, a: ::c_int, b: *mut ::c_ushort,
c: extern fn()) -> ::c_int,
pub fo_close: extern fn(file: *mut file) -> ::c_int,
pub fo_fstat: extern fn(file: *mut file, sstat: *mut ::stat) -> ::c_int,
pub fo_rw: extern "C" fn(
file: *mut file,
rw: ::uio_rw,
io: *mut ::c_void,
ext: ::c_long,
secattr: *mut ::c_void,
) -> ::c_int,
pub fo_ioctl: extern "C" fn(
file: *mut file,
a: ::c_long,
b: ::caddr_t,
c: ::c_long,
d: ::c_long,
) -> ::c_int,
pub fo_select: extern "C" fn(
file: *mut file,
a: ::c_int,
b: *mut ::c_ushort,
c: extern "C" fn(),
) -> ::c_int,
pub fo_close: extern "C" fn(file: *mut file) -> ::c_int,
pub fo_fstat: extern "C" fn(file: *mut file, sstat: *mut ::stat) -> ::c_int,
}

pub struct file {
Expand Down Expand Up @@ -339,10 +353,7 @@ cfg_if! {

impl PartialEq for _kernel_simple_lock {
fn eq(&self, other: &_kernel_simple_lock) -> bool {
unsafe {
self._slock == other._slock
&& self._slockp == other._slockp
}
unsafe { self._slock == other._slock && self._slockp == other._slockp }
}
}
impl Eq for _kernel_simple_lock {}
Expand Down
24 changes: 13 additions & 11 deletions src/unix/bsd/apple/b32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ s! {
s_no_extra_traits! {
pub struct pthread_attr_t {
__sig: c_long,
__opaque: [::c_char; 36]
__opaque: [::c_char; 36],
}

pub struct pthread_once_t {
Expand All @@ -63,7 +63,7 @@ s_no_extra_traits! {
#[allow(missing_debug_implementations)]
#[repr(align(16))]
pub struct max_align_t {
priv_: [f64; 2]
priv_: [f64; 2],
}
}

Expand All @@ -72,18 +72,19 @@ cfg_if! {
impl PartialEq for pthread_attr_t {
fn eq(&self, other: &pthread_attr_t) -> bool {
self.__sig == other.__sig
&& self.__opaque
.iter()
.zip(other.__opaque.iter())
.all(|(a,b)| a == b)
&& self
.__opaque
.iter()
.zip(other.__opaque.iter())
.all(|(a, b)| a == b)
}
}
impl Eq for pthread_attr_t {}
impl ::fmt::Debug for pthread_attr_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_attr_t")
.field("__sig", &self.__sig)
// FIXME: .field("__opaque", &self.__opaque)
// FIXME: .field("__opaque", &self.__opaque)
.finish()
}
}
Expand All @@ -96,10 +97,11 @@ cfg_if! {
impl PartialEq for pthread_once_t {
fn eq(&self, other: &pthread_once_t) -> bool {
self.__sig == other.__sig
&& self.__opaque
.iter()
.zip(other.__opaque.iter())
.all(|(a,b)| a == b)
&& self
.__opaque
.iter()
.zip(other.__opaque.iter())
.all(|(a, b)| a == b)
}
}
impl Eq for pthread_once_t {}
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/apple/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ s! {
s_no_extra_traits! {
#[allow(missing_debug_implementations)]
pub struct max_align_t {
priv_: f64
priv_: f64,
}
}
22 changes: 12 additions & 10 deletions src/unix/bsd/apple/b64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ s! {
s_no_extra_traits! {
pub struct pthread_attr_t {
__sig: c_long,
__opaque: [::c_char; 56]
__opaque: [::c_char; 56],
}

pub struct pthread_once_t {
Expand All @@ -66,18 +66,19 @@ cfg_if! {
impl PartialEq for pthread_attr_t {
fn eq(&self, other: &pthread_attr_t) -> bool {
self.__sig == other.__sig
&& self.__opaque
.iter()
.zip(other.__opaque.iter())
.all(|(a,b)| a == b)
&& self
.__opaque
.iter()
.zip(other.__opaque.iter())
.all(|(a, b)| a == b)
}
}
impl Eq for pthread_attr_t {}
impl ::fmt::Debug for pthread_attr_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_attr_t")
.field("__sig", &self.__sig)
// FIXME: .field("__opaque", &self.__opaque)
// FIXME: .field("__opaque", &self.__opaque)
.finish()
}
}
Expand All @@ -90,10 +91,11 @@ cfg_if! {
impl PartialEq for pthread_once_t {
fn eq(&self, other: &pthread_once_t) -> bool {
self.__sig == other.__sig
&& self.__opaque
.iter()
.zip(other.__opaque.iter())
.all(|(a,b)| a == b)
&& self
.__opaque
.iter()
.zip(other.__opaque.iter())
.all(|(a, b)| a == b)
}
}
impl Eq for pthread_once_t {}
Expand Down
Loading

0 comments on commit 50f26e0

Please sign in to comment.