[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2b_RtXkhQ2pwqbZ1zz6QtjaWwD4em_MCF_wGXRwZirKA@mail.gmail.com>
Date: Wed, 23 Feb 2022 21:48:59 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Arnd Bergmann <arnd@...db.de>, Jakob <jakobkoschel@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-arch <linux-arch@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
Mike Rapoport <rppt@...nel.org>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
Brian Johannesmeyer <bjohannesmeyer@...il.com>,
Cristiano Giuffrida <c.giuffrida@...nl>,
"Bos, H.J." <h.j.bos@...nl>, Nathan Chancellor <nathan@...nel.org>
Subject: Re: [RFC PATCH 03/13] usb: remove the usage of the list iterator
after the loop
On Wed, Feb 23, 2022 at 9:43 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> On Wed, Feb 23, 2022 at 12:25 PM Arnd Bergmann <arnd@...db.de> wrote:
> >
> > I looked at the gcc documentation for this flag, and it tells me that
> > it's default-enabled for std=c99 or higher. Turning it on for --std=gnu89
> > shows the same warning, so at least it doesn't sound like the actual
> > behavior changed, only the warning output. clang does not warn
> > for this code at all, regardless of the --std= flag.
>
> Ok, so we should be able to basically convert '--std=gnu89' into
> '--std=gnu11 -Wno-shift-negative-value' with no expected change of
> behavior.
Yes, I think that is correct.
> Of course, maybe we need to make -Wno-shift-negative-value be
> conditional on the compiler supporting it in the first place?
I think they all do. I discussed this with Nathan Chancellor on IRC, to
see what clang does, and he points out that the warning was made
conditional on -fwrapv there a while ago:
https://github.com/llvm/llvm-project/commit/59802321785b4b9fc31b10456c62ba3a06d3a631
So the normal behavior on clang is to always warn about it, but since
we explicitly ask for sane signed integer behavior, it doesn't warn for
the kernel.
Arnd
Powered by blists - more mailing lists