Skip to contentSkip to conversation

Makefile.extrawarn: Turn off -Werror when extra warnings are enabled

PATCH NAK Andy Shevchenko 4 participants 7 messages Mar 25, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile.extrawarn: Turn off -Werror when extra warnings are enabled

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")
---
 scripts/Makefile.extrawarn | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/Makefile.extrawarn +7 -0
index 650d0b8ceec3..c81d74ef6c90 100644
@@ -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
Signature · 1 line
2.35.1
#1 lore raw
Quoted 5 lines · Andy Shevchenko

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.

Quoted 25 lines
Fixes b9080ba4a6ec ("x86/defconfig: Enable WERROR")
---
 scripts/Makefile.extrawarn | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/Makefile.extrawarn +7 -1
index 650d0b8ceec3..c81d74ef6c90 100644
@@ -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

Signature · 2 lines
Best Regards
Masahiro Yamada
#2 lore raw
Quoted 9 lines · Masahiro Yamada
Quoted 5 lines · Andy Shevchenko

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.

Quoted 6 lines

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/[email protected]

?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
In reply to Masahiro Yamada
Quoted 1 line · Masahiro Yamada

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

#4 lore raw
In reply to Andy Shevchenko

scripts/Makefile.extrawarn KBUILD_CFLAGS += $(call cc-option, -Wpacked-bitfield-compat) · line 103

Quoted 7 lines · Andy Shevchenko
scripts/Makefile.extrawarn +6 -0
+#
+# 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

#5 lore raw
Quoted 12 lines · Linus Torvalds

scripts/Makefile.extrawarn KBUILD_CFLAGS += $(call cc-option, -Wpacked-bitfield-compat) · line 103

Quoted 7 lines · Andy Shevchenko
scripts/Makefile.extrawarn +6 -0
+#
+# Turn off -Werror when extra warnings are enabled
+#
+ifneq ($(KBUILD_EXTRA_WARN),)
+       KBUILD_CFLAGS += -Wno-error
+endif

NAK.

Quoted 7 lines

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.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw
In reply to Andy Shevchenko
I love your patch! Perhaps something to improve:

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/[email protected]/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

All warnings (new ones prefixed by >>):

>> clang-15: warning: 'x86_64' does not support '-mno-outline-atomics'; flag ignored [-Woption-ignored]
Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp