[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72nu9MrTaQBABxiveqSqX4b9zJZL0MsazG+D64ULQ_Shqg@mail.gmail.com>
Date: Tue, 6 May 2025 12:18:08 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Antonio Hickey <contact@...oniohickey.com>
Cc: a.hindborg@...nel.org, alex.gaynor@...il.com, aliceryhl@...gle.com,
benno.lossin@...ton.me, bjorn3_gh@...tonmail.com, boqun.feng@...il.com,
dakr@...nel.org, gary@...yguo.net, linux-kernel@...r.kernel.org,
ojeda@...nel.org, rust-for-linux@...r.kernel.org, tmgross@...ch.edu
Subject: Re: [PATCH v2 1/1] rust: kernel: create `overflow_assert!`
On Tue, May 6, 2025 at 6:23 AM Antonio Hickey <contact@...oniohickey.com> wrote:
>
> I do like the idea utilizing the `cfg!` macro, it's cleaner as it
> reduces the empty boilerplate currently required. I do wonder though
> could that potentially cause warnings like unreachable code or
> unused variables?
Hmm... Isn't it the other way around? i.e. `#[cfg]` is the one that
completely removes code and thus could introduce cases where no other
code references something.
As for unreachable, I don't think that triggers with an `if false {
... }` (it does with e.g. code after a diverging call).
The `debug_assert!` macro works with `cfg!`, so unless the compiler
does something custom on linting for it, I think it should work for us
here too.
Thanks!
Cheers,
Miguel
Powered by blists - more mailing lists