Re: Conflict between sparse and commit cafa0010cd51f ("Raise the minimum required gcc version to 4.6")

From: Nick Desaulniers
Date: Fri Sep 07 2018 - 13:23:12 EST


On Fri, Sep 7, 2018 at 7:34 AM Christophe LEROY <christophe.leroy@xxxxxx> wrote:
>
> Cc linux-sparse@xxxxxxxxxxxxxxx
>
> Le 07/09/2018 Ã 14:22, Christophe Leroy a Ãcrit :
> > Since commit cafa0010cd51f ("Raise the minimum required gcc version to
> > 4.6"), sparse check fails as follows:
> >
> > [root@pc16082vm linux-powerpc]# make C=2 arch/powerpc/kernel/process.o
> > CALL scripts/checksyscalls.sh
> > CHECK scripts/mod/empty.c
> > ./include/linux/compiler-gcc.h:14:3: error: Sorry, your compiler is too
> > old - please upgrade it.
> > CHECK arch/powerpc/kernel/process.c
> > ./include/linux/compiler-gcc.h:14:3: error: Sorry, your compiler is too
> > old - please upgrade it.
> >
> >
> > I have sparse version 0.5.2
> >
> > What can be done to fix that ?
> >
> > Christophe

Oof, sorry Christophe. Looks like that's the latest version of sparse:
https://sparse.wiki.kernel.org/index.php/Main_Page#News

I'm curious what sparse expands __GNUC__, __GNUC_MINOR__, and
__GNUC_PATCHLEVEL__ to? Pre commit cafa0010cd51f, it MUST be
expanding them to something, otherwise you'd have seen the error then,
too. The previous check was GCC < 3.3, now it's GCC < 4.6.

We could change the check to:

-#if GCC_VERSION < 40600
+#if GCC_VERSION < 40600 && !defined(__CHECKER__)

But it would be good to know what those sub macros that compose
GCC_VERSION evaluate to in sparse; maybe they can be upgraded in
Sparse unless they're matching __builtin_*() compatability?
--
Thanks,
~Nick Desaulniers