Skip to content

Commit 61b5df8

Browse files
committed
fixup: some tests started to fail - fix some, document some
1 parent bbc31fa commit 61b5df8

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

libc-test/build.rs

+22-10
Original file line numberDiff line numberDiff line change
@@ -1538,12 +1538,16 @@ fn test_freebsd(target: &str) {
15381538
// Just pass all these through, no need for a "struct" prefix
15391539
"FILE" | "fd_set" | "Dl_info" | "DIR" => ty.to_string(),
15401540

1541+
// FIXME: ?
15411542
"sighandler_t" => "sig_t".to_string(),
15421543

15431544
t if is_union => format!("union {}", t),
15441545

15451546
t if t.ends_with("_t") => t.to_string(),
15461547

1548+
// sigval is a struct in Rust, but a union in C:
1549+
"sigval" => format!("union sigval"),
1550+
15471551
// put `struct` in front of all structs:.
15481552
t if is_struct => format!("struct {}", t),
15491553

@@ -1565,16 +1569,6 @@ fn test_freebsd(target: &str) {
15651569
}
15661570
});
15671571

1568-
cfg.skip_struct(move |ty| {
1569-
match ty {
1570-
// This is actually a union, not a struct
1571-
// FIXME: still required?
1572-
"sigval" => true,
1573-
1574-
_ => false,
1575-
}
1576-
});
1577-
15781572
cfg.skip_signededness(move |c| {
15791573
match c {
15801574
// FIXME: still required?
@@ -1639,6 +1633,24 @@ fn test_freebsd(target: &str) {
16391633
}
16401634
});
16411635

1636+
cfg.volatile_item(|i| {
1637+
use ctest::VolatileItemKind::*;
1638+
match i {
1639+
// aio_buf is a volatile void** but since we cannot express that in
1640+
// Rust types, we have to explicitly tell the checker about it here:
1641+
StructField(ref n, ref f) if n == "aiocb" && f == "aio_buf" => {
1642+
true
1643+
}
1644+
_ => false,
1645+
}
1646+
});
1647+
1648+
cfg.skip_field(move |struct_, field| {
1649+
// FIXME: `sa_sigaction` has type `sighandler_t` but that type is
1650+
// incorrect, see: https://github.com/rust-lang/libc/issues/1359
1651+
(struct_ == "sigaction" && field == "sa_sigaction")
1652+
});
1653+
16421654
cfg.generate("../src/lib.rs", "main.rs");
16431655
}
16441656

0 commit comments

Comments
 (0)