diff mbox series

[4/4] selftests/nolibc: enable -Wall compiler warnings

Message ID 20230731-nolibc-warnings-v1-4-74973d2a52d7@weissschuh.net (mailing list archive)
State New
Headers show
Series tools/nolibc: enable compiler warnings | expand

Commit Message

Thomas Weißschuh July 31, 2023, 6:26 a.m. UTC
It will help the developers to avoid cruft and detect some bugs.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 tools/testing/selftests/nolibc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zhangjin Wu July 31, 2023, 7:17 a.m. UTC | #1
Hi, Thomas

> It will help the developers to avoid cruft and detect some bugs.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  tools/testing/selftests/nolibc/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
> index f42adef87e12..72227d75c6da 100644
> --- a/tools/testing/selftests/nolibc/Makefile
> +++ b/tools/testing/selftests/nolibc/Makefile
> @@ -79,7 +79,7 @@ endif
>  CFLAGS_s390 = -m64
>  CFLAGS_mips = -EL
>  CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all))
> -CFLAGS  ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 \
> +CFLAGS  ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -Wall \

Very good static analyzer support.

What about further add more options?

    +CFLAGS  ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -Wall -Wextra -Werror\

A simple test shows, it can catch more issues.

Thanks,
Zhangjin

>  		$(call cc-option,-fno-stack-protector) \
>  		$(CFLAGS_$(ARCH)) $(CFLAGS_STACKPROTECTOR)
>  LDFLAGS := -s
> 
> -- 
> 2.41.0
Thomas Weißschuh July 31, 2023, 8:10 a.m. UTC | #2
On 2023-07-31 15:17:18+0800, Zhangjin Wu wrote:
> > It will help the developers to avoid cruft and detect some bugs.
> > 
> > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> > ---
> >  tools/testing/selftests/nolibc/Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
> > index f42adef87e12..72227d75c6da 100644
> > --- a/tools/testing/selftests/nolibc/Makefile
> > +++ b/tools/testing/selftests/nolibc/Makefile
> > @@ -79,7 +79,7 @@ endif
> >  CFLAGS_s390 = -m64
> >  CFLAGS_mips = -EL
> >  CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all))
> > -CFLAGS  ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 \
> > +CFLAGS  ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -Wall \
> 
> Very good static analyzer support.
> 
> What about further add more options?
> 
>     +CFLAGS  ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -Wall -Wextra -Werror\
> 
> A simple test shows, it can catch more issues.

-Wextra will need some further rework for 32bit architectures to avoid
some warnings.
(At least mips for which I tested it)

I don't think -Werror is appropriate. If we want to test the functioning
of nolibc with weird compilers these may very well add new warnings and
that shouldn't break the build.

> 
> Thanks,
> Zhangjin
> 
> >  		$(call cc-option,-fno-stack-protector) \
> >  		$(CFLAGS_$(ARCH)) $(CFLAGS_STACKPROTECTOR)
> >  LDFLAGS := -s
> > 
> > -- 
> > 2.41.0
diff mbox series

Patch

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index f42adef87e12..72227d75c6da 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -79,7 +79,7 @@  endif
 CFLAGS_s390 = -m64
 CFLAGS_mips = -EL
 CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all))
-CFLAGS  ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 \
+CFLAGS  ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -Wall \
 		$(call cc-option,-fno-stack-protector) \
 		$(CFLAGS_$(ARCH)) $(CFLAGS_STACKPROTECTOR)
 LDFLAGS := -s