[PATCH v2 1/4] utils/autotune: Fix compile error seen with gcc 16

Florian Bezdeka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
This fixes the following compile errror seen when using gcc 16 as
compiler:

autotune.c: In function ‘sampler_thread’:
autotune.c:95:34: error: variable ‘n’ set but not used [-Werror=unused-but-set-variable=]
   95 |         int fd = (long)arg, ret, n = 0;
      |                                  ^
cc1: all warnings being treated as errors

The variable n was write-only. Removing the variable entirely as it
never contributed to the test.

Signed-off-by: Florian Bezdeka <[email protected]>
---
 utils/autotune/autotune.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/utils/autotune/autotune.c b/utils/autotune/autotune.c
index f52733b7ae1d5a920fc7ad79c7288001dfeb8f21..2e25daef964beb96a8744e50f5ae9c62c04b64b2 100644
--- a/utils/autotune/autotune.c
+++ b/utils/autotune/autotune.c
@@ -92,7 +92,7 @@ static const struct option base_options[] = {
 
 static void *sampler_thread(void *arg)
 {
-	int fd = (long)arg, ret, n = 0;
+	int fd = (long)arg, ret;
 	__u64 timestamp = 0;
 	struct timespec now;
 
@@ -102,9 +102,7 @@ static void *sampler_thread(void *arg)
 			if (errno != EPIPE)
 				error(1, errno, "pulse failed");
 			timestamp = 0; /* Next tuning period. */
-			n = 0;
 		} else {
-			n++;
 			clock_gettime(CLOCK_MONOTONIC, &now);
 			timestamp = (__u64)now.tv_sec * 1000000000 + now.tv_nsec;
 		}

-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.