LLVM 15.0.0 has improved diagnostics for the 'nounused-but-set-variable' warning and now warns when a variable is modified using pre/post increment/decrement operators but is otherwise never read.
linux-tests.c has such an unused variable 'wcount' and since TCG tests are compiled with -Wall -Werror, this is causing 'make check-tcg' to fail when using LLVM 15.0.0 and above: ``` qemu/tests/tcg/multiarch/linux/linux-test.c:335:9: error: variable 'wcount' set but not used [-Werror,-Wunused-but-set-variable] int wcount, rcount; ^ 1 error generated. Makefile:119: recipe for target 'linux-test' failed ``` This patch simply removes the 'wcount' variable as it doesn't appear to impact the semantics of the test. The WCOUNT_MAX constant is also renamed to RCOUNT_MAX to better reflect the usage. --- tests/tcg/multiarch/linux/linux-test.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/tcg/multiarch/linux/linux-test.c b/tests/tcg/multiarch/linux/linux-test.c index 5a2a4f2258..35540dc357 100644 --- a/tests/tcg/multiarch/linux/linux-test.c +++ b/tests/tcg/multiarch/linux/linux-test.c @@ -325,19 +325,18 @@ static void test_socket(void) chk_error(close(server_fd)); } -#define WCOUNT_MAX 512 +#define RCOUNT_MAX 512 static void test_pipe(void) { fd_set rfds, wfds; int fds[2], fd_max, ret; uint8_t ch; - int wcount, rcount; + int rcount; chk_error(pipe(fds)); chk_error(fcntl(fds[0], F_SETFL, O_NONBLOCK)); chk_error(fcntl(fds[1], F_SETFL, O_NONBLOCK)); - wcount = 0; rcount = 0; for(;;) { FD_ZERO(&rfds); @@ -354,13 +353,12 @@ static void test_pipe(void) if (FD_ISSET(fds[0], &rfds)) { chk_error(read(fds[0], &ch, 1)); rcount++; - if (rcount >= WCOUNT_MAX) + if (rcount >= RCOUNT_MAX) break; } if (FD_ISSET(fds[1], &wfds)) { ch = 'a'; chk_error(write(fds[1], &ch, 1)); - wcount++; } } } -- 2.17.1