Skip to content

Commit f7b7942

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 951cab5 commit f7b7942

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
@@ -15,6 +15,8 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
1515
"freebsd15",
1616
"libc_deny_warnings",
1717
"libc_ctest",
18+
// Corresponds to `__USE_TIME_BITS64` in UAPI
19+
"linux_time_bits64",
1820
];
1921

2022
// Extra values to allow for check-cfg.
@@ -40,6 +42,7 @@ fn main() {
4042
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
4143
let libc_ci = env::var("LIBC_CI").is_ok();
4244
let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok() || rustc_minor_ver >= 80;
45+
let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();
4346

4447
// The ABI of libc used by std is backward compatible with FreeBSD 12.
4548
// The ABI of libc from crates.io is backward compatible with FreeBSD 12.
@@ -69,6 +72,10 @@ fn main() {
6972
Some(_) | None => (),
7073
}
7174

75+
if linux_time_bits64 {
76+
set_cfg("linux_time_bits64");
77+
}
78+
7279
// On CI: deny all warnings
7380
if libc_ci {
7481
set_cfg("libc_deny_warnings");

ci/verify-build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ test_target() {
6565
$cmd --features const-extern-fn
6666
$cmd --features extra_traits
6767

68+
if [ "$os" = "linux" ]; then
69+
# Test with the equivalent of __USE_TIME_BITS64
70+
RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64=1 $cmd
71+
fi
72+
6873
# Test again without default features, i.e. without "std"
6974
$cmd --no-default-features
7075
$cmd --no-default-features --features extra_traits

0 commit comments

Comments
 (0)