From 4b7f39f71c6e5832df7904c18df5023a7c549d87 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Tue, 20 Jul 2021 20:47:49 +0200
Subject: [PATCH] tests: move DIAG_PUSH_IGNORE_NONNULL/DIAG_POP_IGNORE_NONNULL
outside main
Otherwise, gcc-4.4.7 (at least) complains:
preadv.c:69: error: #pragma GCC diagnostic not allowed inside functions
preadv.c:72: error: #pragma GCC diagnostic not allowed inside functions
pwritev.c:112: error: #pragma GCC diagnostic not allowed inside functions
pwritev.c:114: error: #pragma GCC diagnostic not allowed inside functions
---
tests/preadv.c | 7 +++++--
tests/pwritev.c | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/tests/preadv.c b/tests/preadv.c
index 3ccefc1..d03dfd0 100644
--- a/tests/preadv.c
+++ b/tests/preadv.c
@@ -42,6 +42,9 @@ print_iovec(const struct iovec *iov, unsigned int cnt)
putchar(']');
}
+/* for preadv(0, NULL, 1, -2) */
+DIAG_PUSH_IGNORE_NONNULL
+
int
main(void)
{
@@ -66,10 +69,8 @@ main(void)
printf("preadv(0, [{iov_base=%p, iov_len=%zu}], 1, -1) = "
"-1 EINVAL (%m)\n", iov->iov_base, iov->iov_len);
- DIAG_PUSH_IGNORE_NONNULL
if (preadv(0, NULL, 1, -2) != -1)
perror_msg_and_fail("preadv");
- DIAG_POP_IGNORE_NONNULL
printf("preadv(0, NULL, 1, -2) = -1 EINVAL (%m)\n");
if (preadv(0, iov, 0, -3) != -1)
@@ -132,6 +133,8 @@ main(void)
return 0;
}
+DIAG_POP_IGNORE_NONNULL
+
#else
SKIP_MAIN_UNDEFINED("HAVE_PREADV")
diff --git a/tests/pwritev.c b/tests/pwritev.c
index ea85397..2b1c67a 100644
--- a/tests/pwritev.c
+++ b/tests/pwritev.c
@@ -58,6 +58,9 @@ print_iovec(const struct iovec *iov, unsigned int cnt, unsigned int size)
putchar(']');
}
+/* for pwritev(0, NULL, 1, -3) */
+DIAG_PUSH_IGNORE_NONNULL
+
int
main(void)
{
@@ -109,9 +112,7 @@ main(void)
printf("pwritev(0, %p, 42, -2) = %ld %s (%m)\n",
iov, rc, errno2name());
- DIAG_PUSH_IGNORE_NONNULL
rc = pwritev(0, NULL, 1, -3);
- DIAG_POP_IGNORE_NONNULL
printf("pwritev(0, NULL, 1, -3) = %ld %s (%m)\n",
rc, errno2name());
@@ -123,6 +124,8 @@ main(void)
return 0;
}
+DIAG_POP_IGNORE_NONNULL
+
#else
SKIP_MAIN_UNDEFINED("HAVE_PWRITEV")
diff --git a/tests-m32/preadv.c b/tests-m32/preadv.c
index 3ccefc1..d03dfd0 100644
--- a/tests-m32/preadv.c
+++ b/tests-m32/preadv.c
@@ -42,6 +42,9 @@ print_iovec(const struct iovec *iov, unsigned int cnt)
putchar(']');
}
+/* for preadv(0, NULL, 1, -2) */
+DIAG_PUSH_IGNORE_NONNULL
+
int
main(void)
{
@@ -66,10 +69,8 @@ main(void)
printf("preadv(0, [{iov_base=%p, iov_len=%zu}], 1, -1) = "
"-1 EINVAL (%m)\n", iov->iov_base, iov->iov_len);
- DIAG_PUSH_IGNORE_NONNULL
if (preadv(0, NULL, 1, -2) != -1)
perror_msg_and_fail("preadv");
- DIAG_POP_IGNORE_NONNULL
printf("preadv(0, NULL, 1, -2) = -1 EINVAL (%m)\n");
if (preadv(0, iov, 0, -3) != -1)
@@ -132,6 +133,8 @@ main(void)
return 0;
}
+DIAG_POP_IGNORE_NONNULL
+
#else
SKIP_MAIN_UNDEFINED("HAVE_PREADV")
diff --git a/tests-m32/pwritev.c b/tests-m32/pwritev.c
index ea85397..2b1c67a 100644
--- a/tests-m32/pwritev.c
+++ b/tests-m32/pwritev.c
@@ -58,6 +58,9 @@ print_iovec(const struct iovec *iov, unsigned int cnt, unsigned int size)
putchar(']');
}
+/* for pwritev(0, NULL, 1, -3) */
+DIAG_PUSH_IGNORE_NONNULL
+
int
main(void)
{
@@ -109,9 +112,7 @@ main(void)
printf("pwritev(0, %p, 42, -2) = %ld %s (%m)\n",
iov, rc, errno2name());
- DIAG_PUSH_IGNORE_NONNULL
rc = pwritev(0, NULL, 1, -3);
- DIAG_POP_IGNORE_NONNULL
printf("pwritev(0, NULL, 1, -3) = %ld %s (%m)\n",
rc, errno2name());
@@ -123,6 +124,8 @@ main(void)
return 0;
}
+DIAG_POP_IGNORE_NONNULL
+
#else
SKIP_MAIN_UNDEFINED("HAVE_PWRITEV")
diff --git a/tests-mx32/preadv.c b/tests-mx32/preadv.c
index 3ccefc1..d03dfd0 100644
--- a/tests-mx32/preadv.c
+++ b/tests-mx32/preadv.c
@@ -42,6 +42,9 @@ print_iovec(const struct iovec *iov, unsigned int cnt)
putchar(']');
}
+/* for preadv(0, NULL, 1, -2) */
+DIAG_PUSH_IGNORE_NONNULL
+
int
main(void)
{
@@ -66,10 +69,8 @@ main(void)
printf("preadv(0, [{iov_base=%p, iov_len=%zu}], 1, -1) = "
"-1 EINVAL (%m)\n", iov->iov_base, iov->iov_len);
- DIAG_PUSH_IGNORE_NONNULL
if (preadv(0, NULL, 1, -2) != -1)
perror_msg_and_fail("preadv");
- DIAG_POP_IGNORE_NONNULL
printf("preadv(0, NULL, 1, -2) = -1 EINVAL (%m)\n");
if (preadv(0, iov, 0, -3) != -1)
@@ -132,6 +133,8 @@ main(void)
return 0;
}
+DIAG_POP_IGNORE_NONNULL
+
#else
SKIP_MAIN_UNDEFINED("HAVE_PREADV")
diff --git a/tests-mx32/pwritev.c b/tests-mx32/pwritev.c
index ea85397..2b1c67a 100644
--- a/tests-mx32/pwritev.c
+++ b/tests-mx32/pwritev.c
@@ -58,6 +58,9 @@ print_iovec(const struct iovec *iov, unsigned int cnt, unsigned int size)
putchar(']');
}
+/* for pwritev(0, NULL, 1, -3) */
+DIAG_PUSH_IGNORE_NONNULL
+
int
main(void)
{
@@ -109,9 +112,7 @@ main(void)
printf("pwritev(0, %p, 42, -2) = %ld %s (%m)\n",
iov, rc, errno2name());
- DIAG_PUSH_IGNORE_NONNULL
rc = pwritev(0, NULL, 1, -3);
- DIAG_POP_IGNORE_NONNULL
printf("pwritev(0, NULL, 1, -3) = %ld %s (%m)\n",
rc, errno2name());
@@ -123,6 +124,8 @@ main(void)
return 0;
}
+DIAG_POP_IGNORE_NONNULL
+
#else
SKIP_MAIN_UNDEFINED("HAVE_PWRITEV")
--
2.1.4