linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	clang-built-linux <llvm@lists.linux.dev>,
	Jonathan Corbet <corbet@lwn.net>,
	Federico Vaga <federico.vaga@vaga.pv.it>,
	Alex Shi <alexs@kernel.org>, Hu Haowen <src.res@email.cn>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-doc-tw-discuss@lists.sourceforge.net,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Intel Graphics <intel-gfx@lists.freedesktop.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
	linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [greybus-dev] Re: [PATCH] [v2] Kbuild: move to -std=gnu11
Date: Wed, 18 May 2022 07:07:31 -0700	[thread overview]
Message-ID: <47c64195-6629-ba2b-4533-b0fe37518da0@roeck-us.net> (raw)
In-Reply-To: <CAK8P3a1GmRqPTXFCoLH9h1sP76a-bVRsGYP-YvczoXM4Na3OVQ@mail.gmail.com>

On 5/18/22 00:46, Arnd Bergmann wrote:
> On Mon, May 16, 2022 at 3:19 PM Guenter Roeck <linux@roeck-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@arndb.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.
> 

I don't think they still build anything with gcc. We (ChromeOS) only
need it for test builds of chromeos-4.4 (sigh), and that will hopefully
be gone in a couple of months.

We already enabled -std=gnu11 in chromeos-5.10 and chromeos-5.15.
We'll see if that is possible with chromeos-5.4 as well.
We won't bother with older kernel branches, but those should not
get many patches from upstream outside stable release merges,
so it is less of a problem.

Guenter

      reply	other threads:[~2022-05-18 14:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28 10:27 [PATCH] [v2] Kbuild: move to -std=gnu11 Arnd Bergmann
2022-02-28 10:50 ` Greg KH
2022-02-28 11:25 ` Mark Rutland
2022-02-28 11:37   ` Arnd Bergmann
2022-02-28 18:40     ` Linus Torvalds
2022-02-28 17:07   ` Masahiro Yamada
2022-02-28 11:47 ` Marco Elver
2022-02-28 11:57   ` Arnd Bergmann
2022-02-28 16:56     ` Nathan Chancellor
2022-02-28 12:36 ` Jani Nikula
2022-02-28 13:01   ` Arnd Bergmann
2022-02-28 13:19     ` David Sterba
2022-02-28 12:48 ` Alex Shi
2022-02-28 12:56 ` David Sterba
2022-02-28 17:02 ` Masahiro Yamada
2022-02-28 18:24   ` Arnd Bergmann
2022-02-28 21:03 ` Nick Desaulniers
2022-02-28 21:41   ` Fangrui Song
2022-03-01 14:45     ` Arnd Bergmann
2022-03-01 10:43 ` Miguel Ojeda
2022-03-01 14:44   ` Arnd Bergmann
2022-05-16 13:10 ` Guenter Roeck
2022-05-16 13:31   ` [greybus-dev] " Greg KH
2022-05-16 14:19     ` Guenter Roeck
2022-05-18  7:46       ` Arnd Bergmann
2022-05-18 14:07         ` Guenter Roeck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47c64195-6629-ba2b-4533-b0fe37518da0@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=alexs@kernel.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=federico.vaga@vaga.pv.it \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-doc-tw-discuss@lists.sourceforge.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.com \
    --cc=src.res@email.cn \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).