Re: [PATCH v2 2/4] tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks

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

 



Hi Thomas,

On Sun, Sep 17, 2023 at 05:36:17PM +0200, Thomas Weißschuh wrote:
> The ENOSYS fallback code does not use its functions parameters.
> This can lead to compiler warnings about unused parameters.
> 
> Explicitly avoid these warnings.
> 
> Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
> ---
>  tools/include/nolibc/sys.h | 44 +++++++++++++++++++++++++++-----------------
>  1 file changed, 27 insertions(+), 17 deletions(-)
> 
> diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h
> index b478750c9004..8389820e1928 100644
> --- a/tools/include/nolibc/sys.h
> +++ b/tools/include/nolibc/sys.h
> @@ -43,6 +43,16 @@
>  		: __sysret_arg;                         /* return original value */ \
>  })
>  
> +/* Syscall ENOSYS helper: Avoids unused-parameter warnings and provides a
> + * debugging hook.
> + */
> +
> +static __inline__ int __nolibc_enosys(const char *syscall, ...)
> +{
> +	(void)syscall;
> +	return -ENOSYS;
> +}
> +
>  
>  /* Functions in this file only describe syscalls. They're declared static so
>   * that the compiler usually decides to inline them while still being allowed
> @@ -133,7 +143,7 @@ int sys_chmod(const char *path, mode_t mode)
>  #elif defined(__NR_chmod)
>  	return my_syscall2(__NR_chmod, path, mode);
>  #else
> -	return -ENOSYS;
> +	return __nolibc_enosys(__func__, path, mode);
>  #endif
>  }
(...)

It's much cleaner like this.

Acked-by: Willy Tarreau <w@xxxxxx>

Feel free to push the whole series to the next branch.

Thank you!
Willy



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux