@@ -31,6 +31,23 @@ fn do_ctest() {
3131 }
3232}
3333
34+ fn ctest_cfg ( ) -> ctest:: TestGenerator {
35+ let mut cfg = ctest:: TestGenerator :: new ( ) ;
36+ let libc_cfgs = [
37+ "libc_priv_mod_use" ,
38+ "libc_union" ,
39+ "libc_const_size_of" ,
40+ "libc_align" ,
41+ "libc_core_cvoid" ,
42+ "libc_packedN" ,
43+ "libc_thread_local" ,
44+ ] ;
45+ for f in & libc_cfgs {
46+ cfg. cfg ( f, None ) ;
47+ }
48+ cfg
49+ }
50+
3451fn main ( ) {
3552 do_cc ( ) ;
3653 do_ctest ( ) ;
@@ -59,8 +76,9 @@ macro_rules! headers {
5976fn test_apple ( target : & str ) {
6077 assert ! ( target. contains( "apple" ) ) ;
6178 let x86_64 = target. contains ( "x86_64" ) ;
79+ let i686 = target. contains ( "i686" ) ;
6280
63- let mut cfg = ctest :: TestGenerator :: new ( ) ;
81+ let mut cfg = ctest_cfg ( ) ;
6482 cfg. flag ( "-Wno-deprecated-declarations" ) ;
6583 cfg. define ( "__APPLE_USE_RFC_3542" , None ) ;
6684
@@ -225,13 +243,18 @@ fn test_apple(target: &str) {
225243 }
226244 } ) ;
227245
246+ cfg. skip_roundtrip ( move |s| match s {
247+ // FIXME: this type has the wrong ABI
248+ "max_align_t" if i686 => true ,
249+ _ => false ,
250+ } ) ;
228251 cfg. generate ( "../src/lib.rs" , "main.rs" ) ;
229252}
230253
231254fn test_openbsd ( target : & str ) {
232255 assert ! ( target. contains( "openbsd" ) ) ;
233256
234- let mut cfg = ctest :: TestGenerator :: new ( ) ;
257+ let mut cfg = ctest_cfg ( ) ;
235258 cfg. flag ( "-Wno-deprecated-declarations" ) ;
236259
237260 headers ! { cfg:
@@ -371,7 +394,7 @@ fn test_windows(target: &str) {
371394 assert ! ( target. contains( "windows" ) ) ;
372395 let gnu = target. contains ( "gnu" ) ;
373396
374- let mut cfg = ctest :: TestGenerator :: new ( ) ;
397+ let mut cfg = ctest_cfg ( ) ;
375398 cfg. define ( "_WIN32_WINNT" , Some ( "0x8000" ) ) ;
376399
377400 headers ! { cfg:
@@ -474,7 +497,7 @@ fn test_windows(target: &str) {
474497fn test_redox ( target : & str ) {
475498 assert ! ( target. contains( "redox" ) ) ;
476499
477- let mut cfg = ctest :: TestGenerator :: new ( ) ;
500+ let mut cfg = ctest_cfg ( ) ;
478501 cfg. flag ( "-Wno-deprecated-declarations" ) ;
479502
480503 headers ! {
@@ -540,7 +563,7 @@ fn test_redox(target: &str) {
540563fn test_cloudabi ( target : & str ) {
541564 assert ! ( target. contains( "cloudabi" ) ) ;
542565
543- let mut cfg = ctest :: TestGenerator :: new ( ) ;
566+ let mut cfg = ctest_cfg ( ) ;
544567 cfg. flag ( "-Wno-deprecated-declarations" ) ;
545568
546569 headers ! {
@@ -611,7 +634,7 @@ fn test_cloudabi(target: &str) {
611634fn test_solaris ( target : & str ) {
612635 assert ! ( target. contains( "solaris" ) ) ;
613636
614- let mut cfg = ctest :: TestGenerator :: new ( ) ;
637+ let mut cfg = ctest_cfg ( ) ;
615638 cfg. flag ( "-Wno-deprecated-declarations" ) ;
616639
617640 cfg. define ( "_XOPEN_SOURCE" , Some ( "700" ) ) ;
@@ -722,7 +745,7 @@ fn test_solaris(target: &str) {
722745fn test_netbsd ( target : & str ) {
723746 assert ! ( target. contains( "netbsd" ) ) ;
724747 let rumprun = target. contains ( "rumprun" ) ;
725- let mut cfg = ctest :: TestGenerator :: new ( ) ;
748+ let mut cfg = ctest_cfg ( ) ;
726749
727750 cfg. flag ( "-Wno-deprecated-declarations" ) ;
728751 cfg. define ( "_NETBSD_SOURCE" , Some ( "1" ) ) ;
@@ -922,7 +945,7 @@ fn test_netbsd(target: &str) {
922945
923946fn test_dragonflybsd ( target : & str ) {
924947 assert ! ( target. contains( "dragonfly" ) ) ;
925- let mut cfg = ctest :: TestGenerator :: new ( ) ;
948+ let mut cfg = ctest_cfg ( ) ;
926949 cfg. flag ( "-Wno-deprecated-declarations" ) ;
927950
928951 headers ! {
@@ -1127,7 +1150,7 @@ fn test_dragonflybsd(target: &str) {
11271150fn test_wasi ( target : & str ) {
11281151 assert ! ( target. contains( "wasi" ) ) ;
11291152
1130- let mut cfg = ctest :: TestGenerator :: new ( ) ;
1153+ let mut cfg = ctest_cfg ( ) ;
11311154 cfg. define ( "_GNU_SOURCE" , None ) ;
11321155
11331156 headers ! { cfg:
@@ -1204,7 +1227,7 @@ fn test_android(target: &str) {
12041227 } ;
12051228 let x86 = target. contains ( "i686" ) || target. contains ( "x86_64" ) ;
12061229
1207- let mut cfg = ctest :: TestGenerator :: new ( ) ;
1230+ let mut cfg = ctest_cfg ( ) ;
12081231 cfg. define ( "_GNU_SOURCE" , None ) ;
12091232
12101233 headers ! { cfg:
@@ -1429,7 +1452,7 @@ fn test_android(target: &str) {
14291452
14301453fn test_freebsd ( target : & str ) {
14311454 assert ! ( target. contains( "freebsd" ) ) ;
1432- let mut cfg = ctest :: TestGenerator :: new ( ) ;
1455+ let mut cfg = ctest_cfg ( ) ;
14331456
14341457 let freebsd_ver = which_freebsd ( ) ;
14351458
@@ -1631,7 +1654,7 @@ fn test_freebsd(target: &str) {
16311654fn test_emscripten ( target : & str ) {
16321655 assert ! ( target. contains( "emscripten" ) ) ;
16331656
1634- let mut cfg = ctest :: TestGenerator :: new ( ) ;
1657+ let mut cfg = ctest_cfg ( ) ;
16351658 cfg. define ( "_GNU_SOURCE" , None ) ; // FIXME: ??
16361659
16371660 headers ! { cfg:
@@ -1852,17 +1875,19 @@ fn test_linux(target: &str) {
18521875 }
18531876
18541877 let arm = target. contains ( "arm" ) ;
1855- let x86_64 = target. contains ( "x86_64" ) ;
1856- let x86_32 = target. contains ( "i686" ) ;
1857- let x32 = target. contains ( "x32" ) ;
1878+ let i686 = target. contains ( "i686" ) ;
18581879 let mips = target. contains ( "mips" ) ;
18591880 let mips32 = mips && !target. contains ( "64" ) ;
1860- let mips64 = mips && target. contains ( "64" ) ;
18611881 let mips32_musl = mips32 && musl;
1862- let sparc64 = target. contains ( "sparc64" ) ;
1882+ let mips64 = mips && target. contains ( "64" ) ;
1883+ let ppc64 = target. contains ( "powerpc64" ) ;
18631884 let s390x = target. contains ( "s390x" ) ;
1885+ let sparc64 = target. contains ( "sparc64" ) ;
1886+ let x32 = target. contains ( "x32" ) ;
1887+ let x86_32 = target. contains ( "i686" ) ;
1888+ let x86_64 = target. contains ( "x86_64" ) ;
18641889
1865- let mut cfg = ctest :: TestGenerator :: new ( ) ;
1890+ let mut cfg = ctest_cfg ( ) ;
18661891 cfg. define ( "_GNU_SOURCE" , None ) ;
18671892 // This macro re-deifnes fscanf,scanf,sscanf to link to the symbols that are
18681893 // deprecated since glibc >= 2.29. This allows Rust binaries to link against
@@ -2286,6 +2311,9 @@ fn test_linux(target: &str) {
22862311 true
22872312 }
22882313
2314+ // FIXME: the call ABI of max_align_t is incorrect on these platforms:
2315+ "max_align_t" if i686 || mips64 || ppc64 => true ,
2316+
22892317 _ => false ,
22902318 } ) ;
22912319
@@ -2305,7 +2333,7 @@ fn test_linux_like_apis(target: &str) {
23052333
23062334 if linux || android || emscripten {
23072335 // test strerror_r from the `string.h` header
2308- let mut cfg = ctest :: TestGenerator :: new ( ) ;
2336+ let mut cfg = ctest_cfg ( ) ;
23092337 cfg. skip_type ( |_| true ) . skip_static ( |_| true ) ;
23102338
23112339 headers ! { cfg: "string.h" }
@@ -2321,7 +2349,7 @@ fn test_linux_like_apis(target: &str) {
23212349 if linux || android || emscripten {
23222350 // test fcntl - see:
23232351 // http://man7.org/linux/man-pages/man2/fcntl.2.html
2324- let mut cfg = ctest :: TestGenerator :: new ( ) ;
2352+ let mut cfg = ctest_cfg ( ) ;
23252353
23262354 if musl {
23272355 cfg. header ( "fcntl.h" ) ;
@@ -2351,7 +2379,7 @@ fn test_linux_like_apis(target: &str) {
23512379
23522380 if linux || android {
23532381 // test termios
2354- let mut cfg = ctest :: TestGenerator :: new ( ) ;
2382+ let mut cfg = ctest_cfg ( ) ;
23552383 cfg. header ( "asm/termbits.h" ) ;
23562384 cfg. skip_type ( |_| true )
23572385 . skip_static ( |_| true )
@@ -2368,7 +2396,7 @@ fn test_linux_like_apis(target: &str) {
23682396
23692397 if linux || android {
23702398 // test IPV6_ constants:
2371- let mut cfg = ctest :: TestGenerator :: new ( ) ;
2399+ let mut cfg = ctest_cfg ( ) ;
23722400 headers ! {
23732401 cfg:
23742402 "linux/in6.h"
@@ -2399,7 +2427,7 @@ fn test_linux_like_apis(target: &str) {
23992427 // These types have a field called `p_type`, but including
24002428 // "resolve.h" defines a `p_type` macro that expands to `__p_type`
24012429 // making the tests for these fails when both are included.
2402- let mut cfg = ctest :: TestGenerator :: new ( ) ;
2430+ let mut cfg = ctest_cfg ( ) ;
24032431 cfg. header ( "elf.h" ) ;
24042432 cfg. skip_fn ( |_| true )
24052433 . skip_static ( |_| true )
0 commit comments