[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <22A86237-4168-4D4A-8782-7A65AFAEC44C@gmail.com>
Date: Sat, 7 Sep 2024 15:22:18 -0700
From: comex <comexk@...il.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Alice Ryhl <aliceryhl@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...sung.com>,
Trevor Gross <tmgross@...ch.edu>,
rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org,
patches@...ts.linux.dev
Subject: Re: [PATCH 16/19] Documentation: rust: add coding guidelines on lints
> On Sep 5, 2024, at 2:45 AM, Miguel Ojeda <miguel.ojeda.sandonis@...il.com> wrote:
>
> On Thu, Sep 5, 2024 at 10:16 AM Alice Ryhl <aliceryhl@...gle.com> wrote:
>>
>> Wow, does C really not have an easier way to do it?
>
> Yeah, it would be nice to get a similar system in C.
>
> There are targeted attributes that can annotate certain things, like
> `[[maybe_unused]]` in C23 (and vendor attributes too like our
> `__maybe_unused` macro), so `-Wunused-function` is not really the best
> example in that sense -- I will think of a better one (it was nice to
> use the same as in the other examples I wrote for `expect` later on,
> which is why I used it).
>
> But, as far as I am aware, there is no way to handle lints (and levels
> and so on) in a simple and consistent way like Rust does.
You can always hide the pragmas behind a macro:
https://gcc.godbolt.org/z/WTEaYWW8c
It’s not perfect, because warning names sometimes differ between GCC and Clang, among other reasons.
Powered by blists - more mailing lists