Skip to content

Commit b354390

Browse files
Fix style
2 parents 4c7bd69 + 266e0d7 commit b354390

File tree

82 files changed

+687
-3520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+687
-3520
lines changed

.github/workflows/ci.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ jobs:
9898
artifact-tag: offset-bits64
9999
env:
100100
RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS: 64
101+
- target: i686-unknown-linux-gnu
102+
docker: true
103+
os: ubuntu-24.04
104+
artifact-tag: time-bits64
105+
env:
106+
RUST_LIBC_UNSTABLE_GNU_TIME_BITS: 64
101107
- target: x86_64-unknown-linux-gnu
102108
docker: true
103109
os: ubuntu-24.04
@@ -171,7 +177,8 @@ jobs:
171177
- aarch64-unknown-linux-musl
172178
- arm-linux-androideabi
173179
- arm-unknown-linux-musleabihf
174-
- i686-linux-android
180+
# FIXME(#4297): Disabled due to spurious failueSome android jobs are disabled because of high rates of
181+
# - i686-linux-android
175182
- i686-unknown-linux-musl
176183
- loongarch64-unknown-linux-gnu
177184
- loongarch64-unknown-linux-musl
@@ -195,6 +202,10 @@ jobs:
195202
env:
196203
RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS: 64
197204
artifact-tag: offset-bits64
205+
- target: arm-unknown-linux-gnueabihf
206+
env:
207+
RUST_LIBC_UNSTABLE_GNU_TIME_BITS: 64
208+
artifact-tag: time-bits64
198209
- target: aarch64-unknown-linux-musl
199210
env:
200211
RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1
@@ -214,6 +225,10 @@ jobs:
214225
# env:
215226
# RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS: 64
216227
# artifact-tag: offset-bits64
228+
# - target: powerpc-unknown-linux-gnu
229+
# env:
230+
# RUST_LIBC_UNSTABLE_GNU_TIME_BITS: 64
231+
# artifact-tag: time-bits64
217232
timeout-minutes: 25
218233
env:
219234
TARGET: ${{ matrix.target }}
@@ -259,7 +274,7 @@ jobs:
259274
steps:
260275
- uses: actions/checkout@v4
261276
- name: test on Solaris
262-
uses: vmactions/solaris-vm@v1
277+
uses: vmactions/solaris-vm@v1.1.4
263278
with:
264279
release: "11.4-gcc"
265280
usesh: true

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ targets = [
7373
"powerpc-unknown-netbsd",
7474
"powerpc-wrs-vxworks",
7575
"powerpc-wrs-vxworks-spe",
76+
"powerpc64-ibm-aix",
7677
"powerpc64-unknown-freebsd",
7778
"powerpc64-unknown-linux-gnu",
7879
"powerpc64-wrs-vxworks",
@@ -139,6 +140,7 @@ extra_traits = []
139140
[workspace]
140141
members = [
141142
"ctest",
143+
"ctest-next",
142144
"ctest-test",
143145
"libc-test",
144146
]

build.rs

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const ALLOWED_CFGS: &[&str] = &[
1515
"freebsd15",
1616
// Corresponds to `_FILE_OFFSET_BITS=64` in glibc
1717
"gnu_file_offset_bits64",
18+
// Corresponds to `_TIME_BITS=64` in glibc
19+
"gnu_time_bits64",
1820
// FIXME(ctest): this config shouldn't be needed but ctest can't parse `const extern fn`
1921
"libc_const_extern_fn",
2022
"libc_deny_warnings",
@@ -99,23 +101,35 @@ fn main() {
99101
set_cfg("linux_time_bits64");
100102
}
101103
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS");
102-
match env::var("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS") {
103-
Ok(val) if val == "64" => {
104-
if target_env == "gnu"
105-
&& target_os == "linux"
106-
&& target_ptr_width == "32"
107-
&& target_arch != "riscv32"
108-
&& target_arch != "x86_64"
109-
{
104+
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_TIME_BITS");
105+
if target_env == "gnu"
106+
&& target_os == "linux"
107+
&& target_ptr_width == "32"
108+
&& target_arch != "riscv32"
109+
&& target_arch != "x86_64"
110+
{
111+
match env::var("RUST_LIBC_UNSTABLE_GNU_TIME_BITS") {
112+
Ok(val) if val == "64" => {
110113
set_cfg("gnu_file_offset_bits64");
114+
set_cfg("linux_time_bits64");
115+
set_cfg("gnu_time_bits64");
116+
}
117+
Ok(val) if val != "32" => {
118+
panic!("RUST_LIBC_UNSTABLE_GNU_TIME_BITS may only be set to '32' or '64'")
119+
}
120+
_ => {
121+
match env::var("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS") {
122+
Ok(val) if val == "64" => {
123+
set_cfg("gnu_file_offset_bits64");
124+
}
125+
Ok(val) if val != "32" => {
126+
panic!("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS may only be set to '32' or '64'")
127+
}
128+
_ => {}
129+
}
111130
}
112131
}
113-
Ok(val) if val != "32" => {
114-
panic!("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS may only be set to '32' or '64'")
115-
}
116-
_ => {}
117132
}
118-
119133
// On CI: deny all warnings
120134
if libc_ci {
121135
set_cfg("libc_deny_warnings");

ci/run-docker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ run() {
4444
--env LIBC_CI \
4545
--env LIBC_CI_ZBUILD_STD \
4646
--env RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS \
47+
--env RUST_LIBC_UNSTABLE_GNU_TIME_BITS \
4748
--env CARGO_HOME=/cargo \
4849
--env CARGO_TARGET_DIR=/checkout/target \
4950
--volume "$CARGO_HOME":/cargo \

ci/style.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ while IFS= read -r file; do
2626

2727
# Turn all braced macro `foo! { /* ... */ }` invocations into
2828
# `fn foo_fmt_tmp() { /* ... */ }`.
29-
perl -pi -e 's/(?!macro_rules)\b(\w+)!\s*\{/fn $1_fmt_tmp() {/g' "$file"
29+
perl -pi -e 's/(?!macro_rules|c_enum)\b(\w+)!\s*\{/fn $1_fmt_tmp() {/g' "$file"
3030

3131
# Replace `if #[cfg(...)]` within `cfg_if` with `if cfg_tmp!([...])` which
3232
# `rustfmt` will format. We put brackets within the parens so it is easy to

ci/verify-build.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,12 @@ test_target() {
7575
# Test with the equivalent of __USE_TIME_BITS64
7676
RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64=1 $cmd
7777
case "$target" in
78-
# Test with the equivalent of __FILE_OFFSET_BITS=64
7978
arm*-gnu*|i*86*-gnu|powerpc-*-gnu*|mips*-gnu|sparc-*-gnu|thumb-*gnu*)
80-
RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS=64 $cmd;;
79+
# Test with the equivalent of _FILE_OFFSET_BITS=64
80+
RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS=64 $cmd
81+
# Test with the equivalent of _TIME_BITS=64
82+
RUST_LIBC_UNSTABLE_GNU_TIME_BITS=64 $cmd
83+
;;
8184
esac
8285
fi
8386

ctest-next/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "ctest-next"
3+
version = "0.1.0"
4+
edition = "2021"
5+
rust-version = "1.77"
6+
license = "MIT OR Apache-2.0"
7+
repository = "https://github.com/rust-lang/libc"
8+
publish = false
9+
10+
[dependencies]
11+
cc = "1.2.25"
12+
syn = { version = "2.0.101", features = ["full", "visit", "visit-mut", "fold"] }

ctest-next/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pub fn add(left: usize, right: usize) -> usize {
2+
left + right
3+
}
4+
5+
#[cfg(test)]
6+
mod tests {
7+
use super::*;
8+
9+
#[test]
10+
fn it_works() {
11+
let result = add(2, 2);
12+
assert_eq!(result, 4);
13+
}
14+
}

libc-test/build.rs

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,12 @@ fn test_openbsd(target: &str) {
590590

591591
cfg.skip_const(move |name| {
592592
match name {
593-
// Removed in OpenBSD 7.7 (unused since 1991)
593+
// Removed in OpenBSD 7.7
594594
"ATF_COM" | "ATF_PERM" | "ATF_PUBL" | "ATF_USETRAILERS" => true,
595595

596+
// Removed in OpenBSD 7.8
597+
"CTL_FS" | "SO_NETPROC" => true,
598+
596599
_ => false,
597600
}
598601
});
@@ -3615,22 +3618,37 @@ fn test_vxworks(target: &str) {
36153618
}
36163619

36173620
fn config_gnu_bits(target: &str, cfg: &mut ctest::TestGenerator) {
3618-
match env::var("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS") {
3619-
Ok(val) if val == "64" => {
3620-
if target.contains("gnu")
3621-
&& target.contains("linux")
3622-
&& !target.ends_with("x32")
3623-
&& !target.contains("riscv32")
3624-
&& env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "32"
3625-
{
3621+
let pointer_width = env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap_or_default();
3622+
if target.contains("gnu")
3623+
&& target.contains("linux")
3624+
&& !target.ends_with("x32")
3625+
&& !target.contains("riscv32")
3626+
&& pointer_width == "32"
3627+
{
3628+
match env::var("RUST_LIBC_UNSTABLE_GNU_TIME_BITS") {
3629+
Ok(val) if val == "64" => {
36263630
cfg.define("_FILE_OFFSET_BITS", Some("64"));
3631+
cfg.define("_TIME_BITS", Some("64"));
36273632
cfg.cfg("gnu_file_offset_bits64", None);
3633+
cfg.cfg("linux_time_bits64", None);
3634+
cfg.cfg("gnu_time_bits64", None);
3635+
}
3636+
Ok(val) if val != "32" => {
3637+
panic!("RUST_LIBC_UNSTABLE_GNU_TIME_BITS may only be set to '32' or '64'")
3638+
}
3639+
_ => {
3640+
match env::var("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS") {
3641+
Ok(val) if val == "64" => {
3642+
cfg.define("_FILE_OFFSET_BITS", Some("64"));
3643+
cfg.cfg("gnu_file_offset_bits64", None);
3644+
}
3645+
Ok(val) if val != "32" => {
3646+
panic!("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS may only be set to '32' or '64'")
3647+
}
3648+
_ => {}
3649+
}
36283650
}
36293651
}
3630-
Ok(val) if val != "32" => {
3631-
panic!("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS may only be set to '32' or '64'")
3632-
}
3633-
_ => {}
36343652
}
36353653
}
36363654

@@ -3805,6 +3823,8 @@ fn test_linux(target: &str) {
38053823
"linux/can.h",
38063824
"linux/can/raw.h",
38073825
"linux/can/j1939.h",
3826+
"linux/cn_proc.h",
3827+
"linux/connector.h",
38083828
"linux/dccp.h",
38093829
"linux/errqueue.h",
38103830
"linux/falloc.h",
@@ -4625,6 +4645,9 @@ fn test_linux(target: &str) {
46254645
// FIXME(linux): Requires >= 6.4 kernel headers.
46264646
"PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG" | "PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG" => true,
46274647

4648+
// FIXME(linux): Requires >= 6.6 kernel headers.
4649+
"PROC_EVENT_NONZERO_EXIT" => true,
4650+
46284651
_ => false,
46294652
}
46304653
});

libc-test/semver/solarish.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,5 @@ posix_spawnattr_setsigmask
7878
posix_spawnp
7979
recvmsg
8080
sendmsg
81+
strftime
82+
strftime_l

0 commit comments

Comments
 (0)