Re: [PATCH] rt-tests: cyclictest: Suppress compiler warnings for unused variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Wed, 9 Aug 2023, Eder Zulian wrote:

> Using an attribute to inform the compiler that variables are expect to be unused so it will not issue a warning.
> 
> Signed-off-by: Eder Zulian <ezulian@xxxxxxxxxx>
> ---
>  src/cyclictest/cyclictest.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 7b0f80f..86cec0e 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -1610,11 +1610,13 @@ static void rstat_print_stat(struct thread_param *par, int index, int verbose, i
>  }
>  
>  
> +#define UNUSED __attribute__((__unused__))
> +
>  /*
>   * thread that creates a named fifo and hands out run stats when someone
>   * reads from the fifo.
>   */
> -static void *fifothread(void *param)
> +static void *fifothread(UNUSED void *param)
>  {
>  	int ret;
>  	int fd;
> @@ -1795,7 +1797,7 @@ rstat_err:
>  	return;
>  }
>  
> -static void write_stats(FILE *f, void *data)
> +static void write_stats(FILE *f, UNUSED void *data)
>  {
>  	struct thread_param **par = parameters;
>  	unsigned int i, j, comma;
> -- 
> 2.39.3
> 
> 

Just like in the kernel, we try to avoid preprocessor trickery,
so just put the attribute directly in the function header.

Watch the unwrapped lines in your commit messages.

John




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux