Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yuan Tan <tanyuan@tinylab.org>, Zhangjin Wu <falcon@tinylab.org>
Subject: Re: [PATCH v3 14/14] selftests/nolibc: enable compiler warnings
Date: Sat, 5 Aug 2023 18:23:27 +0200	[thread overview]
Message-ID: <20230805162327.GB15284@1wt.eu> (raw)
In-Reply-To: <20230803-nolibc-warnings-v3-14-bcc1a096ae02@weissschuh.net>

On Thu, Aug 03, 2023 at 09:28:58AM +0200, Thomas Weißschuh 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 b82d29b6c37f..e8d09cbee2ab 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 -W -Wall -Wextra \
>  		$(call cc-option,-fno-stack-protector) \
>  		$(CFLAGS_$(ARCH)) $(CFLAGS_STACKPROTECTOR)
>  LDFLAGS :=

I'm now getting this with gcc < 9:

  nolibc-test.c: In function 'test_pipe':
  nolibc-test.c:811:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (len != strlen(msg))
            ^
The reason is that len is ssize_t and strlen() is size_t. I tried different
approaches here but the cleanest remains turning len to size_t (we don't
use its sign anyway), so I'll do that one as well.

Cheers,
Willy

  reply	other threads:[~2023-08-05 16:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03  7:28 [PATCH v3 00/14] tools/nolibc: enable compiler warnings Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 01/14] tools/nolibc: drop unused variables Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 02/14] tools/nolibc: fix return type of getpagesize() Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 03/14] tools/nolibc: setvbuf: avoid unused parameter warnings Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 04/14] tools/nolibc: sys: avoid implicit sign cast Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 05/14] tools/nolibc: stdint: use int for size_t on 32bit Thomas Weißschuh
2023-08-05 16:19   ` Willy Tarreau
2023-08-05 16:25     ` Thomas Weißschuh
2023-08-05 16:35       ` Willy Tarreau
2023-08-03  7:28 ` [PATCH v3 06/14] selftests/nolibc: drop unused variables Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 07/14] selftests/nolibc: mark test helpers as potentially unused Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 08/14] selftests/nolibc: make functions static if possible Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 09/14] selftests/nolibc: avoid unused parameter warnings Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 10/14] selftests/nolibc: avoid sign-compare warnings Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 11/14] selftests/nolibc: use correct return type for read() and write() Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 12/14] selftests/nolibc: prevent out of bounds access in expect_vfprintf Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 13/14] selftests/nolibc: don't strip nolibc-test Thomas Weißschuh
2023-08-03  7:28 ` [PATCH v3 14/14] selftests/nolibc: enable compiler warnings Thomas Weißschuh
2023-08-05 16:23   ` Willy Tarreau [this message]
2023-08-05 16:32     ` Willy Tarreau
2023-08-05 16:54 ` [PATCH v3 00/14] tools/nolibc: " Willy Tarreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230805162327.GB15284@1wt.eu \
    --to=w@1wt.eu \
    --cc=falcon@tinylab.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=shuah@kernel.org \
    --cc=tanyuan@tinylab.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox