[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiyq84MKRd1F4d8SGTcTgdd3ktwPr7_9s8tjgKRx_+2kA@mail.gmail.com>
Date: Mon, 13 Sep 2021 12:40:41 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Kees Cook <keescook@...omium.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] treewide: Remove unnamed static initializations to 0
On Fri, Sep 10, 2021 at 3:52 PM Kees Cook <keescook@...omium.org> wrote:
>
> Since "= { 0 }" and "= { }" have the same meaning ("incomplete
> initializer") they will both initialize the given variable to zero
> (modulo padding games).
>
> After this change, I can almost build the "allmodconfig" target with
> GCC 4.9 again.
>
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
> With this patch and the following three, I can build with gcc 4.9 again:
> https://lore.kernel.org/lkml/20210910223332.3224851-1-keescook@chromium.org/
> https://lore.kernel.org/lkml/20210910223409.3225001-1-keescook@chromium.org/
> https://lore.kernel.org/lkml/20210910223613.3225685-1-keescook@chromium.org/
> I look forward to raising our minimum GCC version again! :)
So this was one of the patches I left in my pending queue, and I don't
exactly hate it, but given the option to just say "don't use gcc-4.9"
and applying this big patch, I did the former.
That said, one of the reasons I didn't like the patch that much is
that it seems to be a mindless "just search-and-replace everything",
very much for initializers that didn't complain even with gcc-4.9, and
that were entirely correct.
I would _not_ mind a patch that actually fixed only the places where
it actually _is_ a question of missing braces, and we have an unnamed
union or something like that.
So some of the gcc-4.9 warnings certainly looked at least _somewhat_
reasonable for a compiler that didn't do unnamed unions or structures
very well.
And I wouldn't mind replacing those. But this patch seems to then
change entirely correct code that no reasonable compiler could
possibly warn about. I wonder if some coccinelle script or other would
find a much more reasonable subset?
With the gcc-4.9 support being dropped, that probably doesn't matter
any more, of course. But I just wanted to say that I didn't hate the
patch, but that it seemed to be too much of an automated hammer for
the problem that could be solved a lot more surgically.
The three remaining patches you point at look interesting, although I
think that third one looks decidedly odd. Why not add the 'const' in
the callers instead of removing it from the function? And why don't I
see those warnings - is this some compiler bug?
Linus
Powered by blists - more mailing lists