Skip to content

Commit d3e4ca8

Browse files
committed
Make ifaddrs.ifa_ifu an union
1 parent 2c27f58 commit d3e4ca8

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

libc-test/build.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2836,6 +2836,9 @@ fn test_emscripten(target: &str) {
28362836
});
28372837

28382838
cfg.skip_struct(move |ty| {
2839+
if ty.starts_with("__c_anonymous_") {
2840+
return true;
2841+
}
28392842
match ty {
28402843
// FIXME: It was removed in
28412844
// emscripten-core/emscripten@953e414

src/fuchsia/mod.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ s! {
465465
pub ifa_flags: ::c_uint,
466466
pub ifa_addr: *mut ::sockaddr,
467467
pub ifa_netmask: *mut ::sockaddr,
468-
pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
468+
pub ifa_ifu: __c_anonymous_ifa_ifu,
469469
pub ifa_data: *mut ::c_void,
470470
}
471471

@@ -1046,6 +1046,11 @@ s_no_extra_traits! {
10461046
pub sival_int: ::int,
10471047
pub sival_ptr: *mut ::c_void,
10481048
}
1049+
1050+
pub union __c_anonymous_ifa_ifu {
1051+
ifu_broadaddr: *mut sockaddr,
1052+
ifu_dstaddr: *mut sockaddr,
1053+
}
10491054
}
10501055

10511056
cfg_if! {
@@ -1357,6 +1362,12 @@ cfg_if! {
13571362
f.debug_struct("sigval").finish_non_exhaustive()
13581363
}
13591364
}
1365+
1366+
impl ::fmt::Debug for __c_anonymous_ifa_ifu {
1367+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1368+
f.debug_struct("ifa_ifu").finish_non_exhaustive()
1369+
}
1370+
}
13601371
}
13611372
}
13621373

src/unix/linux_like/mod.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ s! {
159159
pub ifa_flags: ::c_uint,
160160
pub ifa_addr: *mut ::sockaddr,
161161
pub ifa_netmask: *mut ::sockaddr,
162-
pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
162+
pub ifa_ifu: __c_anonymous_ifa_ifu,
163163
pub ifa_data: *mut ::c_void,
164164
}
165165

@@ -257,6 +257,11 @@ s_no_extra_traits! {
257257
#[cfg(target_pointer_width = "32")]
258258
__unused1: [::c_int; 12],
259259
}
260+
261+
pub union __c_anonymous_ifa_ifu {
262+
ifu_broadaddr: *mut sockaddr,
263+
ifu_dstaddr: *mut sockaddr,
264+
}
260265
}
261266

262267
cfg_if! {
@@ -412,6 +417,12 @@ cfg_if! {
412417
.finish()
413418
}
414419
}
420+
421+
impl ::fmt::Debug for __c_anonymous_ifa_ifu {
422+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
423+
f.debug_struct("ifa_ifu").finish_non_exhaustive()
424+
}
425+
}
415426
}
416427
}
417428

0 commit comments

Comments
 (0)