[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6b3e4d3bdc9b6efd69068e5b22cfd05d370aed19.camel@tugraz.at>
Date: Fri, 21 Feb 2025 19:31:11 +0100
From: Martin Uecker <uecker@...raz.at>
To: Linus Torvalds <torvalds@...ux-foundation.org>, Steven Rostedt
<rostedt@...dmis.org>
Cc: Dan Carpenter <dan.carpenter@...aro.org>, Greg KH
<gregkh@...uxfoundation.org>, Boqun Feng <boqun.feng@...il.com>, "H. Peter
Anvin" <hpa@...or.com>, Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
Christoph Hellwig <hch@...radead.org>, rust-for-linux
<rust-for-linux@...r.kernel.org>, David Airlie <airlied@...il.com>,
linux-kernel@...r.kernel.org, ksummit@...ts.linux.dev
Subject: Re: Rust kernel policy
Am Freitag, dem 21.02.2025 um 10:07 -0800 schrieb Linus Torvalds:
> On Fri, 21 Feb 2025 at 09:42, Steven Rostedt <rostedt@...dmis.org> wrote:
> >
> > Because they are arcane and even the gcc documentation recommends avoiding
> > them.
> >
> > "Note that in general we do not recommend the use of pragmas"
> > https://gcc.gnu.org/onlinedocs/gcc/Pragmas.html
>
> Yeah, #pragma is complete garbage and should never be used. It's a
> fundamentally broken feature because it doesn't work AT ALL with a
> very core piece of C infrastructure: the pre-processor.
>
> Now, we all hopefully know that the C pre-processor is the _real_
> fundamental problem here in how limited it is, but it is what it is.
> Given the fact of how weak C pre-processing is, adding a feature like
> #pragma was a complete failure.
Isn't this what _Pragma() is for?
>
> So gcc - and other compilers - have figured out alternatives to pragma
> that actually work within the context of the C pre-processor. The main
> one tends to be to use __attribute__(()) to give magical extra
> context.
The issue with __attribute__ is that it is always tied to a specific
syntactic construct. Possible it could be changed, but then I do
not see a major difference to _Pragma, or?
...[Linus' rant]...
>
> This is non-negotiable. Anybody who thinks that a compiler is valid
> warning about
>
> if (x < 0 || x >= 10) {
>
> just because 'x' may in some cases be an unsigned entity is not worth
> even discussing with.
Do you think the warning is useless in macros, or in general?
Martin
Powered by blists - more mailing lists