Skip to content

Commit

Permalink
Make fpreg_t an union
Browse files Browse the repository at this point in the history
  • Loading branch information
kellda committed Feb 4, 2021
1 parent 2c417b3 commit 9129c8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 0 additions & 2 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2680,8 +2680,6 @@ fn test_linux(target: &str) {
"utsname" if mips32 || mips64 => true,
// FIXME:
"mcontext_t" if s390x => true,
// FIXME: This is actually a union.
"fpreg_t" if s390x => true,

"sockaddr_un" | "sembuf" | "ff_constant_effect"
if mips32 && (gnu || musl) =>
Expand Down
9 changes: 4 additions & 5 deletions src/unix/linux_like/linux/gnu/b64/s390x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,17 @@ s! {
}

s_no_extra_traits! {
// FIXME: This is actually a union.
pub struct fpreg_t {
pub union fpreg_t {
pub d: ::c_double,
// f: ::c_float,
pub f: ::c_float,
}
}

cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for fpreg_t {
fn eq(&self, other: &fpreg_t) -> bool {
self.d == other.d
unsafe { self.d == other.d }
}
}

Expand All @@ -242,7 +241,7 @@ cfg_if! {
impl ::fmt::Debug for fpreg_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("fpreg_t")
.field("d", &self.d)
.field("d", unsafe { &self.d })
.finish()
}
}
Expand Down

0 comments on commit 9129c8e

Please sign in to comment.