Re: [PATCH 1/5] utils/autotune: Fix compile error seen with gcc 16

Jan Kiszka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
On 13.05.26 14:50, Florian Bezdeka wrote:
> 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
> 

Will probably add the note here that this variable has always been
write-only.

Jan

> 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;
>  		}
> 


-- 
Siemens AG, Foundational Technologies
Linux Expert Center
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.