git: 6b7a06c3bdbc - main - stress2: Avoid using "__unused"

From: Peter Holm <pho_at_FreeBSD.org>
Date: Thu, 08 Jun 2023 07:51:06 UTC
The branch main has been updated by pho:

URL: https://cgit.FreeBSD.org/src/commit/?id=6b7a06c3bdbc17bc5ac450023bd0baadfaeefa78

commit 6b7a06c3bdbc17bc5ac450023bd0baadfaeefa78
Author:     Peter Holm <pho@FreeBSD.org>
AuthorDate: 2023-06-08 07:49:52 +0000
Commit:     Peter Holm <pho@FreeBSD.org>
CommitDate: 2023-06-08 07:49:52 +0000

    stress2: Avoid using "__unused"
---
 tools/test/stress2/misc/reaper2.sh |  8 ++++----
 tools/test/stress2/misc/reaper3.sh | 11 +++++------
 tools/test/stress2/misc/reaper4.sh | 11 +++++------
 3 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/tools/test/stress2/misc/reaper2.sh b/tools/test/stress2/misc/reaper2.sh
index 1643e9985240..ee9cf927f1d9 100755
--- a/tools/test/stress2/misc/reaper2.sh
+++ b/tools/test/stress2/misc/reaper2.sh
@@ -65,8 +65,9 @@ test(void) {
 	struct procctl_reaper_kill killemall;
 	pid_t pid;
 	time_t start;
-	int data[20], e, n __unused, m;
+	int data[20], debug, e, n, m;
 
+	debug = 0; /* set to 1 for debug output */
 	n = m = 0;
 	if (procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == -1)
 		err(EXIT_FAILURE, "Fail to acquire the reaper");
@@ -94,9 +95,8 @@ test(void) {
 		if (waitpid(pid, NULL, 0) != pid)
 			err(1, "waitpid()");
 	}
-#if defined(DEBUG)
-	fprintf(stderr, "n = %d out of %d\n", n, m);
-#endif
+	if (debug == 1)
+		fprintf(stderr, "n = %d out of %d\n", n, m);
 	_exit(0);
 }
 
diff --git a/tools/test/stress2/misc/reaper3.sh b/tools/test/stress2/misc/reaper3.sh
index 90bb395da5c1..59012d2c45ca 100755
--- a/tools/test/stress2/misc/reaper3.sh
+++ b/tools/test/stress2/misc/reaper3.sh
@@ -59,14 +59,13 @@ flip(void *ap, size_t len)
 {
 	unsigned char *cp;
 	int byte;
-	unsigned char bit, buf, mask, old __unused;
+	unsigned char bit, buf, mask;
 
 	cp = (unsigned char *)ap;
 	byte = random_long(0, len);
 	bit = random_long(0,7);
 	mask = ~(1 << bit);
 	buf = cp[byte];
-	old = cp[byte];
 	buf = (buf & mask) | (~buf & ~mask);
 	cp[byte] = buf;
 }
@@ -86,8 +85,9 @@ test(void) {
 	struct procctl_reaper_kill killemall;
 	pid_t pid;
 	time_t start;
-	int data[20], e, n __unused, m;
+	int data[20], debug, e, n, m;
 
+	debug = 0; /* set to 1 for debug output */
 	n = m = 0;
 	if (procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == -1)
 		err(EXIT_FAILURE, "Fail to acquire the reaper");
@@ -118,9 +118,8 @@ test(void) {
 		if (waitpid(pid, NULL, 0) != pid)
 			err(1, "waitpid()");
 	}
-#if defined(DEBUG)
-	fprintf(stderr, "n = %d out of %d\n", n, m);
-#endif
+	if (debug == 1)	
+		fprintf(stderr, "n = %d out of %d\n", n, m);
 	_exit(0);
 }
 
diff --git a/tools/test/stress2/misc/reaper4.sh b/tools/test/stress2/misc/reaper4.sh
index bd30bd1b0efd..0fdb3f75ccff 100755
--- a/tools/test/stress2/misc/reaper4.sh
+++ b/tools/test/stress2/misc/reaper4.sh
@@ -59,14 +59,13 @@ flip(void *ap, size_t len)
 {
 	unsigned char *cp;
 	int byte;
-	unsigned char bit, buf, mask, old __unused;
+	unsigned char bit, buf, mask;
 
 	cp = (unsigned char *)ap;
 	byte = random_long(0, len);
 	bit = random_long(0,7);
 	mask = ~(1 << bit);
 	buf = cp[byte];
-	old = cp[byte];
 	buf = (buf & mask) | (~buf & ~mask);
 	cp[byte] = buf;
 }
@@ -85,8 +84,9 @@ test(void) {
 	struct procctl_reaper_kill killemall;
 	pid_t pid;
 	time_t start;
-	int data[20], e, n __unused, m;
+	int data[20], debug, e, n, m;
 
+	debug = 0; /* set to 1 for debug output */
 	n = m = 0;
 	if (procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == -1)
 		err(EXIT_FAILURE, "Fail to acquire the reaper");
@@ -117,9 +117,8 @@ test(void) {
 		if (waitpid(pid, NULL, 0) != pid)
 			err(1, "waitpid()");
 	}
-#if defined(DEBUG)
-	fprintf(stderr, "n = %d out of %d\n", n, m);
-#endif
+	if (debug == 1)
+		fprintf(stderr, "n = %d out of %d\n", n, m);
 	_exit(0);
 }