From 3d104417d3d35f7ad482076aca0864cf0ad42f24 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Mon, 28 Jul 2025 11:12:02 +0000 Subject: [PATCH 1/2] l4re: Move `pthread_attr_t` into `s!` Resolve the `improper_ctypes` warning on l4re-uclibc that we are getting in CI. The current version was added in e412497d3e0d ("Move L4Re-specific code into separate module.") and doesn't seem to have been intentional. --- .../linux_like/linux/uclibc/x86_64/l4re.rs | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs b/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs index 380077711d797..536c716ca4868 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs @@ -26,22 +26,21 @@ s! { /// Bitmap of CPUs. map: l4_umword_t, } -} -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub struct pthread_attr_t { - pub __detachstate: c_int, - pub __schedpolicy: c_int, - pub __schedparam: super::__sched_param, - pub __inheritsched: c_int, - pub __scope: c_int, - pub __guardsize: size_t, - pub __stackaddr_set: c_int, - pub __stackaddr: *mut c_void, // better don't use it - pub __stacksize: size_t, - // L4Re specifics - pub affinity: l4_sched_cpu_set_t, - pub create_flags: c_uint, + pub struct pthread_attr_t { + pub __detachstate: c_int, + pub __schedpolicy: c_int, + pub __schedparam: super::__sched_param, + pub __inheritsched: c_int, + pub __scope: c_int, + pub __guardsize: size_t, + pub __stackaddr_set: c_int, + pub __stackaddr: *mut c_void, // better don't use it + pub __stacksize: size_t, + // L4Re specifics + pub affinity: l4_sched_cpu_set_t, + pub create_flags: c_uint, + } } // L4Re requires a min stack size of 64k; that isn't defined in uClibc, but From 8fa09ee1daa791733a91301ef85f94779a4c1208 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sat, 26 Jul 2025 01:27:28 -0500 Subject: [PATCH 2/2] Don't allow `improper_ctypes` Most of what this crate does is interact with C, so the lint should be useful. It can be disabled on a case-by-case basis as needed. There are a few fixes needed for enums, which will be going away anyway (rust-lang/libc#4419). Additionally, switch the `bad_style` lint to the newer name `nonstandard_style`. --- src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5c1a0020517a6..ea8fc1172d65c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,9 +4,8 @@ #![allow( renamed_and_removed_lints, // Keep this order. unknown_lints, // Keep this order. - bad_style, + nonstandard_style, overflowing_literals, - improper_ctypes, unused_macros, unused_macro_rules, )]