[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZMi9QAIh4/0GGh5h@1wt.eu>
Date: Tue, 1 Aug 2023 10:07:28 +0200
From: Willy Tarreau <w@....eu>
To: Thomas Weißschuh <linux@...ssschuh.net>
Cc: Shuah Khan <shuah@...nel.org>, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org, Yuan Tan <tanyuan@...ylab.org>,
Zhangjin Wu <falcon@...ylab.org>
Subject: Re: [PATCH v2 07/10] selftests/nolibc: avoid unused arguments
warnings
On Tue, Aug 01, 2023 at 07:30:14AM +0200, Thomas Weißschuh wrote:
> This warnings will be enabled later so avoid triggering it.
>
> Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
> ---
> tools/testing/selftests/nolibc/nolibc-test.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
> index 53a3773c7790..cb17cccd0bc7 100644
> --- a/tools/testing/selftests/nolibc/nolibc-test.c
> +++ b/tools/testing/selftests/nolibc/nolibc-test.c
> @@ -1089,7 +1089,8 @@ static int smash_stack(void)
> return 1;
> }
>
> -static int run_protection(int min, int max)
> +static int run_protection(int __attribute__((unused)) min,
> + int __attribute__((unused)) max)
This one is used to silence -Wunused-parameter I guess. It's one of
the rare warnings that I find totally useless in field, because it's
simply against the principle of using function pointers with different
functions having the same interface but different implementations. As
your code evolves you end up with unused on absolutely *all* of the
arguments of *all* such functions, which makes them a real pain to add
and tends to encourage poor practices such as excessive code reuse just
by laziness or boredom. BTW it's one of those that are already disabled
in the kernel and we could very well do the same here.
Willy
Powered by blists - more mailing lists