@@ -3260,6 +3260,31 @@ fn test_vxworks(target: &str) {
3260
3260
cfg. generate ( "../src/lib.rs" , "main.rs" ) ;
3261
3261
}
3262
3262
3263
+ fn config_gnu_time64 ( target : & str , cfg : & mut ctest:: TestGenerator ) {
3264
+ let gnu = target. contains ( "gnu" ) ;
3265
+ let x32 = target. contains ( "x32" ) ;
3266
+ let riscv = target. contains ( "riscv32" ) ;
3267
+
3268
+ if gnu && & env:: var ( "CARGO_CFG_TARGET_POINTER_WIDTH" ) . unwrap ( ) == "32" && !riscv && !x32 {
3269
+ match env:: var ( "RUST_LIBC_TIME_BITS" ) {
3270
+ Ok ( time_bits) => {
3271
+ if time_bits == "64" || time_bits == "default" {
3272
+ cfg. define ( "_TIME_BITS" , Some ( "64" ) ) ;
3273
+ cfg. define ( "_FILE_OFFSET_BITS" , Some ( "64" ) ) ;
3274
+ cfg. cfg ( "gnu_time64_abi" , None ) ;
3275
+ } else if time_bits != "32" {
3276
+ panic ! ( "Unsupported RUST_LIBC_TIME_BITS value {}" , time_bits)
3277
+ }
3278
+ }
3279
+ Err ( _) => {
3280
+ cfg. define ( "_TIME_BITS" , Some ( "64" ) ) ;
3281
+ cfg. define ( "_FILE_OFFSET_BITS" , Some ( "64" ) ) ;
3282
+ cfg. cfg ( "gnu_time64_abi" , None ) ;
3283
+ }
3284
+ }
3285
+ }
3286
+ }
3287
+
3263
3288
fn test_linux ( target : & str ) {
3264
3289
assert ! ( target. contains( "linux" ) ) ;
3265
3290
@@ -3302,6 +3327,8 @@ fn test_linux(target: &str) {
3302
3327
// glibc versions older than 2.29.
3303
3328
cfg. define ( "__GLIBC_USE_DEPRECATED_SCANF" , None ) ;
3304
3329
3330
+ config_gnu_time64 ( target, & mut cfg) ;
3331
+
3305
3332
headers ! { cfg:
3306
3333
"ctype.h" ,
3307
3334
"dirent.h" ,
@@ -4433,6 +4460,7 @@ fn test_linux_like_apis(target: &str) {
4433
4460
if linux || android || emscripten {
4434
4461
// test strerror_r from the `string.h` header
4435
4462
let mut cfg = ctest_cfg ( ) ;
4463
+ config_gnu_time64 ( target, & mut cfg) ;
4436
4464
cfg. skip_type ( |_| true ) . skip_static ( |_| true ) ;
4437
4465
4438
4466
headers ! { cfg: "string.h" }
@@ -4449,6 +4477,7 @@ fn test_linux_like_apis(target: &str) {
4449
4477
// test fcntl - see:
4450
4478
// http://man7.org/linux/man-pages/man2/fcntl.2.html
4451
4479
let mut cfg = ctest_cfg ( ) ;
4480
+ config_gnu_time64 ( target, & mut cfg) ;
4452
4481
4453
4482
if musl {
4454
4483
cfg. header ( "fcntl.h" ) ;
@@ -4478,6 +4507,7 @@ fn test_linux_like_apis(target: &str) {
4478
4507
if linux || android {
4479
4508
// test termios
4480
4509
let mut cfg = ctest_cfg ( ) ;
4510
+ config_gnu_time64 ( target, & mut cfg) ;
4481
4511
cfg. header ( "asm/termbits.h" ) ;
4482
4512
cfg. header ( "linux/termios.h" ) ;
4483
4513
cfg. skip_type ( |_| true )
@@ -4502,6 +4532,7 @@ fn test_linux_like_apis(target: &str) {
4502
4532
if linux || android {
4503
4533
// test IPV6_ constants:
4504
4534
let mut cfg = ctest_cfg ( ) ;
4535
+ config_gnu_time64 ( target, & mut cfg) ;
4505
4536
headers ! {
4506
4537
cfg:
4507
4538
"linux/in6.h"
@@ -4533,6 +4564,7 @@ fn test_linux_like_apis(target: &str) {
4533
4564
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
4534
4565
// making the tests for these fails when both are included.
4535
4566
let mut cfg = ctest_cfg ( ) ;
4567
+ config_gnu_time64 ( target, & mut cfg) ;
4536
4568
cfg. header ( "elf.h" ) ;
4537
4569
cfg. skip_fn ( |_| true )
4538
4570
. skip_static ( |_| true )
@@ -4552,6 +4584,7 @@ fn test_linux_like_apis(target: &str) {
4552
4584
if linux || android {
4553
4585
// Test `ARPHRD_CAN`.
4554
4586
let mut cfg = ctest_cfg ( ) ;
4587
+ config_gnu_time64 ( target, & mut cfg) ;
4555
4588
cfg. header ( "linux/if_arp.h" ) ;
4556
4589
cfg. skip_fn ( |_| true )
4557
4590
. skip_static ( |_| true )
0 commit comments