ITADN

chore(deps): inline cfg-if as a local macro

#696OpenJonasKruckenberg 创建于 2026-04-08
dependencies
## Summary `cfg-if v1.0.4` is used in ~10 places across `kernel/` and `libs/` for conditional compilation blocks. The entire crate is 212 lines — a single `macro_rules!` definition. ## Why remove it It exists solely to make nested `#[cfg]` chains more ergonomic. Modern Rust handles most of these cases natively, and for the few places that genuinely benefit from the macro style, we can inline it into `kutil`. ## Usage sites ``` kernel/src/arch/riscv64/setjmp_longjmp.rs (×2) kernel/src/arch/mod.rs kernel/src/tracing/writer.rs kernel/src/main.rs libs/unwind/src/arch/mod.rs libs/unwind/src/arch/aarch64.rs (×3) libs/unwind/src/arch/riscv64.rs ``` ## Action 1. For simple two-branch cases, rewrite as plain `#[cfg]` / `#[cfg(not(...))]` attribute pairs. 2. For genuinely multi-branch chains, add a `cfg_if!` macro to `kutil` (copying the ~20 lines of actual logic from the crate). 3. Remove `cfg-if` from all `Cargo.toml` files. ## Impact Removes 1 external crate. Zero runtime impact (compile-time macro only).
0 条评论