@@ -78,8 +78,7 @@ fn do_semver() {
78
78
let target_env = env:: var ( "CARGO_CFG_TARGET_ENV" ) . unwrap ( ) ;
79
79
80
80
// `libc-test/semver` dir.
81
- let mut semver_root =
82
- PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
81
+ let mut semver_root = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
83
82
semver_root. push ( "semver" ) ;
84
83
85
84
// NOTE: Windows has the same `family` as `os`, no point in including it
@@ -103,11 +102,7 @@ fn do_semver() {
103
102
}
104
103
}
105
104
106
- fn process_semver_file < W : Write , P : AsRef < Path > > (
107
- output : & mut W ,
108
- path : & mut PathBuf ,
109
- file : P ,
110
- ) {
105
+ fn process_semver_file < W : Write , P : AsRef < Path > > ( output : & mut W , path : & mut PathBuf , file : P ) {
111
106
// NOTE: `path` is reused between calls, so always remove the file again.
112
107
path. push ( file) ;
113
108
path. set_extension ( "txt" ) ;
@@ -321,9 +316,7 @@ fn test_apple(target: &str) {
321
316
cfg. volatile_item ( |i| {
322
317
use ctest:: VolatileItemKind :: * ;
323
318
match i {
324
- StructField ( ref n, ref f) if n == "aiocb" && f == "aio_buf" => {
325
- true
326
- }
319
+ StructField ( ref n, ref f) if n == "aiocb" && f == "aio_buf" => true ,
327
320
_ => false ,
328
321
}
329
322
} ) ;
@@ -351,9 +344,7 @@ fn test_apple(target: &str) {
351
344
// FIXME: sigaction actually contains a union with two variants:
352
345
// a sa_sigaction with type: (*)(int, struct __siginfo *, void *)
353
346
// a sa_handler with type sig_t
354
- "sa_sigaction" if struct_ == "sigaction" => {
355
- "sa_handler" . to_string ( )
356
- }
347
+ "sa_sigaction" if struct_ == "sigaction" => "sa_handler" . to_string ( ) ,
357
348
s => s. to_string ( ) ,
358
349
}
359
350
} ) ;
@@ -475,9 +466,7 @@ fn test_openbsd(target: &str) {
475
466
cfg. type_name ( move |ty, is_struct, is_union| {
476
467
match ty {
477
468
// Just pass all these through, no need for a "struct" prefix
478
- "FILE" | "DIR" | "Dl_info" | "Elf32_Phdr" | "Elf64_Phdr" => {
479
- ty. to_string ( )
480
- }
469
+ "FILE" | "DIR" | "Dl_info" | "Elf32_Phdr" | "Elf64_Phdr" => ty. to_string ( ) ,
481
470
482
471
// OSX calls this something else
483
472
"sighandler_t" => "sig_t" . to_string ( ) ,
@@ -490,15 +479,9 @@ fn test_openbsd(target: &str) {
490
479
} ) ;
491
480
492
481
cfg. field_name ( move |struct_, field| match field {
493
- "st_birthtime" if struct_. starts_with ( "stat" ) => {
494
- "__st_birthtime" . to_string ( )
495
- }
496
- "st_birthtime_nsec" if struct_. starts_with ( "stat" ) => {
497
- "__st_birthtimensec" . to_string ( )
498
- }
499
- s if s. ends_with ( "_nsec" ) && struct_. starts_with ( "stat" ) => {
500
- s. replace ( "e_nsec" , ".tv_nsec" )
501
- }
482
+ "st_birthtime" if struct_. starts_with ( "stat" ) => "__st_birthtime" . to_string ( ) ,
483
+ "st_birthtime_nsec" if struct_. starts_with ( "stat" ) => "__st_birthtimensec" . to_string ( ) ,
484
+ s if s. ends_with ( "_nsec" ) && struct_. starts_with ( "stat" ) => s. replace ( "e_nsec" , ".tv_nsec" ) ,
502
485
"sa_sigaction" if struct_ == "sigaction" => "sa_handler" . to_string ( ) ,
503
486
s => s. to_string ( ) ,
504
487
} ) ;
@@ -788,18 +771,17 @@ fn test_solarish(target: &str) {
788
771
} ) ;
789
772
790
773
cfg. skip_const ( move |name| match name {
791
- "DT_FIFO" | "DT_CHR" | "DT_DIR" | "DT_BLK" | "DT_REG" | "DT_LNK"
792
- | "DT_SOCK" | "USRQUOTA" | "GRPQUOTA" | "PRIO_MIN" | "PRIO_MAX" => {
793
- true
794
- }
774
+ "DT_FIFO" | "DT_CHR" | "DT_DIR" | "DT_BLK" | "DT_REG" | "DT_LNK" | "DT_SOCK"
775
+ | "USRQUOTA" | "GRPQUOTA" | "PRIO_MIN" | "PRIO_MAX" => true ,
795
776
796
777
// skip sighandler_t assignments
797
778
"SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true ,
798
779
799
780
"DT_UNKNOWN" => true ,
800
781
801
- "_UTX_LINESIZE" | "_UTX_USERSIZE" | "_UTX_PADSIZE" | "_UTX_IDSIZE"
802
- | "_UTX_HOSTSIZE" => true ,
782
+ "_UTX_LINESIZE" | "_UTX_USERSIZE" | "_UTX_PADSIZE" | "_UTX_IDSIZE" | "_UTX_HOSTSIZE" => {
783
+ true
784
+ }
803
785
804
786
"EADI" | "EXTPROC" | "IPC_SEAT" => true ,
805
787
@@ -872,9 +854,7 @@ fn test_solarish(target: &str) {
872
854
"cfmakeraw" | "cfsetspeed" => true ,
873
855
874
856
// const-ness issues
875
- "execv" | "execve" | "execvp" | "settimeofday" | "sethostname" => {
876
- true
877
- }
857
+ "execv" | "execve" | "execvp" | "settimeofday" | "sethostname" => true ,
878
858
879
859
// Solaris-different
880
860
"getpwent_r" | "getgrent_r" | "updwtmpx" if is_illumos => true ,
@@ -979,10 +959,9 @@ fn test_netbsd(target: &str) {
979
959
cfg. type_name ( move |ty, is_struct, is_union| {
980
960
match ty {
981
961
// Just pass all these through, no need for a "struct" prefix
982
- "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr"
983
- | "Elf64_Phdr" | "Elf32_Shdr" | "Elf64_Shdr" | "Elf32_Sym"
984
- | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr" | "Elf32_Chdr"
985
- | "Elf64_Chdr" => ty. to_string ( ) ,
962
+ "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr" | "Elf64_Phdr" | "Elf32_Shdr"
963
+ | "Elf64_Shdr" | "Elf32_Sym" | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr"
964
+ | "Elf32_Chdr" | "Elf64_Chdr" => ty. to_string ( ) ,
986
965
987
966
// OSX calls this something else
988
967
"sighandler_t" => "sig_t" . to_string ( ) ,
@@ -1187,10 +1166,9 @@ fn test_dragonflybsd(target: &str) {
1187
1166
cfg. type_name ( move |ty, is_struct, is_union| {
1188
1167
match ty {
1189
1168
// Just pass all these through, no need for a "struct" prefix
1190
- "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr"
1191
- | "Elf64_Phdr" | "Elf32_Shdr" | "Elf64_Shdr" | "Elf32_Sym"
1192
- | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr" | "Elf32_Chdr"
1193
- | "Elf64_Chdr" => ty. to_string ( ) ,
1169
+ "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr" | "Elf64_Phdr" | "Elf32_Shdr"
1170
+ | "Elf64_Shdr" | "Elf32_Sym" | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr"
1171
+ | "Elf32_Chdr" | "Elf64_Chdr" => ty. to_string ( ) ,
1194
1172
1195
1173
// FIXME: OSX calls this something else
1196
1174
"sighandler_t" => "sig_t" . to_string ( ) ,
@@ -1269,10 +1247,7 @@ fn test_dragonflybsd(target: &str) {
1269
1247
1270
1248
// These are defined for Solaris 11, but the crate is tested on
1271
1249
// illumos, where they are currently not defined
1272
- "EADI"
1273
- | "PORT_SOURCE_POSTWAIT"
1274
- | "PORT_SOURCE_SIGNAL"
1275
- | "PTHREAD_STACK_MIN" => true ,
1250
+ "EADI" | "PORT_SOURCE_POSTWAIT" | "PORT_SOURCE_SIGNAL" | "PTHREAD_STACK_MIN" => true ,
1276
1251
1277
1252
_ => false ,
1278
1253
}
@@ -1551,9 +1526,7 @@ fn test_android(target: &str) {
1551
1526
match field {
1552
1527
// Our stat *_nsec fields normally don't actually exist but are part
1553
1528
// of a timeval struct
1554
- s if s. ends_with ( "_nsec" ) && struct_. starts_with ( "stat" ) => {
1555
- s. to_string ( )
1556
- }
1529
+ s if s. ends_with ( "_nsec" ) && struct_. starts_with ( "stat" ) => s. to_string ( ) ,
1557
1530
// FIXME: appears that `epoll_event.data` is an union
1558
1531
"u64" if struct_ == "epoll_event" => "data.u64" . to_string ( ) ,
1559
1532
s => s. to_string ( ) ,
@@ -1767,8 +1740,7 @@ fn test_freebsd(target: &str) {
1767
1740
cfg. type_name ( move |ty, is_struct, is_union| {
1768
1741
match ty {
1769
1742
// Just pass all these through, no need for a "struct" prefix
1770
- "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr"
1771
- | "Elf64_Phdr" => ty. to_string ( ) ,
1743
+ "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr" | "Elf64_Phdr" => ty. to_string ( ) ,
1772
1744
1773
1745
// FIXME: https://github.com/rust-lang/libc/issues/1273
1774
1746
"sighandler_t" => "sig_t" . to_string ( ) ,
@@ -1804,8 +1776,8 @@ fn test_freebsd(target: &str) {
1804
1776
cfg. skip_const ( move |name| {
1805
1777
match name {
1806
1778
// These constants are to be introduced in yet-unreleased FreeBSD 12.2.
1807
- "F_ADD_SEALS" | "F_GET_SEALS" | "F_SEAL_SEAL"
1808
- | "F_SEAL_SHRINK" | "F_SEAL_GROW" | " F_SEAL_WRITE"
1779
+ "F_ADD_SEALS" | "F_GET_SEALS" | "F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW"
1780
+ | "F_SEAL_WRITE"
1809
1781
if Some ( 12 ) <= freebsd_ver =>
1810
1782
{
1811
1783
true
@@ -1921,9 +1893,7 @@ fn test_freebsd(target: &str) {
1921
1893
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true ,
1922
1894
1923
1895
// These functions were added in FreeBSD 11:
1924
- "fdatasync" | "mq_getfd_np" | "sendmmsg" | "recvmmsg"
1925
- if Some ( 10 ) == freebsd_ver =>
1926
- {
1896
+ "fdatasync" | "mq_getfd_np" | "sendmmsg" | "recvmmsg" if Some ( 10 ) == freebsd_ver => {
1927
1897
true
1928
1898
}
1929
1899
@@ -1959,9 +1929,7 @@ fn test_freebsd(target: &str) {
1959
1929
match i {
1960
1930
// aio_buf is a volatile void** but since we cannot express that in
1961
1931
// Rust types, we have to explicitly tell the checker about it here:
1962
- StructField ( ref n, ref f) if n == "aiocb" && f == "aio_buf" => {
1963
- true
1964
- }
1932
+ StructField ( ref n, ref f) if n == "aiocb" && f == "aio_buf" => true ,
1965
1933
_ => false ,
1966
1934
}
1967
1935
} ) ;
@@ -2288,9 +2256,7 @@ fn test_vxworks(target: &str) {
2288
2256
} ) ;
2289
2257
2290
2258
cfg. skip_field_type ( move |struct_, field| match ( struct_, field) {
2291
- ( "siginfo_t" , "si_value" )
2292
- | ( "stat" , "st_size" )
2293
- | ( "sigaction" , "sa_u" ) => true ,
2259
+ ( "siginfo_t" , "si_value" ) | ( "stat" , "st_size" ) | ( "sigaction" , "sa_u" ) => true ,
2294
2260
_ => false ,
2295
2261
} ) ;
2296
2262
@@ -2525,10 +2491,9 @@ fn test_linux(target: &str) {
2525
2491
cfg. type_name ( move |ty, is_struct, is_union| {
2526
2492
match ty {
2527
2493
// Just pass all these through, no need for a "struct" prefix
2528
- "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr"
2529
- | "Elf64_Phdr" | "Elf32_Shdr" | "Elf64_Shdr" | "Elf32_Sym"
2530
- | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr" | "Elf32_Chdr"
2531
- | "Elf64_Chdr" => ty. to_string ( ) ,
2494
+ "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr" | "Elf64_Phdr" | "Elf32_Shdr"
2495
+ | "Elf64_Shdr" | "Elf32_Sym" | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr"
2496
+ | "Elf32_Chdr" | "Elf64_Chdr" => ty. to_string ( ) ,
2532
2497
2533
2498
t if is_union => format ! ( "union {}" , t) ,
2534
2499
@@ -2861,9 +2826,7 @@ fn test_linux(target: &str) {
2861
2826
match i {
2862
2827
// aio_buf is a volatile void** but since we cannot express that in
2863
2828
// Rust types, we have to explicitly tell the checker about it here:
2864
- StructField ( ref n, ref f) if n == "aiocb" && f == "aio_buf" => {
2865
- true
2866
- }
2829
+ StructField ( ref n, ref f) if n == "aiocb" && f == "aio_buf" => true ,
2867
2830
_ => false ,
2868
2831
}
2869
2832
} ) ;
@@ -2911,11 +2874,7 @@ fn test_linux(target: &str) {
2911
2874
// FIXME: This is actually a union.
2912
2875
"fpreg_t" if s390x => true ,
2913
2876
2914
- "sockaddr_un" | "sembuf" | "ff_constant_effect"
2915
- if mips32 && ( gnu || musl) =>
2916
- {
2917
- true
2918
- }
2877
+ "sockaddr_un" | "sembuf" | "ff_constant_effect" if mips32 && ( gnu || musl) => true ,
2919
2878
"ipv6_mreq"
2920
2879
| "ip_mreq_source"
2921
2880
| "sockaddr_in6"
@@ -2991,9 +2950,8 @@ fn test_linux_like_apis(target: &str) {
2991
2950
. skip_fn ( |_| true )
2992
2951
. skip_const ( move |name| match name {
2993
2952
// test fcntl constants:
2994
- "F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS"
2995
- | "F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW"
2996
- | "F_SEAL_WRITE" => false ,
2953
+ "F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" | "F_SEAL_SEAL" | "F_SEAL_SHRINK"
2954
+ | "F_SEAL_GROW" | "F_SEAL_WRITE" => false ,
2997
2955
_ => true ,
2998
2956
} )
2999
2957
. type_name ( move |ty, is_struct, is_union| match ty {
@@ -3285,12 +3243,12 @@ fn test_haiku(target: &str) {
3285
3243
cfg. skip_const ( move |name| {
3286
3244
match name {
3287
3245
// FIXME: these constants do not exist on Haiku
3288
- "DT_UNKNOWN" | "DT_FIFO" | "DT_CHR" | "DT_DIR" | "DT_BLK"
3289
- | "DT_REG" | "DT_LNK" | " DT_SOCK" => true ,
3246
+ "DT_UNKNOWN" | "DT_FIFO" | "DT_CHR" | "DT_DIR" | "DT_BLK" | "DT_REG" | "DT_LNK"
3247
+ | "DT_SOCK" => true ,
3290
3248
"USRQUOTA" | "GRPQUOTA" => true ,
3291
3249
"SIGIOT" => true ,
3292
- "ARPOP_REQUEST" | "ARPOP_REPLY" | "ATF_COM" | "ATF_PERM"
3293
- | "ATF_PUBL" | " ATF_USETRAILERS" => true ,
3250
+ "ARPOP_REQUEST" | "ARPOP_REPLY" | "ATF_COM" | "ATF_PERM" | "ATF_PUBL"
3251
+ | "ATF_USETRAILERS" => true ,
3294
3252
// Haiku does not have MAP_FILE, but rustc requires it
3295
3253
"MAP_FILE" => true ,
3296
3254
// The following does not exist on Haiku but is required by
@@ -3343,11 +3301,10 @@ fn test_haiku(target: &str) {
3343
3301
cfg. type_name ( move |ty, is_struct, is_union| {
3344
3302
match ty {
3345
3303
// Just pass all these through, no need for a "struct" prefix
3346
- "area_info" | "port_info" | "port_message_info" | "team_info"
3347
- | "sem_info" | "team_usage_info" | "thread_info" | "cpu_info"
3348
- | "system_info" | "object_wait_info" | "image_info"
3349
- | "attr_info" | "index_info" | "fs_info" | "FILE" | "DIR"
3350
- | "Dl_info" => ty. to_string ( ) ,
3304
+ "area_info" | "port_info" | "port_message_info" | "team_info" | "sem_info"
3305
+ | "team_usage_info" | "thread_info" | "cpu_info" | "system_info"
3306
+ | "object_wait_info" | "image_info" | "attr_info" | "index_info" | "fs_info"
3307
+ | "FILE" | "DIR" | "Dl_info" => ty. to_string ( ) ,
3351
3308
3352
3309
// is actually a union
3353
3310
"sigval" => format ! ( "union sigval" ) ,
0 commit comments