aboutsummaryrefslogtreecommitdiff
path: root/libc/libc-test
diff options
context:
space:
mode:
Diffstat (limited to 'libc/libc-test')
-rw-r--r--libc/libc-test/Cargo.toml13
-rw-r--r--libc/libc-test/build.rs367
2 files changed, 281 insertions, 99 deletions
diff --git a/libc/libc-test/Cargo.toml b/libc/libc-test/Cargo.toml
index 771d3b3..b782a95 100644
--- a/libc/libc-test/Cargo.toml
+++ b/libc/libc-test/Cargo.toml
@@ -4,11 +4,17 @@ version = "0.1.0"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
build = "build.rs"
-[dependencies]
-libc = { path = ".." }
+[dependencies.libc]
+path = ".."
+default-features = false
[build-dependencies]
-ctest = { git = "https://github.com/alexcrichton/ctest" }
+ctest = "0.2.8"
+
+[features]
+default = [ "use_std" ]
+use_std = [ "libc/use_std" ]
+align = [ "libc/align" ]
[[test]]
name = "main"
@@ -19,3 +25,4 @@ harness = false
name = "linux-fcntl"
path = "test/linux_fcntl.rs"
harness = false
+
diff --git a/libc/libc-test/build.rs b/libc/libc-test/build.rs
index 48f596f..460eb72 100644
--- a/libc/libc-test/build.rs
+++ b/libc/libc-test/build.rs
@@ -15,6 +15,7 @@ fn main() {
let linux = target.contains("unknown-linux");
let android = target.contains("android");
let apple = target.contains("apple");
+ let ios = target.contains("apple-ios");
let emscripten = target.contains("asm");
let musl = target.contains("musl") || emscripten;
let uclibc = target.contains("uclibc");
@@ -25,6 +26,8 @@ fn main() {
let openbsd = target.contains("openbsd");
let rumprun = target.contains("rumprun");
let solaris = target.contains("solaris");
+ let cloudabi = target.contains("cloudabi");
+ let redox = target.contains("redox");
let bsdlike = freebsd || apple || netbsd || openbsd || dragonfly;
let mut cfg = ctest::TestGenerator::new();
@@ -33,12 +36,16 @@ fn main() {
cfg.define("_GNU_SOURCE", None);
} else if netbsd {
cfg.define("_NETBSD_SOURCE", Some("1"));
+ } else if apple {
+ cfg.define("__APPLE_USE_RFC_3542", None);
} else if windows {
cfg.define("_WIN32_WINNT", Some("0x8000"));
} else if solaris {
cfg.define("_XOPEN_SOURCE", Some("700"));
cfg.define("__EXTENSIONS__", None);
cfg.define("_LCONV_C99", None);
+ } else if freebsd {
+ cfg.define("_WITH_GETLINE", None);
}
// Android doesn't actually have in_port_t but it's much easier if we
@@ -48,17 +55,17 @@ fn main() {
}
cfg.header("errno.h")
- .header("fcntl.h")
- .header("limits.h")
- .header("locale.h")
- .header("stddef.h")
- .header("stdint.h")
- .header("stdio.h")
- .header("stdlib.h")
- .header("sys/stat.h")
- .header("sys/types.h")
- .header("time.h")
- .header("wchar.h");
+ .header("fcntl.h")
+ .header("limits.h")
+ .header("locale.h")
+ .header("stddef.h")
+ .header("stdint.h")
+ .header("stdio.h")
+ .header("stdlib.h")
+ .header("sys/stat.h")
+ .header("sys/types.h")
+ .header("time.h")
+ .header("wchar.h");
if windows {
cfg.header("winsock2.h"); // must be before windows.h
@@ -82,6 +89,10 @@ fn main() {
cfg.header("sys/socket.h");
}
cfg.header("net/if.h");
+ if !ios {
+ cfg.header("net/route.h");
+ cfg.header("net/if_arp.h");
+ }
cfg.header("netdb.h");
cfg.header("netinet/in.h");
cfg.header("netinet/ip.h");
@@ -99,6 +110,7 @@ fn main() {
cfg.header("sys/socket.h");
if linux && !musl {
cfg.header("linux/if.h");
+ cfg.header("sys/auxv.h");
}
cfg.header("sys/time.h");
cfg.header("sys/un.h");
@@ -108,7 +120,7 @@ fn main() {
cfg.header("pwd.h");
cfg.header("grp.h");
cfg.header("sys/utsname.h");
- if !solaris {
+ if !solaris && !ios {
cfg.header("sys/ptrace.h");
}
cfg.header("sys/mount.h");
@@ -131,6 +143,7 @@ fn main() {
cfg.header("arpa/inet.h");
cfg.header("xlocale.h");
cfg.header("utmp.h");
+ cfg.header("ifaddrs.h");
if i686 || x86_64 {
cfg.header("sys/reg.h");
}
@@ -148,7 +161,6 @@ fn main() {
}
if !musl && !uclibc {
-
if !netbsd && !openbsd && !uclibc {
cfg.header("execinfo.h");
}
@@ -162,21 +174,30 @@ fn main() {
}
if apple {
+ cfg.header("spawn.h");
cfg.header("mach-o/dyld.h");
cfg.header("mach/mach_time.h");
cfg.header("malloc/malloc.h");
cfg.header("util.h");
cfg.header("xlocale.h");
cfg.header("sys/xattr.h");
- cfg.header("sys/sys_domain.h");
- cfg.header("net/if_utun.h");
- cfg.header("net/bpf.h");
- if target.starts_with("x86") {
+ if target.starts_with("x86") && !ios {
cfg.header("crt_externs.h");
}
- cfg.header("net/route.h");
- cfg.header("netinet/if_ether.h");
- cfg.header("sys/proc_info.h");
+ cfg.header("netinet/in.h");
+ cfg.header("sys/ipc.h");
+ cfg.header("sys/sem.h");
+ cfg.header("sys/shm.h");
+
+ if !ios {
+ cfg.header("sys/sys_domain.h");
+ cfg.header("net/if_utun.h");
+ cfg.header("net/bpf.h");
+ cfg.header("net/route.h");
+ cfg.header("netinet/if_ether.h");
+ cfg.header("sys/proc_info.h");
+ cfg.header("sys/kern_control.h");
+ }
}
if bsdlike {
@@ -237,26 +258,35 @@ fn main() {
}
cfg.header("sys/reboot.h");
if !emscripten {
+ cfg.header("linux/sockios.h");
+ cfg.header("linux/netlink.h");
+ cfg.header("linux/genetlink.h");
cfg.header("linux/netfilter_ipv4.h");
+ cfg.header("linux/netfilter_ipv6.h");
cfg.header("linux/fs.h");
}
if !musl {
cfg.header("asm/mman.h");
- cfg.header("linux/netlink.h");
cfg.header("linux/magic.h");
cfg.header("linux/reboot.h");
+ cfg.header("linux/netfilter/nf_tables.h");
if !mips {
cfg.header("linux/quota.h");
}
}
}
+ if solaris {
+ cfg.header("sys/epoll.h");
+ }
if linux || android {
cfg.header("sys/fsuid.h");
+ cfg.header("linux/module.h");
cfg.header("linux/seccomp.h");
cfg.header("linux/if_ether.h");
-
+ cfg.header("linux/if_tun.h");
+ cfg.header("linux/net_tstamp.h");
// DCCP support
if !uclibc && !musl && !emscripten {
cfg.header("linux/dccp.h");
@@ -271,7 +301,7 @@ fn main() {
cfg.header("linux/random.h");
cfg.header("elf.h");
cfg.header("link.h");
- cfg.header("linux/if_tun.h");
+ cfg.header("spawn.h");
}
if freebsd {
@@ -279,16 +309,21 @@ fn main() {
cfg.header("pthread_np.h");
cfg.header("sched.h");
cfg.header("ufs/ufs/quota.h");
+ cfg.header("sys/extattr.h");
cfg.header("sys/jail.h");
cfg.header("sys/ipc.h");
cfg.header("sys/msg.h");
cfg.header("sys/shm.h");
+ cfg.header("sys/procdesc.h");
+ cfg.header("sys/rtprio.h");
+ cfg.header("spawn.h");
}
if netbsd {
cfg.header("mqueue.h");
cfg.header("ufs/ufs/quota.h");
cfg.header("ufs/ufs/quota1.h");
+ cfg.header("sys/extattr.h");
cfg.header("sys/ioctl_compat.h");
// DCCP support
@@ -306,6 +341,7 @@ fn main() {
cfg.header("ufs/ufs/quota.h");
cfg.header("pthread_np.h");
cfg.header("sys/ioctl_compat.h");
+ cfg.header("sys/rtprio.h");
}
if solaris {
@@ -321,15 +357,17 @@ fn main() {
}
}
- cfg.type_name(move |ty, is_struct| {
+ if cloudabi || redox {
+ cfg.header("strings.h");
+ }
+
+ cfg.type_name(move |ty, is_struct, is_union| {
match ty {
// Just pass all these through, no need for a "struct" prefix
- "FILE" |
- "fd_set" |
- "Dl_info" |
- "DIR" |
- "Elf32_Phdr" |
- "Elf64_Phdr" => ty.to_string(),
+ "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr"
+ | "Elf64_Phdr" | "Elf32_Shdr" | "Elf64_Shdr" | "Elf32_Sym"
+ | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr" | "Elf32_Chdr"
+ | "Elf64_Chdr" => ty.to_string(),
// Fixup a few types on windows that don't actually exist.
"time64_t" if windows => "__time64_t".to_string(),
@@ -338,6 +376,8 @@ fn main() {
// OSX calls this something else
"sighandler_t" if bsdlike => "sig_t".to_string(),
+ t if is_union => format!("union {}", t),
+
t if t.ends_with("_t") => t.to_string(),
// Windows uppercase structs don't have `struct` in front, there's a
@@ -362,8 +402,12 @@ fn main() {
let target2 = target.clone();
cfg.field_name(move |struct_, field| {
match field {
- "st_birthtime" if openbsd && struct_ == "stat" => "__st_birthtime".to_string(),
- "st_birthtime_nsec" if openbsd && struct_ == "stat" => "__st_birthtimensec".to_string(),
+ "st_birthtime" if openbsd && struct_ == "stat" => {
+ "__st_birthtime".to_string()
+ }
+ "st_birthtime_nsec" if openbsd && struct_ == "stat" => {
+ "__st_birthtimensec".to_string()
+ }
// Our stat *_nsec fields normally don't actually exist but are part
// of a timeval struct
s if s.ends_with("_nsec") && struct_.starts_with("stat") => {
@@ -376,9 +420,15 @@ fn main() {
}
}
"u64" if struct_ == "epoll_event" => "data.u64".to_string(),
- "type_" if linux &&
- (struct_ == "input_event" || struct_ == "input_mask" ||
- struct_ == "ff_effect") => "type".to_string(),
+ "type_"
+ if (linux || freebsd || dragonfly)
+ && (struct_ == "input_event"
+ || struct_ == "input_mask"
+ || struct_ == "ff_effect"
+ || struct_ == "rtprio") =>
+ {
+ "type".to_string()
+ }
s => s.to_string(),
}
});
@@ -388,7 +438,7 @@ fn main() {
// sighandler_t is crazy across platforms
"sighandler_t" => true,
- _ => false
+ _ => false,
}
});
@@ -401,8 +451,10 @@ fn main() {
// which is absent in glibc, has to be defined.
"__timeval" if linux => true,
- // The alignment of this is 4 on 64-bit OSX...
- "kevent" if apple && x86_64 => true,
+ // Fixed on feature=align with repr(packed(4))
+ // Once repr_packed stabilizes we can fix this unconditionally
+ // and remove this check.
+ "kevent" | "shmid_ds" | "semid_ds" if apple && x86_64 => true,
// This is actually a union, not a struct
"sigval" => true,
@@ -420,16 +472,26 @@ fn main() {
// header conflicts when including them with all the other structs.
"termios2" => true,
- _ => false
+ // Present on historical versions of iOS but missing in more recent
+ // SDKs
+ "bpf_hdr" | "proc_taskinfo" | "proc_taskallinfo"
+ | "proc_bsdinfo" | "proc_threadinfo" | "sockaddr_inarp"
+ | "sockaddr_ctl" | "arphdr"
+ if ios =>
+ {
+ true
+ }
+
+ _ => false,
}
});
cfg.skip_signededness(move |c| {
match c {
- "LARGE_INTEGER" |
- "mach_timebase_info_data_t" |
- "float" |
- "double" => true,
+ "LARGE_INTEGER"
+ | "mach_timebase_info_data_t"
+ | "float"
+ | "double" => true,
// uuid_t is a struct, not an integer.
"uuid_t" if dragonfly => true,
n if n.starts_with("pthread") => true,
@@ -438,6 +500,9 @@ fn main() {
// mqd_t is a pointer on FreeBSD and DragonFly
"mqd_t" if freebsd || dragonfly => true,
+ // Just some typedefs on osx, no need to check their sign
+ "posix_spawnattr_t" | "posix_spawn_file_actions_t" => true,
+
// windows-isms
n if n.starts_with("P") => true,
n if n.starts_with("H") => true,
@@ -449,25 +514,31 @@ fn main() {
cfg.skip_const(move |name| {
match name {
// Apparently these don't exist in mingw headers?
- "MEM_RESET_UNDO" |
- "FILE_ATTRIBUTE_NO_SCRUB_DATA" |
- "FILE_ATTRIBUTE_INTEGRITY_STREAM" |
- "ERROR_NOTHING_TO_TERMINATE" if mingw => true,
+ "MEM_RESET_UNDO"
+ | "FILE_ATTRIBUTE_NO_SCRUB_DATA"
+ | "FILE_ATTRIBUTE_INTEGRITY_STREAM"
+ | "ERROR_NOTHING_TO_TERMINATE"
+ if mingw =>
+ {
+ true
+ }
- "SIG_DFL" |
- "SIG_ERR" |
- "SIG_IGN" => true, // sighandler_t weirdness
- "SIGUNUSED" => true, // removed in glibc 2.26
+ "SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true, // sighandler_t weirdness
+ "SIGUNUSED" => true, // removed in glibc 2.26
// types on musl are defined a little differently
n if musl && n.contains("__SIZEOF_PTHREAD") => true,
// Skip constants not defined in MUSL but just passed down to the
// kernel regardless
- "RLIMIT_NLIMITS" |
- "TCP_COOKIE_TRANSACTIONS" |
- "RLIMIT_RTTIME" |
- "MSG_COPY" if musl => true,
+ "RLIMIT_NLIMITS"
+ | "TCP_COOKIE_TRANSACTIONS"
+ | "RLIMIT_RTTIME"
+ | "MSG_COPY"
+ if musl =>
+ {
+ true
+ }
// work around super old mips toolchain
"SCHED_IDLE" | "SHM_NORESERVE" => mips,
@@ -476,21 +547,32 @@ fn main() {
"MS_RMT_MASK" => true, // updated in glibc 2.22 and musl 1.1.13
// These OSX constants are flagged as deprecated
- "NOTE_EXIT_REPARENTED" |
- "NOTE_REAP" if apple => true,
+ "NOTE_EXIT_REPARENTED" | "NOTE_REAP" if apple => true,
// These constants were removed in FreeBSD 11 (svn r273250) but will
// still be accepted and ignored at runtime.
- "MAP_RENAME" |
- "MAP_NORESERVE" if freebsd => true,
+ "MAP_RENAME" | "MAP_NORESERVE" if freebsd => true,
// These constants were removed in FreeBSD 11 (svn r262489),
// and they've never had any legitimate use outside of the
// base system anyway.
- "CTL_MAXID" |
- "KERN_MAXID" |
- "HW_MAXID" |
- "USER_MAXID" if freebsd => true,
+ "CTL_MAXID" | "KERN_MAXID" | "HW_MAXID" | "NET_MAXID"
+ | "USER_MAXID"
+ if freebsd =>
+ {
+ true
+ }
+
+ // These constants were added in FreeBSD 11
+ "EVFILT_PROCDESC" | "EVFILT_SENDFILE" | "EVFILT_EMPTY"
+ | "PD_CLOEXEC" | "PD_ALLOWED_AT_FORK"
+ if freebsd =>
+ {
+ true
+ }
+
+ // These constants were added in FreeBSD 12
+ "SF_USER_READAHEAD" | "SO_REUSEPORT_LB" if freebsd => true,
// These OSX constants are removed in Sierra.
// https://developer.apple.com/library/content/releasenotes/General/APIDiffsMacOS10_12/Swift/Darwin.html
@@ -499,21 +581,43 @@ fn main() {
// These constants were removed in OpenBSD 6 (https://git.io/v7gBO
// https://git.io/v7gBq)
- "KERN_USERMOUNT" |
- "KERN_ARND" if openbsd => true,
-
- // These constats were added in OpenBSD 6.2
- "EV_RECEIPT" | "EV_DISPATCH" if openbsd => true,
+ "KERN_USERMOUNT" | "KERN_ARND" if openbsd => true,
// These are either unimplemented or optionally built into uClibc
- "LC_CTYPE_MASK" | "LC_NUMERIC_MASK" | "LC_TIME_MASK" | "LC_COLLATE_MASK" | "LC_MONETARY_MASK" | "LC_MESSAGES_MASK" |
- "MADV_MERGEABLE" | "MADV_UNMERGEABLE" | "MADV_HWPOISON" | "IPV6_ADD_MEMBERSHIP" | "IPV6_DROP_MEMBERSHIP" | "IPV6_MULTICAST_LOOP" | "IPV6_V6ONLY" |
- "MAP_STACK" | "RTLD_DEEPBIND" | "SOL_IPV6" | "SOL_ICMPV6" if uclibc => true,
+ "LC_CTYPE_MASK"
+ | "LC_NUMERIC_MASK"
+ | "LC_TIME_MASK"
+ | "LC_COLLATE_MASK"
+ | "LC_MONETARY_MASK"
+ | "LC_MESSAGES_MASK"
+ | "MADV_MERGEABLE"
+ | "MADV_UNMERGEABLE"
+ | "MADV_HWPOISON"
+ | "IPV6_ADD_MEMBERSHIP"
+ | "IPV6_DROP_MEMBERSHIP"
+ | "IPV6_MULTICAST_LOOP"
+ | "IPV6_V6ONLY"
+ | "MAP_STACK"
+ | "RTLD_DEEPBIND"
+ | "SOL_IPV6"
+ | "SOL_ICMPV6"
+ if uclibc =>
+ {
+ true
+ }
// Musl uses old, patched kernel headers
- "FALLOC_FL_COLLAPSE_RANGE" | "FALLOC_FL_ZERO_RANGE" |
- "FALLOC_FL_INSERT_RANGE" | "FALLOC_FL_UNSHARE_RANGE" |
- "RENAME_NOREPLACE" | "RENAME_EXCHANGE" | "RENAME_WHITEOUT" if musl => true,
+ "FALLOC_FL_COLLAPSE_RANGE"
+ | "FALLOC_FL_ZERO_RANGE"
+ | "FALLOC_FL_INSERT_RANGE"
+ | "FALLOC_FL_UNSHARE_RANGE"
+ | "RENAME_NOREPLACE"
+ | "RENAME_EXCHANGE"
+ | "RENAME_WHITEOUT"
+ if musl =>
+ {
+ true
+ }
// Both android and musl use old kernel headers
// These are constants used in getrandom syscall
@@ -521,7 +625,7 @@ fn main() {
// Defined by libattr not libc on linux (hard to test).
// See constant definition for more details.
- "ENOATTR" if linux => true,
+ "ENOATTR" if android || linux => true,
// On mips*-unknown-linux-gnu* CMSPAR cannot be included with the set of headers we
// want to use here for testing. It's originally defined in asm/termbits.h, which is
@@ -538,18 +642,67 @@ fn main() {
// These constants are tested in a separate test program generated below because there
// are header conflicts if we try to include the headers that define them here.
"F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => true,
- "F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => true,
- "QFMT_VFS_OLD" | "QFMT_VFS_V0" | "QFMT_VFS_V1" if mips && linux => true, // Only on MIPS
+ "F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW"
+ | "F_SEAL_WRITE" => true,
+ "QFMT_VFS_OLD" | "QFMT_VFS_V0" | "QFMT_VFS_V1"
+ if mips && linux =>
+ {
+ true
+ } // Only on MIPS
"BOTHER" => true,
"MFD_CLOEXEC" | "MFD_ALLOW_SEALING" if !mips && musl => true,
- "DT_FIFO" | "DT_CHR" | "DT_DIR" | "DT_BLK" | "DT_REG" | "DT_LNK" | "DT_SOCK" if solaris => true,
+ "DT_FIFO" | "DT_CHR" | "DT_DIR" | "DT_BLK" | "DT_REG"
+ | "DT_LNK" | "DT_SOCK"
+ if solaris =>
+ {
+ true
+ }
"USRQUOTA" | "GRPQUOTA" if solaris => true,
"PRIO_MIN" | "PRIO_MAX" if solaris => true,
// These are defined for Solaris 11, but the crate is tested on illumos, where they are currently not defined
- "EADI" | "PORT_SOURCE_POSTWAIT" | "PORT_SOURCE_SIGNAL" | "PTHREAD_STACK_MIN" => true,
+ "EADI"
+ | "PORT_SOURCE_POSTWAIT"
+ | "PORT_SOURCE_SIGNAL"
+ | "PTHREAD_STACK_MIN" => true,
+
+ // These change all the time from release to release of linux
+ // distros, let's just not bother trying to verify them. They
+ // shouldn't be used in code anyway...
+ "AF_MAX" | "PF_MAX" => true,
+
+ // These are not in a glibc release yet, only in kernel headers.
+ "AF_XDP" | "PF_XDP" | "SOL_XDP" if linux => true,
+
+ // Present on historical versions of iOS, but now removed in more
+ // recent SDKs
+ "ARPOP_REQUEST"
+ | "ARPOP_REPLY"
+ | "ATF_COM"
+ | "ATF_PERM"
+ | "ATF_PUBL"
+ | "ATF_USETRAILERS"
+ | "AF_SYS_CONTROL"
+ | "SYSPROTO_EVENT"
+ | "PROC_PIDTASKALLINFO"
+ | "PROC_PIDTASKINFO"
+ | "PROC_PIDTHREADINFO"
+ | "UTUN_OPT_FLAGS"
+ | "UTUN_OPT_IFNAME"
+ | "BPF_ALIGNMENT"
+ | "SYSPROTO_CONTROL"
+ if ios =>
+ {
+ true
+ }
+ s if ios && s.starts_with("RTF_") => true,
+ s if ios && s.starts_with("RTM_") => true,
+ s if ios && s.starts_with("RTA_") => true,
+ s if ios && s.starts_with("RTAX_") => true,
+ s if ios && s.starts_with("RTV_") => true,
+ s if ios && s.starts_with("DLT_") => true,
_ => false,
}
@@ -636,6 +789,9 @@ fn main() {
// the symbol.
"uname" if freebsd => true,
+ // FIXME: need to upgrade FreeBSD version; see https://github.com/rust-lang/libc/issues/938
+ "setgrent" if freebsd => true,
+
// aio_waitcomplete's return type changed between FreeBSD 10 and 11.
"aio_waitcomplete" if freebsd => true,
@@ -690,6 +846,18 @@ fn main() {
// FIXME: mincore is defined with caddr_t on Solaris.
"mincore" if solaris => true,
+ // These were all included in historical versions of iOS but appear
+ // to be removed now
+ "system" | "ptrace" if ios => true,
+
+ _ => false,
+ }
+ });
+
+ cfg.skip_static(move |name| {
+ match name {
+ // Internal constant, not declared in any headers.
+ "__progname" if android => true,
_ => false,
}
});
@@ -731,7 +899,13 @@ fn main() {
// musl seems to define this as an *anonymous* bitfield
(musl && struct_ == "statvfs" && field == "__f_unused") ||
// sigev_notify_thread_id is actually part of a sigev_un union
- (struct_ == "sigevent" && field == "sigev_notify_thread_id")
+ (struct_ == "sigevent" && field == "sigev_notify_thread_id") ||
+ // signalfd had SIGSYS fields added in Linux 4.18, but no libc release has them yet.
+ (struct_ == "signalfd_siginfo" && (field == "ssi_addr_lsb" ||
+ field == "_pad2" ||
+ field == "ssi_syscall" ||
+ field == "ssi_call_addr" ||
+ field == "ssi_arch"))
});
cfg.fn_cname(move |name, cname| {
@@ -749,7 +923,8 @@ fn main() {
// fails on a lot of platforms.
let mut cfg = ctest::TestGenerator::new();
cfg.skip_type(|_| true)
- .skip_fn(|_| true);
+ .skip_fn(|_| true)
+ .skip_static(|_| true);
if android || linux {
// musl defines these directly in `fcntl.h`
if musl {
@@ -763,23 +938,23 @@ fn main() {
}
cfg.header("linux/quota.h");
cfg.header("asm/termbits.h");
- cfg.skip_const(move |name| {
- match name {
- "F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => false,
- "F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => false,
- "QFMT_VFS_OLD" | "QFMT_VFS_V0" | "QFMT_VFS_V1" if mips && linux => false,
- "BOTHER" => false,
- _ => true,
+ cfg.skip_const(move |name| match name {
+ "F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => false,
+ "F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW"
+ | "F_SEAL_WRITE" => false,
+ "QFMT_VFS_OLD" | "QFMT_VFS_V0" | "QFMT_VFS_V1"
+ if mips && linux =>
+ {
+ false
}
+ "BOTHER" => false,
+ _ => true,
});
- cfg.skip_struct(|s| {
- s != "termios2"
- });
- cfg.type_name(move |ty, is_struct| {
- match ty {
- t if is_struct => format!("struct {}", t),
- t => t.to_string(),
- }
+ cfg.skip_struct(|s| s != "termios2");
+ cfg.type_name(move |ty, is_struct, is_union| match ty {
+ t if is_struct => format!("struct {}", t),
+ t if is_union => format!("union {}", t),
+ t => t.to_string(),
});
} else {
cfg.skip_const(|_| true);