Re: [PATCH] kbuild: compute false-positive -Wmaybe-uninitialized cases in Kconfig

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 21, 2019 at 5:14 AM Masahiro Yamada
<yamada.masahiro@xxxxxxxxxxxxx> wrote:
>
> Since -Wmaybe-uninitialized was introduced by GCC 4.7, we have patched
> various false positives:
>
>  - commit e74fc973b6e5 ("Turn off -Wmaybe-uninitialized when building
>    with -Os") turned off this option for -Os.
>
>  - commit 815eb71e7149 ("Kbuild: disable 'maybe-uninitialized' warning
>    for CONFIG_PROFILE_ALL_BRANCHES") turned off this option for
>    CONFIG_PROFILE_ALL_BRANCHES
>
>  - commit a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning
>    for "make W=1"") turned off this option for GCC < 4.9
>    Arnd provided more explanation in https://lkml.org/lkml/2017/3/14/903
>
> I think this looks better by shifting the logic from Makefile to Kconfig.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>

I like how this cleans up the logic and documents it better.
I've had my own plans to move this (and most other conditional warning
options) into a header file using the KBUILD_WARN() infrastructure, but
never got around to doing that. I still think that's what we want eventually,
but in the meantime your patch seems fine as well.

Also, I see that your patch keeps the existing logic, which is good,
but we may want to refine this a little afterwards:

- we may want to turn off -Wuninitialized for gcc-4.6 and gcc-4.7
  instead of turning off -Wmaybe-uninitialized as we do in the later
  compilers.

- the proposed CC_OPTIMIZE_FOR_DEBUGGING may need the
  same workaround as CC_OPTIMZE_FOR_SIZE.

- For clang, we may want to /not/ turn off -Wmaybe-uninitialized
  in all cases. I haven't tried build with with 'clang -Oz
  -Wmaybe-uninitialized', but if the number of false positives is small
  enough, we could decide to just leave that on.

      Arnd



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux