Hi Alice, Steven,

On Wed,  9 Sep 2026 21:02:10 +0900
FUJITA Tomonori <[email protected]> wrote:

> Macros whose expansion depends on the kernel configuration end up
> ignoring some of their arguments, resulting in unused warnings.
> 
> Add a macro for the `if false { _ = ...; }` idiom used to avoid them,
> and convert the existing open-coded users in `warn_flags!` and
> `declare_trace!`.
> 
> Reviewed-by: Gary Guo <[email protected]>
> Signed-off-by: FUJITA Tomonori <[email protected]>
> ---
> v2:
> - Drop the comment in `declare_trace!`. The macro name says the same thing.
> - Add Gary's Reviewed-by.
> - Rebase on rust-next.
> v1: 
> https://lore.kernel.org/rust-for-linux/[email protected]/
> ---
>  rust/kernel/bug.rs        | 18 ++++--------------
>  rust/kernel/lib.rs        | 12 ++++++++++++
>  rust/kernel/tracepoint.rs |  4 +---
>  3 files changed, 17 insertions(+), 17 deletions(-)

(snip)

> 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.

Reply via email to