[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a1GmRqPTXFCoLH9h1sP76a-bVRsGYP-YvczoXM4Na3OVQ@mail.gmail.com>
Date: Wed, 18 May 2022 08:46:45 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Greg KH <gregkh@...uxfoundation.org>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Arnd Bergmann <arnd@...db.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Masahiro Yamada <masahiroy@...nel.org>,
clang-built-linux <llvm@...ts.linux.dev>,
Jonathan Corbet <corbet@....net>,
Federico Vaga <federico.vaga@...a.pv.it>,
Alex Shi <alexs@...nel.org>, Hu Haowen <src.res@...il.cn>,
Michal Marek <michal.lkml@...kovi.net>,
Nick Desaulniers <ndesaulniers@...gle.com>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-doc-tw-discuss@...ts.sourceforge.net,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Intel Graphics <intel-gfx@...ts.freedesktop.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
greybus-dev@...ts.linaro.org, linux-staging@...ts.linux.dev,
linux-btrfs <linux-btrfs@...r.kernel.org>
Subject: Re: [greybus-dev] Re: [PATCH] [v2] Kbuild: move to -std=gnu11
On Mon, May 16, 2022 at 3:19 PM Guenter Roeck <linux@...ck-us.net> wrote:
> On 5/16/22 06:31, Greg KH wrote:
> > On Mon, May 16, 2022 at 06:10:23AM -0700, Guenter Roeck wrote:
> >> On Mon, Feb 28, 2022 at 11:27:43AM +0100, Arnd Bergmann wrote:
> >>> From: Arnd Bergmann <arnd@...db.de>
> >>>
> >>> During a patch discussion, Linus brought up the option of changing
> >>> the C standard version from gnu89 to gnu99, which allows using variable
> >>> declaration inside of a for() loop. While the C99, C11 and later standards
> >>> introduce many other features, most of these are already available in
> >>> gnu89 as GNU extensions as well.
> >>
> >> The downside is that backporting affected patches to older kernel branches
> >> now fails with error messages such as
> >>
> >> mm/kfence/core.c: In function ‘kfence_init_pool’:
> >> mm/kfence/core.c:595:2: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
> >>
> >> Just something to keep in mind when writing patches.
> >
> > I just ran across this very issue on this commit. It's an easy fixup
> > for 5.17.y to make this work, so I did that in my tree. If this gets to
> > be too much, we might need to reconsider adding c11 to older stable
> > kernels.
> >
>
> I think I'll do just that for ChromeOS; I don't want to have to deal
> with the backports, and we are using recent compilers anyway.
I think it would be better not to have the --std=gnu11 change in the older
stable kernels by default, as this has introduced build warnings and other
smaller issues, as well as raising the minimum compiler version.
The users that are stuck on older kernels for some reason tend to
overlap with those on older compilers. One example here is Android,
which used to ship with a gcc-4.9 build as the only non-clang toolchain,
and was using this for building their kernels. If someone wants to
pull in stable updates into an older Android, this would fail with
-std=gnu11. Others may be in the same situation.
Changing some of the 5.x stable branches to -std=gnu11 is probably
less of a problem, but I would not know where to draw the line exactly.
Maybe check with the Android team to see what the newest kernel is
that they expect to be built with the old gcc-4.9.
Arnd
Powered by blists - more mailing lists