Skip to content

Commit 428814a

Browse files
committed
Make fpreg_t an union
1 parent 92a1442 commit 428814a

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

libc-test/build.rs

-2
Original file line numberDiff line numberDiff line change
@@ -4340,8 +4340,6 @@ fn test_linux(target: &str) {
43404340
cfg.skip_roundtrip(move |s| match s {
43414341
// FIXME:
43424342
"mcontext_t" if s390x => true,
4343-
// FIXME: This is actually a union.
4344-
"fpreg_t" if s390x => true,
43454343

43464344
// The test doesn't work on some env:
43474345
"ipv6_mreq"

src/unix/linux_like/linux/gnu/b64/s390x.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,17 @@ s! {
212212
}
213213

214214
s_no_extra_traits! {
215-
// FIXME: This is actually a union.
216-
pub struct fpreg_t {
215+
pub union fpreg_t {
217216
pub d: ::c_double,
218-
// f: ::c_float,
217+
pub f: ::c_float,
219218
}
220219
}
221220

222221
cfg_if! {
223222
if #[cfg(feature = "extra_traits")] {
224223
impl PartialEq for fpreg_t {
225224
fn eq(&self, other: &fpreg_t) -> bool {
226-
self.d == other.d
225+
unsafe { self.d == other.d }
227226
}
228227
}
229228

@@ -232,7 +231,7 @@ cfg_if! {
232231
impl ::fmt::Debug for fpreg_t {
233232
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
234233
f.debug_struct("fpreg_t")
235-
.field("d", &self.d)
234+
.field("d", unsafe { &self.d })
236235
.finish()
237236
}
238237
}

0 commit comments

Comments
 (0)