summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Qi <joseph.qi@linux.alibaba.com>2019-10-30 15:16:30 +0800
committerJens Axboe <axboe@kernel.dk>2019-10-30 08:11:47 -0600
commita8b3b787a235e9f37efb75528ee1aede6c5ed948 (patch)
treef3ad795f55d19f8e822547d54a3997f6ca0c4fee
parent8b68609d67f481c5df7bee990234bf87be382514 (diff)
downloadliburing-a8b3b787a235e9f37efb75528ee1aede6c5ed948.tar.gz
liburing-a8b3b787a235e9f37efb75528ee1aede6c5ed948.tar.bz2
liburing/test: fix build errors
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> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/232c93d07b74-test.c7
-rw-r--r--test/defer.c4
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)