From 1dc45653313031f080bfbade4af8460b5bbed48c Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 18 Nov 2026 12:20:13 -0800 Subject: [PATCH] devtools: the kernel CPU list's parse is Linux's, built only with the Linux counters that read it cpu_list (from dd8d1fdf7b) has two callers: the Linux counters' unit lookup and its own unit test. Off Linux neither is built, so macOS and Windows builds under -Dwarnings failed on dead code ("function `cpu_list` is never used", KosmicKrisp M3 build 47812). The function and its test now carry the Linux counters' own cfg, all(target_os = "linux", target_endian = "little"); raw_event stays on every platform, as ProcessEvent::new parses the name before it answers Unsupported. Checked by clippy of metal2vulkan-devtools, all targets and features, -D warnings, on macOS (M3) and on Linux. --- crates/metal2vulkan-devtools/src/instructions.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/metal2vulkan-devtools/src/instructions.rs b/crates/metal2vulkan-devtools/src/instructions.rs index 89ae03ef1..153b88d6c 100644 --- a/crates/metal2vulkan-devtools/src/instructions.rs +++ b/crates/metal2vulkan-devtools/src/instructions.rs @@ -296,7 +296,9 @@ fn raw_event(name: &str) -> io::Result<(&str, u64)> { Ok((unit, config)) } -/// The CPUs of a kernel CPU list (`0-11,16`). +/// The CPUs of a kernel CPU list (`0-11,16`), as Linux lists a unit's CPUs: read only where the +/// counters are Linux's. +#[cfg(all(target_os = "linux", target_endian = "little"))] fn cpu_list(text: &str) -> io::Result> { let invalid = || { io::Error::new( @@ -519,7 +521,7 @@ mod linux { #[cfg(test)] mod names { - use super::{cpu_list, raw_event}; + use super::raw_event; /// A raw event's name gives its unit and config, `cpu` where it names none; a trailing `/`, /// `/u` or `:u` is taken; anything else is refused. @@ -547,8 +549,10 @@ mod names { } /// A kernel CPU list gives its CPUs in order; a list of another form is refused. + #[cfg(all(target_os = "linux", target_endian = "little"))] #[test] fn a_cpu_list_gives_its_cpus() { + use super::cpu_list; assert_eq!( cpu_list("0-3,8,10-11\n").expect("a list"), [0, 1, 2, 3, 8, 10, 11]