Skip to content

Commit 5453fe6

Browse files
committed
build.rs: Add linux_time_bits64 to ALLOWED_CFGS
linux_time_bits64 will be used to match __USE_TIME_BITS64 in the uapi headers. The environment variable RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64 can be used by callers to enable the linux_time_bits64 config.
1 parent fe783ce commit 5453fe6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
1717
"libc_const_extern_fn",
1818
"libc_deny_warnings",
1919
"libc_ctest",
20+
// Corresponds to `__USE_TIME_BITS64` in UAPI
21+
"linux_time_bits64",
2022
];
2123

2224
// Extra values to allow for check-cfg.
@@ -42,6 +44,7 @@ fn main() {
4244
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
4345
let libc_ci = env::var("LIBC_CI").is_ok();
4446
let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok() || rustc_minor_ver >= 80;
47+
let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();
4548

4649
// The ABI of libc used by std is backward compatible with FreeBSD 12.
4750
// The ABI of libc from crates.io is backward compatible with FreeBSD 12.
@@ -78,6 +81,10 @@ fn main() {
7881
Some(_) | None => (),
7982
}
8083

84+
if linux_time_bits64 {
85+
set_cfg("linux_time_bits64");
86+
}
87+
8188
// On CI: deny all warnings
8289
if libc_ci {
8390
set_cfg("libc_deny_warnings");

ci/verify-build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ test_target() {
7171
$cmd
7272
$cmd --features extra_traits
7373

74+
if [ "$os" = "linux" ]; then
75+
# Test with the equivalent of __USE_TIME_BITS64
76+
RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64=1 $cmd
77+
fi
78+
7479
# Test again without default features, i.e. without "std"
7580
$cmd --no-default-features
7681
$cmd --no-default-features --features extra_traits

0 commit comments

Comments
 (0)