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 Aug 29, 2024
1 parent 15d0d58 commit 1c27eac
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 @@ -4357,8 +4357,6 @@ fn test_linux(target: &str) {
cfg.skip_roundtrip(move |s| match s {
// FIXME:
"mcontext_t" if s390x => true,
// FIXME: This is actually a union.
"fpreg_t" if s390x => true,

// The test doesn't work on some env:
"ipv6_mreq"
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 @@ -212,18 +212,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 @@ -232,7 +231,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 1c27eac

Please sign in to comment.