public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Jens Axboe <[email protected]>
Cc: Ammar Faizi <[email protected]>,
	Pavel Begunkov <[email protected]>,
	Gilang Fachrezy <[email protected]>,
	Muhammad Rizki <[email protected]>,
	VNLX Kernel Department <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>,
	io-uring Mailing List <[email protected]>
Subject: [PATCH liburing v1 5/8] tests: Fix clang `-Wunreachable-code` warning
Date: Mon, 19 Dec 2022 22:49:57 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Clang says:

  fadvise.c:190:3: warning: code will never be executed [-Wunreachable-code]
                  fprintf(stderr, "Suspicious timings\n");
                  ^~~~~~~
  fadvise.c:189:6: note: silence by adding parentheses to mark code as \
  explicitly dead
          if (0 && bad > good) {
              ^
              /* DISABLES CODE */ ( )

  madvise.c:186:3: warning: code will never be executed [-Wunreachable-code]
                  fprintf(stderr, "Suspicious timings (%u > %u)\n", bad, good);
                  ^~~~~~~
  madvise.c:185:6: note: silence by adding parentheses to mark code as \
  explicitly dead
          if (0 && bad > good)
              ^
              /* DISABLES CODE */ ( )

Add parentheses to silence the warning.

Signed-off-by: Ammar Faizi <[email protected]>
---
 test/fadvise.c | 2 +-
 test/madvise.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/fadvise.c b/test/fadvise.c
index 889f447..4f4d85f 100644
--- a/test/fadvise.c
+++ b/test/fadvise.c
@@ -179,21 +179,21 @@ int main(int argc, char *argv[])
 			goto err;
 		} else if (!ret)
 			good++;
 		else if (ret == 2)
 			bad++;
 		if (i >= MIN_LOOPS && !bad)
 			break;
 	}
 
 	/* too hard to reliably test, just ignore */
-	if (0 && bad > good) {
+	if ((0) && bad > good) {
 		fprintf(stderr, "Suspicious timings\n");
 		goto err;
 	}
 
 	if (fname != argv[1])
 		unlink(fname);
 	io_uring_queue_exit(&ring);
 	return T_EXIT_PASS;
 err:
 	if (fname != argv[1])
diff --git a/test/madvise.c b/test/madvise.c
index 8848143..7938ec4 100644
--- a/test/madvise.c
+++ b/test/madvise.c
@@ -175,21 +175,21 @@ int main(int argc, char *argv[])
 			goto err;
 		} else if (!ret)
 			good++;
 		else if (ret == 2)
 			bad++;
 		if (i >= MIN_LOOPS && !bad)
 			break;
 	}
 
 	/* too hard to reliably test, just ignore */
-	if (0 && bad > good)
+	if ((0) && bad > good)
 		fprintf(stderr, "Suspicious timings (%u > %u)\n", bad, good);
 	if (fname != argv[1])
 		unlink(fname);
 	io_uring_queue_exit(&ring);
 	return T_EXIT_PASS;
 err:
 	if (fname != argv[1])
 		unlink(fname);
 	return T_EXIT_FAIL;
 }
-- 
Ammar Faizi


  parent reply	other threads:[~2022-12-19 15:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19 15:49 [PATCH liburing v1 0/8] liburing updates Ammar Faizi
2022-12-19 15:49 ` [PATCH liburing v1 1/8] ffi: Add SPDX-License-Idetifier Ammar Faizi
2022-12-19 15:49 ` [PATCH liburing v1 2/8] Makefile: Add a '+' char to silence a Makefile warning Ammar Faizi
2022-12-19 15:49 ` [PATCH liburing v1 3/8] tests: Fix `-Wstrict-prototypes` warnings from Clang Ammar Faizi
2022-12-19 15:49 ` [PATCH liburing v1 4/8] test/ring-leak: Remove a "break" statement in a "for loop" Ammar Faizi
2022-12-19 15:49 ` Ammar Faizi [this message]
2022-12-19 15:49 ` [PATCH liburing v1 6/8] tests: Declare internal variables as static Ammar Faizi
2022-12-19 15:49 ` [PATCH liburing v1 7/8] github: Add more extra flags for clang build Ammar Faizi
2022-12-19 15:50 ` [PATCH liburing v1 8/8] CHANGELOG: Update the CHANGELOG file Ammar Faizi
2022-12-19 17:00 ` [PATCH liburing v1 0/8] liburing updates Jens Axboe

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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