diff mbox series

[v1,1/1] Makefile.extrawarn: Turn off -Werror when extra warnings are enabled

Message ID 20220325131348.3995-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v1,1/1] Makefile.extrawarn: Turn off -Werror when extra warnings are enabled | expand

Commit Message

Andy Shevchenko March 25, 2022, 1:13 p.m. UTC
When `make W=1 ...` is executed the level 1 warnings become errors,
due to recent change in some of the defconfigs, and fail the build.
Since there are a lot of warnings on the level 1 are still present
in the defconfigs at least for x86, let disable -Werror in such case.

Fixes: b9080ba4a6ec ("x86/defconfig: Enable WERROR")
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 scripts/Makefile.extrawarn | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Masahiro Yamada March 25, 2022, 2:34 p.m. UTC | #1
On Fri, Mar 25, 2022 at 10:13 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> When `make W=1 ...` is executed the level 1 warnings become errors,
> due to recent change in some of the defconfigs, and fail the build.
> Since there are a lot of warnings on the level 1 are still present
> in the defconfigs at least for x86, let disable -Werror in such case.


commit b339ec9c229aaf399296a120d7be0e34fbc355ca
made WERROR default to COMPILE_TEST.

WERROR should not be enabled for regular builds.

b9080ba4a6ec should be reverted.





> Fixes: b9080ba4a6ec ("x86/defconfig: Enable WERROR")
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  scripts/Makefile.extrawarn | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 650d0b8ceec3..c81d74ef6c90 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -94,3 +94,10 @@ KBUILD_CFLAGS += $(call cc-option, -Wpacked-bitfield-compat)
>  KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN3
>
>  endif
> +
> +#
> +# Turn off -Werror when extra warnings are enabled
> +#
> +ifneq ($(KBUILD_EXTRA_WARN),)
> +       KBUILD_CFLAGS += -Wno-error
> +endif
> --
> 2.35.1
>
Andy Shevchenko March 25, 2022, 2:53 p.m. UTC | #2
On Fri, Mar 25, 2022 at 11:34:06PM +0900, Masahiro Yamada wrote:
> On Fri, Mar 25, 2022 at 10:13 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > When `make W=1 ...` is executed the level 1 warnings become errors,
> > due to recent change in some of the defconfigs, and fail the build.
> > Since there are a lot of warnings on the level 1 are still present
> > in the defconfigs at least for x86, let disable -Werror in such case.
> 
> 
> commit b339ec9c229aaf399296a120d7be0e34fbc355ca
> made WERROR default to COMPILE_TEST.
> 
> WERROR should not be enabled for regular builds.
> 
> b9080ba4a6ec should be reverted.

Hmm... works for me, but have you read this discussion:

https://lore.kernel.org/r/YjsCpoRK7W4l6tSh@zn.tnic

?
Linus Torvalds March 25, 2022, 5:18 p.m. UTC | #3
On Fri, Mar 25, 2022 at 6:13 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> +#
> +# Turn off -Werror when extra warnings are enabled
> +#
> +ifneq ($(KBUILD_EXTRA_WARN),)
> +       KBUILD_CFLAGS += -Wno-error
> +endif

NAK.

If you enabled CONFIG_WERROR, then you get CONFIG_WERROR.

If you enabled W=1, then you get extra warnings.

If you enabled both, then you get extra warnings and they are errors.

This patch is just stupid.

              Linus
Linus Torvalds March 25, 2022, 5:20 p.m. UTC | #4
On Fri, Mar 25, 2022 at 7:35 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> WERROR should not be enabled for regular builds.

No.

WERROR should be on for regular builds.

It's W=1 that is questionable. It enables warnings that are often
false positives, and if you use W=1 (and particularly W=2) then that's
_your_ problem.

W=1 is most definitely not "regular builds". It's only for people who
want to deal with crazy compiler warnings.

I want WERROR on as widely as possible, because I'm really sick and
tired of developers not noticing when they add warnings because they
did a "regular build"

Stop this idiocy where you think warnings are acceptable.

                Linus
Andy Shevchenko March 25, 2022, 5:51 p.m. UTC | #5
On Fri, Mar 25, 2022 at 10:18:06AM -0700, Linus Torvalds wrote:
> On Fri, Mar 25, 2022 at 6:13 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > +#
> > +# Turn off -Werror when extra warnings are enabled
> > +#
> > +ifneq ($(KBUILD_EXTRA_WARN),)
> > +       KBUILD_CFLAGS += -Wno-error
> > +endif
> 
> NAK.
> 
> If you enabled CONFIG_WERROR, then you get CONFIG_WERROR.
> 
> If you enabled W=1, then you get extra warnings.
> 
> If you enabled both, then you get extra warnings and they are errors.
> 
> This patch is just stupid.

Fair enough.
kernel test robot March 25, 2022, 8:01 p.m. UTC | #6
Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.17 next-20220325]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/Makefile-extrawarn-Turn-off-Werror-when-extra-warnings-are-enabled/20220325-211517
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 34af78c4e616c359ed428d79fe4758a35d2c5473
config: x86_64-randconfig-a012 (https://download.01.org/0day-ci/archive/20220326/202203260359.nhs6ZZb9-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/6b5eeef1471c693165f2bdec5fb19c2ba20e9345
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/Makefile-extrawarn-Turn-off-Werror-when-extra-warnings-are-enabled/20220325-211517
        git checkout 6b5eeef1471c693165f2bdec5fb19c2ba20e9345
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> clang-15: warning: 'x86_64' does not support '-mno-outline-atomics'; flag ignored [-Woption-ignored]
diff mbox series

Patch

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 650d0b8ceec3..c81d74ef6c90 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -94,3 +94,10 @@  KBUILD_CFLAGS += $(call cc-option, -Wpacked-bitfield-compat)
 KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN3
 
 endif
+
+#
+# Turn off -Werror when extra warnings are enabled
+#
+ifneq ($(KBUILD_EXTRA_WARN),)
+	KBUILD_CFLAGS += -Wno-error
+endif