Re: [MAINTAINERS/KERNEL SUMMIT] Trust and maintenance of file systems

Richard Biener
2023-09-12T09:52:29Z

On Thu, Sep 7, 2023 at 2:32 PM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> On Thu, Sep 07, 2023 at 02:23:00PM +0300, Dan Carpenter wrote:
> > On Thu, Sep 07, 2023 at 06:04:09AM -0500, Segher Boessenkool wrote:
> > > On Thu, Sep 07, 2023 at 12:48:25PM +0300, Dan Carpenter via Gcc-patches wrote:
> > > > I started to hunt
> > > > down all the Makefile which add a -Werror but there are a lot and
> > > > eventually I got bored and gave up.
> > >
> > > I have a patch stack for that, since 2014 or so. I build Linux with
> > > unreleased GCC versions all the time, so pretty much any new warning is
> > > fatal if you unwisely use -Werror.
> > >
> > > > Someone should patch GCC so there it checks an environment variable to
> > > > ignore -Werror. Somethine like this?
> > >
> > > No. You should patch your program, instead.
> >
> > There are 2930 Makefiles in the kernel source.
>
> Yes. And you need patches to about thirty. Or a bit more, if you want
> to do it more cleanly. This isn't a guess.
>
> > > One easy way is to add a
> > > -Wno-error at the end of your command lines. Or even just -w if you
> > > want or need a bigger hammer.
> >
> > I tried that. Some of the Makefiles check an environemnt variable as
> > well if you want to turn off -Werror. It's not a complete solution at
> > all. I have no idea what a complete solution looks like because I gave
> > up.
>
> A solution can not involve changing the compiler. That is just saying
> the kernel doesn't know how to fix its own problems, so let's give the
> compiler some more unnecessary problems.

You can change the compiler by replacing it with a script that appends
-Wno-error
for example.

> > > Or nicer, put it all in Kconfig, like powerpc already has for example.
> > > There is a CONFIG_WERROR as well, so maybe use that in all places?
> >
> > That's a good idea but I'm trying to compile old kernels and not the
> > current kernel.
>
> You can patch older kernels, too, you know :-)
>
> If you need to not make any changes to your source code for some crazy
> reason (political perhaps?), just use a shell script or shell function
> instead of invoking the compiler driver directly?
>
>
> Segher
>
> Segher