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]>
---
v2:
resend
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index a28bb374663d..9b7def6db494 100644
--- a/Makefile
+++ b/Makefile
@@ -495,7 +495,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 :=
Am Fri, 19 Mar 2021 15:32:31 +0100
schrieb Olaf Hering <[email protected]>:
> It is a hard error if a return value is ignored.
The automated builds found only a single error, in load_em86().
Let me know if there are other reasons why the patch was rejected.
Olaf
On Thu, Mar 25, 2021 at 8:16 PM Olaf Hering <[email protected]> wrote:
>
> Am Fri, 19 Mar 2021 15:32:31 +0100
> schrieb Olaf Hering <[email protected]>:
>
> > It is a hard error if a return value is ignored.
>
> The automated builds found only a single error, in load_em86().
What about drivers/net/ethernet/lantiq_etop.c ?
> Let me know if there are other reasons why the patch was rejected.
>
> Olaf
I got a lot of complaints in the last trial.
It is easy to send a patch like this, but difficult to
make sure that I will not break any CI tests.
Over time, I started to believe keeping this as a warning
is OK.
The same problem happens when you add a new __must_check
annotation. You end up with fixing all the call-sites in advance.
--
Best Regards
Masahiro Yamada
Am Fri, 26 Mar 2021 01:55:41 +0900
schrieb Masahiro Yamada <[email protected]>:
> What about drivers/net/ethernet/lantiq_etop.c ?
Nothing complained about it. I guess there is a build-bot for alpha, but none for mips.
> I got a lot of complaints in the last trial.
Why did you get complains, instead of me?
What is the "must" in "__must_check" worth if it is not enforced...
Olaf
On Fri, Mar 26, 2021 at 2:07 AM Olaf Hering <[email protected]> wrote:
>
> Am Fri, 26 Mar 2021 01:55:41 +0900
> schrieb Masahiro Yamada <[email protected]>:
>
> > What about drivers/net/ethernet/lantiq_etop.c ?
>
> Nothing complained about it. I guess there is a build-bot for alpha, but none for mips.
>
> > I got a lot of complaints in the last trial.
>
> Why did you get complains, instead of me?
>
>
> What is the "must" in "__must_check" worth if it is not enforced...
>
> Olaf
In hindsight, __must_check may not be a perfect name.
Miguel suggested __nodiscard to get along with:
https://en.cppreference.com/w/c/language/attributes/nodiscard
It is not enforcing. Just a compiler warning.
--
Best Regards
Masahiro Yamada