diff mbox series

[v1] kbuild: enforce -Werror=unused-result

Message ID 20201117104736.24997-1-olaf@aepfle.de (mailing list archive)
State New
Headers show
Series [v1] kbuild: enforce -Werror=unused-result | expand

Commit Message

Olaf Hering Nov. 17, 2020, 10:47 a.m. UTC
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 <olaf@aepfle.de>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Masahiro Yamada Dec. 1, 2020, 10:42 a.m. UTC | #1
On Tue, Nov 17, 2020 at 7:47 PM Olaf Hering <olaf@aepfle.de> wrote:
>
> 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 <olaf@aepfle.de>

Applied to linux-kbuild.
Thanks.


> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index e2c3f65c4721..c7f9acffad42 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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 :=
Masahiro Yamada Dec. 21, 2020, 6:31 a.m. UTC | #2
On Tue, Dec 1, 2020 at 7:42 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Tue, Nov 17, 2020 at 7:47 PM Olaf Hering <olaf@aepfle.de> wrote:
> >
> > 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 <olaf@aepfle.de>
>
> 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.





>
> > ---
> >  Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index e2c3f65c4721..c7f9acffad42 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -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
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index e2c3f65c4721..c7f9acffad42 100644
--- a/Makefile
+++ b/Makefile
@@ -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 :=