kbuild: enforce -Werror=unused-result
PATCH 1/1 kbuild: enforce -Werror=unused-result
It is a hard error if a return value is ignored.
In case the return value has no meaning, remove the attribute.
Signed-off-by Olaf Hering <[email protected]>
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -497,7 +497,7 @@ KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \ -Werror=implicit-function-declaration -Werror=implicit-int \ - -Werror=return-type -Wno-format-security \ + -Werror=return-type -Werror=unused-result -Wno-format-security \ -std=gnu89 KBUILD_CPPFLAGS := -D__KERNEL__ KBUILD_AFLAGS_KERNEL :=
Quoted 5 lines · Olaf Hering
It is a hard error if a return value is ignored.
In case the return value has no meaning, remove the attribute.Signed-off-by Olaf Hering <[email protected]>
Applied to linux-kbuild.
Thanks.
Quoted 17 lines
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +1
-1@@ -497,7 +497,7 @@ KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \ -Werror=implicit-function-declaration -Werror=implicit-int \ - -Werror=return-type -Wno-format-security \ + -Werror=return-type -Werror=unused-result -Wno-format-security \ -std=gnu89 KBUILD_CPPFLAGS := -D__KERNEL__ KBUILD_AFLAGS_KERNEL :=
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 10 lines · Masahiro Yamada
Quoted 5 lines · Olaf Hering
It is a hard error if a return value is ignored.
In case the return value has no meaning, remove the attribute.Signed-off-by Olaf Hering <[email protected]>Applied to linux-kbuild.
Thanks.
I will postpone this by the next MW.
Some instances of __must_check violation are still remaining, which end up with build breakages.
Quoted 24 lines
Quoted 10 lines
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +0
-0Makefile KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE · line 503
Quoted 8 lines
Makefile +1
-1@@ -497,7 +497,7 @@ KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \ -Werror=implicit-function-declaration -Werror=implicit-int \ - -Werror=return-type -Wno-format-security \ + -Werror=return-type -Werror=unused-result -Wno-format-security \ -std=gnu89 KBUILD_CPPFLAGS := -D__KERNEL__ KBUILD_AFLAGS_KERNEL :=--
Best Regards
Masahiro Yamada
Signature · 2 lines
Best Regards Masahiro Yamada