git: 0be29268ae4e - main - tests/pmc: annotate busy loop counters with __unused

From: Siva Mahadevan <siva_at_FreeBSD.org>
Date: Wed, 30 Sep 2026 14:33:34 UTC
The branch main has been updated by siva:

URL: https://cgit.FreeBSD.org/src/commit/?id=0be29268ae4e593581e1f711f0f8822a52215aef

commit 0be29268ae4e593581e1f711f0f8822a52215aef
Author:     Siva Mahadevan <siva@FreeBSD.org>
AuthorDate: 2026-09-08 20:04:19 +0000
Commit:     Siva Mahadevan <siva@FreeBSD.org>
CommitDate: 2026-09-30 14:32:52 +0000

    tests/pmc: annotate busy loop counters with __unused
    
    This fixes the build with gcc 16 after the changes
    to -Wunused*[0].
    
    [0] https://gcc.gnu.org/gcc-16/porting_to.html#changes-to-wunused
    
    Reviewed by:    netchild
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
---
 tests/sys/pmc/pmc_credexec_test.c  | 2 +-
 tests/sys/pmc/pmc_detach_test.c    | 4 ++--
 tests/sys/pmc/pmc_exec_test.c      | 2 +-
 tests/sys/pmc/pmc_lifecycle_test.c | 6 +++---
 tests/sys/pmc/pmc_log_test.c       | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/sys/pmc/pmc_credexec_test.c b/tests/sys/pmc/pmc_credexec_test.c
index e080b683f2e9..2f98996ffb52 100644
--- a/tests/sys/pmc/pmc_credexec_test.c
+++ b/tests/sys/pmc/pmc_credexec_test.c
@@ -146,7 +146,7 @@ allocate_counting_pmc(void)
 static void
 spin(void)
 {
-	volatile unsigned long s = 0;
+	volatile unsigned long s __unused = 0;
 	int i;
 
 	for (i = 0; i < 2000000; i++)
diff --git a/tests/sys/pmc/pmc_detach_test.c b/tests/sys/pmc/pmc_detach_test.c
index 05fda61b2836..5eebe744ef13 100644
--- a/tests/sys/pmc/pmc_detach_test.c
+++ b/tests/sys/pmc/pmc_detach_test.c
@@ -73,7 +73,7 @@ static volatile int spin_stop;
 static void *
 spinner(void *arg __unused)
 {
-	volatile unsigned long s = 0;
+	volatile unsigned long s __unused = 0;
 
 	while (spin_stop == 0)
 		s += 1;
@@ -83,7 +83,7 @@ spinner(void *arg __unused)
 static void
 burn_cpu(void)
 {
-	volatile unsigned long s = 0;
+	volatile unsigned long s __unused = 0;
 	int i;
 
 	for (i = 0; i < 1000000; i++)
diff --git a/tests/sys/pmc/pmc_exec_test.c b/tests/sys/pmc/pmc_exec_test.c
index d4d476cd20de..2b59e347ac6b 100644
--- a/tests/sys/pmc/pmc_exec_test.c
+++ b/tests/sys/pmc/pmc_exec_test.c
@@ -125,7 +125,7 @@ allocate_counting_pmc(void)
 static void
 spin(void)
 {
-	volatile unsigned long s = 0;
+	volatile unsigned long s __unused = 0;
 	int i;
 
 	for (i = 0; i < 2000000; i++)
diff --git a/tests/sys/pmc/pmc_lifecycle_test.c b/tests/sys/pmc/pmc_lifecycle_test.c
index 2107c772b08e..469740cd3a92 100644
--- a/tests/sys/pmc/pmc_lifecycle_test.c
+++ b/tests/sys/pmc/pmc_lifecycle_test.c
@@ -217,7 +217,7 @@ ATF_TC_BODY(release_running_attached, tc)
 
 	/* Run a little, so the PMC is actually loaded on a CPU. */
 	{
-		volatile unsigned long s = 0;
+		volatile unsigned long s __unused = 0;
 		int i;
 
 		for (i = 0; i < 5000000; i++)
@@ -364,7 +364,7 @@ ATF_TC_BODY(descendants_inherit_and_release, tc)
 	child = fork();
 	ATF_REQUIRE(child >= 0);
 	if (child == 0) {
-		volatile unsigned long s = 0;
+		volatile unsigned long s __unused = 0;
 		int i;
 
 		for (i = 0; i < 2000000; i++)
@@ -404,7 +404,7 @@ ATF_TC_BODY(descendants_fork_storm, tc)
 		pid_t c = fork();
 
 		if (c == 0) {
-			volatile unsigned long s = 0;
+			volatile unsigned long s __unused = 0;
 			int j;
 
 			for (j = 0; j < 200000; j++)
diff --git a/tests/sys/pmc/pmc_log_test.c b/tests/sys/pmc/pmc_log_test.c
index 8b5a3e0ef2d7..6c2c57b4d121 100644
--- a/tests/sys/pmc/pmc_log_test.c
+++ b/tests/sys/pmc/pmc_log_test.c
@@ -398,7 +398,7 @@ ATF_TC_BODY(owner_exit_with_log_and_running_pmc, tc)
 
 	ATF_REQUIRE((child = fork()) >= 0);
 	if (child == 0) {
-		volatile unsigned long sink = 0;
+		volatile unsigned long sink __unused = 0;
 		unsigned long i;
 		pmc_id_t cid;
 		int fd;