Blame SOURCES/0140-tests-move-DIAG_PUSH_IGNORE_NONNULL-DIAG_POP_IGNORE_.patch

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