All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Subject: [PATCH] liburing/test: fix build errors
Date: Wed, 30 Oct 2019 15:16:30 +0800	[thread overview]
Message-ID: <1572419790-96807-1-git-send-email-joseph.qi@linux.alibaba.com> (raw)

Fix the following errors when make:
  error: ‘for’ loop initial declarations are only allowed in C99 mode
  error: redeclaration of ‘i’ with no linkage

Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
---
 test/232c93d07b74-test.c | 7 +++++--
 test/defer.c             | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/test/232c93d07b74-test.c b/test/232c93d07b74-test.c
index b321668..c398de6 100644
--- a/test/232c93d07b74-test.c
+++ b/test/232c93d07b74-test.c
@@ -132,7 +132,9 @@ static void *rcv(void *arg)
 				if (cqe->res < 0)
 					assert(cqe->res == -EAGAIN);
 				else {
-					for (int i = 0; i < cqe->res; i++) {
+					int i;
+
+					for (i = 0; i < cqe->res; i++) {
 						if (buff[i] != expected_byte) {
 							fprintf(stderr,
 								"Received %d, wanted %d\n",
@@ -208,8 +210,9 @@ static void *snd(void *arg)
 
 	while (!done && bytes_written != 33) {
 		char buff[SEND_BUFF_SIZE];
+		int i;
 
-		for (int i = 0; i < SEND_BUFF_SIZE; i++)
+		for (i = 0; i < SEND_BUFF_SIZE; i++)
 			buff[i] = i + bytes_written;
 
 		struct iovec iov;
diff --git a/test/defer.c b/test/defer.c
index db0d904..f103a65 100644
--- a/test/defer.c
+++ b/test/defer.c
@@ -92,7 +92,7 @@ static int test_cancelled_userdata(struct io_uring *ring)
 	if (wait_cqes(&ctx))
 		goto err;
 
-	for (int i = 0; i < nr; i++) {
+	for (i = 0; i < nr; i++) {
 		if (i != ctx.cqes[i].user_data) {
 			printf("invalid user data\n");
 			goto err;
@@ -126,7 +126,7 @@ static int test_thread_link_cancel(struct io_uring *ring)
 	if (wait_cqes(&ctx))
 		goto err;
 
-	for (int i = 0; i < nr; i++) {
+	for (i = 0; i < nr; i++) {
 		bool fail = false;
 
 		if (i == 0)
-- 
1.8.3.1


             reply	other threads:[~2019-10-30  7:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30  7:16 Joseph Qi [this message]
2019-10-30 14:11 ` [PATCH] liburing/test: fix build errors 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 \
    --in-reply-to=1572419790-96807-1-git-send-email-joseph.qi@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.