compiler_attribute: remove CONFIG_ENABLE_MUST_CHECK
Subsystems (5)
PATCH 1/1 compiler_attribute: remove CONFIG_ENABLE_MUST_CHECK
Revert commit cebc04ba9aeb ("add CONFIG_ENABLE_MUST_CHECK").
A lot of warn_unused_result warnings existed in 2006, but until now they have been fixed thanks to people doing allmodconfig tests.
Our goal is to always enable __must_check where appreciate, so this CONFIG option is no longer needed.
I see a lot of defconfig (arch/*/configs/*_defconfig) files having:
# CONFIG_ENABLE_MUST_CHECK is not set
I did not touch them for now since it would be a big churn. If arch maintainers want to clean them up, please go ahead.
---
include/linux/compiler_types.h | 4 ---- lib/Kconfig.debug | 8 -------- tools/testing/selftests/wireguard/qemu/debug.config | 1 - 3 files changed, 13 deletions(-)
include/linux/compiler_types.h +0 -4
@@ -110,11 +110,7 @@ struct ftrace_likely_data {unsigned long constant; }; -#ifdef CONFIG_ENABLE_MUST_CHECK #define __must_check __attribute__((__warn_unused_result__)) -#else -#define __must_check -#endif #if defined(CC_USING_HOTPATCH )#define notrace __attribute__((hotpatch(0, 0)))
lib/Kconfig.debug +0 -8
@@ -286,14 +286,6 @@ config GDB_SCRIPTS endif # DEBUG_INFO -config ENABLE_MUST_CHECK - bool "Enable __must_check logic" - default y - help - Enable the __must_check logic in the kernel build. Disable this to - suppress the "warning: ignoring return value of 'foo', declared with - attribute warn_unused_result" messages. - config FRAME_WARN int "Warn for stack frames larger than" range 0 8192
tools/testing/selftests/wireguard/qemu/debug.config +0 -1
@@ -1,5 +1,4 @@ CONFIG_LOCALVERSION="-debug" -CONFIG_ENABLE_MUST_CHECK=y CONFIG_FRAME_POINTER=y CONFIG_STACK_VALIDATION=y CONFIG_DEBUG_KERNEL=y
Signature · 1 line
2.25.1
Quoted 3 lines · Masahiro Yamada
Our goal is to always enable
__must_checkwhere appreciate, so this CONFIG option is no longer needed.
This would be great. It also implies we can then move it to compiler_attributes.h since it does not depend on config options anymore.
We should also rename it to __nodiscard, since that is the standardized name (coming soon to C2x and in C++ for years).
Cc'ing the Clang folks too to make them aware.
Cheers,
Miguel
Quoted 6 lines · Miguel Ojeda
Quoted 3 lines · Masahiro Yamada
Our goal is to always enable
__must_checkwhere appreciate, so this CONFIG option is no longer needed.
Quoted 9 lines
This would be great. It also implies we can then move it to
compiler_attributes.hsince it does not depend on config options anymore.We should also rename it to
__nodiscard, since that is the standardized name (coming soon to C2x and in C++ for years).Cc'ing the Clang folks too to make them aware.
I can move it to compiler_attribute.h
This attribute is supported by gcc, clang, and icc.
https://godbolt.org/z/ehd6so
I can send v2.
I do not mind renaming, but it should be done in a separate patch.
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 9 lines · Masahiro Yamada
I can move it to
compiler_attribute.hThis attribute is supported by gcc, clang, and icc.
https://godbolt.org/z/ehd6soI can send v2.
I do not mind renaming, but it should be done in a separate patch.
Of course -- sorry, I didn't mean we had to do them now, i.e. we can do the move and the rename later on, if you prefer.
Cheers,
Miguel
Quoted 9 lines · Masahiro Yamada
Revert commit
cebc04ba9aeb("addCONFIG_ENABLE_MUST_CHECK").A lot of
warn_unused_resultwarnings existed in 2006, but until now they have been fixed thanks to people doing allmodconfig tests.Our goal is to always enable
__must_checkwhere appreciate, so this CONFIG option is no longer needed.
Quoted 8 lines
I see a lot of defconfig (
arch/*/configs/*_defconfig) files having:#
CONFIG_ENABLE_MUST_CHECKis not setI did not touch them for now since it would be a big churn. If arch maintainers want to clean them up, please go ahead.
Signed-off-by Masahiro Yamada <[email protected]>
Picked it up through compiler-attributes with the "appreciate" typo fixed on my end. I did a quick compile-test with a minimal config. Let's see if the -next bots complain...
Thanks!
Cheers,
Miguel