[PATCH] [v2] Kbuild: move to -std=gnu11

Arnd Bergmann arnd at kernel.org
Mon Feb 28 03:37:37 PST 2022


On Mon, Feb 28, 2022 at 12:25 PM Mark Rutland <mark.rutland at arm.com> wrote:
> On Mon, Feb 28, 2022 at 11:27:43AM +0100, Arnd Bergmann wrote:
> >
> > Nathan Chancellor reported an additional -Wdeclaration-after-statement
> > warning that appears in a system header on arm, this still needs a
> > workaround.
>
> FWIW, I had a go at moving to c99 a few weeks ago (to be able to use
> for-loop-declarations in some concurrency primitives), and when I tried, I also
> saw declaration-after-statement warnings when building modpost.c, which is easy
> enough to fix:
>
>   https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?h=treewide/gnu99&id=505775bd6fd0bc1883f3271f826963066bbdc194

I think the KBUILD_USERCFLAGS portion and the modpost.c fix for it
make sense regardless of the -std=gnu11 change, but your change
to KBUILD_CFLAGS is not actually needed because the warning is
already enabled there -- gnu89 allows intermingled declarations since
gcc-3.4, so the warning flag was added during early 2.6.x kernels.

       Arnd



More information about the linux-arm-kernel mailing list