Re: [PATCH v2] rust: add mark_used macro
flat view
From: FUJITA Tomonori <hidden>
Date: 2026-10-01 12:04:11
Also in:
rust-for-linux
On Thu, 1 Oct 2026 11:05:52 +0000 Alice Ryhl [off-list ref] wrote:
On Wed, Sep 30, 2026 at 06:50:28PM +0900, FUJITA Tomonori wrote:quoted
quoted
diff --git a/rust/kernel/tracepoint.rs b/rust/kernel/tracepoint.rs index c6e80aa99e8e..29d2d2d0aca8 100644 --- a/rust/kernel/tracepoint.rs +++ b/rust/kernel/tracepoint.rs@@ -38,9 +38,7 @@ macro_rules! declare_trace { #[cfg(not(CONFIG_TRACEPOINTS))] { - // If tracepoints are disabled, insert a trivial use of each argument - // to avoid unused argument warnings. - $( let _unused = $argname; )* + $crate::mark_used!($($argname),*); } } )*}Gentle ping. Could you take a look at the tracepoint.rs part? If it looks fine, I think it is easiest to take the patch through the Rust tree.Why are we adding this macro? I think it's better to prefer avoiding macros if we can. The current code is familiar to people who know Rust idioms, and now you are replacing it with a kernel-specific macro that such people will not be familiar with.
The macro was suggested by Miguel: https://lore.kernel.org/rust-for-linux/CANiq72nWcqd3aSKdPqOSRRQBuwWNW-s2EOscYszQ9kSbmrKxcw@mail.gmail.com/ (local) I think you also have a point. Miguel, what do you think?