@@ -31,6 +31,23 @@ fn do_ctest() {
31
31
}
32
32
}
33
33
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
+
34
51
fn main ( ) {
35
52
do_cc ( ) ;
36
53
do_ctest ( ) ;
@@ -59,8 +76,9 @@ macro_rules! headers {
59
76
fn test_apple ( target : & str ) {
60
77
assert ! ( target. contains( "apple" ) ) ;
61
78
let x86_64 = target. contains ( "x86_64" ) ;
79
+ let i686 = target. contains ( "i686" ) ;
62
80
63
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
81
+ let mut cfg = ctest_cfg ( ) ;
64
82
cfg. flag ( "-Wno-deprecated-declarations" ) ;
65
83
cfg. define ( "__APPLE_USE_RFC_3542" , None ) ;
66
84
@@ -225,13 +243,18 @@ fn test_apple(target: &str) {
225
243
}
226
244
} ) ;
227
245
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
+ } ) ;
228
251
cfg. generate ( "../src/lib.rs" , "main.rs" ) ;
229
252
}
230
253
231
254
fn test_openbsd ( target : & str ) {
232
255
assert ! ( target. contains( "openbsd" ) ) ;
233
256
234
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
257
+ let mut cfg = ctest_cfg ( ) ;
235
258
cfg. flag ( "-Wno-deprecated-declarations" ) ;
236
259
237
260
headers ! { cfg:
@@ -371,7 +394,7 @@ fn test_windows(target: &str) {
371
394
assert ! ( target. contains( "windows" ) ) ;
372
395
let gnu = target. contains ( "gnu" ) ;
373
396
374
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
397
+ let mut cfg = ctest_cfg ( ) ;
375
398
cfg. define ( "_WIN32_WINNT" , Some ( "0x8000" ) ) ;
376
399
377
400
headers ! { cfg:
@@ -474,7 +497,7 @@ fn test_windows(target: &str) {
474
497
fn test_redox ( target : & str ) {
475
498
assert ! ( target. contains( "redox" ) ) ;
476
499
477
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
500
+ let mut cfg = ctest_cfg ( ) ;
478
501
cfg. flag ( "-Wno-deprecated-declarations" ) ;
479
502
480
503
headers ! {
@@ -540,7 +563,7 @@ fn test_redox(target: &str) {
540
563
fn test_cloudabi ( target : & str ) {
541
564
assert ! ( target. contains( "cloudabi" ) ) ;
542
565
543
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
566
+ let mut cfg = ctest_cfg ( ) ;
544
567
cfg. flag ( "-Wno-deprecated-declarations" ) ;
545
568
546
569
headers ! {
@@ -611,7 +634,7 @@ fn test_cloudabi(target: &str) {
611
634
fn test_solaris ( target : & str ) {
612
635
assert ! ( target. contains( "solaris" ) ) ;
613
636
614
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
637
+ let mut cfg = ctest_cfg ( ) ;
615
638
cfg. flag ( "-Wno-deprecated-declarations" ) ;
616
639
617
640
cfg. define ( "_XOPEN_SOURCE" , Some ( "700" ) ) ;
@@ -722,7 +745,7 @@ fn test_solaris(target: &str) {
722
745
fn test_netbsd ( target : & str ) {
723
746
assert ! ( target. contains( "netbsd" ) ) ;
724
747
let rumprun = target. contains ( "rumprun" ) ;
725
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
748
+ let mut cfg = ctest_cfg ( ) ;
726
749
727
750
cfg. flag ( "-Wno-deprecated-declarations" ) ;
728
751
cfg. define ( "_NETBSD_SOURCE" , Some ( "1" ) ) ;
@@ -922,7 +945,7 @@ fn test_netbsd(target: &str) {
922
945
923
946
fn test_dragonflybsd ( target : & str ) {
924
947
assert ! ( target. contains( "dragonfly" ) ) ;
925
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
948
+ let mut cfg = ctest_cfg ( ) ;
926
949
cfg. flag ( "-Wno-deprecated-declarations" ) ;
927
950
928
951
headers ! {
@@ -1127,7 +1150,7 @@ fn test_dragonflybsd(target: &str) {
1127
1150
fn test_wasi ( target : & str ) {
1128
1151
assert ! ( target. contains( "wasi" ) ) ;
1129
1152
1130
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
1153
+ let mut cfg = ctest_cfg ( ) ;
1131
1154
cfg. define ( "_GNU_SOURCE" , None ) ;
1132
1155
1133
1156
headers ! { cfg:
@@ -1204,7 +1227,7 @@ fn test_android(target: &str) {
1204
1227
} ;
1205
1228
let x86 = target. contains ( "i686" ) || target. contains ( "x86_64" ) ;
1206
1229
1207
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
1230
+ let mut cfg = ctest_cfg ( ) ;
1208
1231
cfg. define ( "_GNU_SOURCE" , None ) ;
1209
1232
1210
1233
headers ! { cfg:
@@ -1429,7 +1452,7 @@ fn test_android(target: &str) {
1429
1452
1430
1453
fn test_freebsd ( target : & str ) {
1431
1454
assert ! ( target. contains( "freebsd" ) ) ;
1432
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
1455
+ let mut cfg = ctest_cfg ( ) ;
1433
1456
1434
1457
let freebsd_ver = which_freebsd ( ) ;
1435
1458
@@ -1631,7 +1654,7 @@ fn test_freebsd(target: &str) {
1631
1654
fn test_emscripten ( target : & str ) {
1632
1655
assert ! ( target. contains( "emscripten" ) ) ;
1633
1656
1634
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
1657
+ let mut cfg = ctest_cfg ( ) ;
1635
1658
cfg. define ( "_GNU_SOURCE" , None ) ; // FIXME: ??
1636
1659
1637
1660
headers ! { cfg:
@@ -1852,17 +1875,19 @@ fn test_linux(target: &str) {
1852
1875
}
1853
1876
1854
1877
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" ) ;
1858
1879
let mips = target. contains ( "mips" ) ;
1859
1880
let mips32 = mips && !target. contains ( "64" ) ;
1860
- let mips64 = mips && target. contains ( "64" ) ;
1861
1881
let mips32_musl = mips32 && musl;
1862
- let sparc64 = target. contains ( "sparc64" ) ;
1882
+ let mips64 = mips && target. contains ( "64" ) ;
1883
+ let ppc64 = target. contains ( "powerpc64" ) ;
1863
1884
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" ) ;
1864
1889
1865
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
1890
+ let mut cfg = ctest_cfg ( ) ;
1866
1891
cfg. define ( "_GNU_SOURCE" , None ) ;
1867
1892
// This macro re-deifnes fscanf,scanf,sscanf to link to the symbols that are
1868
1893
// deprecated since glibc >= 2.29. This allows Rust binaries to link against
@@ -2286,6 +2311,9 @@ fn test_linux(target: &str) {
2286
2311
true
2287
2312
}
2288
2313
2314
+ // FIXME: the call ABI of max_align_t is incorrect on these platforms:
2315
+ "max_align_t" if i686 || mips64 || ppc64 => true ,
2316
+
2289
2317
_ => false ,
2290
2318
} ) ;
2291
2319
@@ -2305,7 +2333,7 @@ fn test_linux_like_apis(target: &str) {
2305
2333
2306
2334
if linux || android || emscripten {
2307
2335
// test strerror_r from the `string.h` header
2308
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
2336
+ let mut cfg = ctest_cfg ( ) ;
2309
2337
cfg. skip_type ( |_| true ) . skip_static ( |_| true ) ;
2310
2338
2311
2339
headers ! { cfg: "string.h" }
@@ -2321,7 +2349,7 @@ fn test_linux_like_apis(target: &str) {
2321
2349
if linux || android || emscripten {
2322
2350
// test fcntl - see:
2323
2351
// http://man7.org/linux/man-pages/man2/fcntl.2.html
2324
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
2352
+ let mut cfg = ctest_cfg ( ) ;
2325
2353
2326
2354
if musl {
2327
2355
cfg. header ( "fcntl.h" ) ;
@@ -2351,7 +2379,7 @@ fn test_linux_like_apis(target: &str) {
2351
2379
2352
2380
if linux || android {
2353
2381
// test termios
2354
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
2382
+ let mut cfg = ctest_cfg ( ) ;
2355
2383
cfg. header ( "asm/termbits.h" ) ;
2356
2384
cfg. skip_type ( |_| true )
2357
2385
. skip_static ( |_| true )
@@ -2368,7 +2396,7 @@ fn test_linux_like_apis(target: &str) {
2368
2396
2369
2397
if linux || android {
2370
2398
// test IPV6_ constants:
2371
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
2399
+ let mut cfg = ctest_cfg ( ) ;
2372
2400
headers ! {
2373
2401
cfg:
2374
2402
"linux/in6.h"
@@ -2399,7 +2427,7 @@ fn test_linux_like_apis(target: &str) {
2399
2427
// These types have a field called `p_type`, but including
2400
2428
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
2401
2429
// making the tests for these fails when both are included.
2402
- let mut cfg = ctest :: TestGenerator :: new ( ) ;
2430
+ let mut cfg = ctest_cfg ( ) ;
2403
2431
cfg. header ( "elf.h" ) ;
2404
2432
cfg. skip_fn ( |_| true )
2405
2433
. skip_static ( |_| true )
0 commit comments