From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Willy Tarreau <w@1wt.eu>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>, Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 2/4] tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks
Date: Sun, 17 Sep 2023 07:49:57 +0200 [thread overview]
Message-ID: <2bd688b7-5f1b-44ca-a41b-6e90dc3e8557@t-8ch.de> (raw)
In-Reply-To: <20230917025851.GE9646@1wt.eu>
On 2023-09-17 04:58:51+0200, Willy Tarreau wrote:
> On Thu, Sep 14, 2023 at 06:01:18PM +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.
>
> Just out of curiosity, did you find a valid case for enabling this
> warning or were you trying various combinations ? I'm asking because
> I've never seen it enabled anywhere given that it's probably the most
> useless and unusable warning: as soon as you're dealing with function
> pointers, you start to have multiple functions with a similar
> prototype, some of which just don't need certain arguments, and the
> only way to shut the warning is to significantly uglify the code.
nolibc-test uses it currently and I also used it in some projects.
> If really needed, I'm wondering if instead we shouldn't have an
> "no_syscall*" set of macros, that would have the same signature
> as my_syscall* to just consume all args in the same order and
> return -ENOSYS. E.g, consider the following:
>
> @@ -934,6 +960,11 @@ int sys_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeva
> #endif
> return my_syscall5(__NR__newselect, nfds, rfds, wfds, efds, timeout);
> #else
> + (void)nfds;
> + (void)rfds;
> + (void)wfds;
> + (void)efds;
> + (void)timeout;
> return -ENOSYS;
> #endif
>
> It would become:
>
> @@ -934,6 +960,11 @@ int sys_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeva
> #endif
> return my_syscall5(__NR__newselect, nfds, rfds, wfds, efds, timeout);
> #else
> + return no_syscall5(nfds, rfds, wfds, efds, timeout);
> - return -ENOSYS;
> #endif
>
> What do you think ?
The idea sounds good. But "no_syscall5" sounds a bit non-obvious to me.
Maybe the macro-equivalent of this?
static inline int __nolibc_enosys(...)
{
return -ENOSYS;
}
The only-vararg function unfortunately needs C23 so we can't use it.
It's clear to the users that this is about ENOSYS and we don't need a
bunch of new macros similar.
I'll check if it is cleaner to implement a generic macro or a few
numbered ones.
Thomas
next prev parent reply other threads:[~2023-09-17 5:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 16:01 [PATCH 0/4] tools/nolibc: cleanups for syscall fallbacks Thomas Weißschuh
2023-09-14 16:01 ` [PATCH 1/4] selftests/nolibc: allow building i386 with multiarch compiler Thomas Weißschuh
2023-09-17 2:49 ` Willy Tarreau
2023-09-14 16:01 ` [PATCH 2/4] tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks Thomas Weißschuh
2023-09-17 2:58 ` Willy Tarreau
2023-09-17 5:49 ` Thomas Weißschuh [this message]
2023-09-17 9:48 ` Willy Tarreau
2023-09-17 15:07 ` Thomas Weißschuh
2023-09-17 15:08 ` Willy Tarreau
2023-09-14 16:01 ` [PATCH 3/4] tools/nolibc: don't define new syscall number Thomas Weißschuh
2023-09-17 2:59 ` Willy Tarreau
2023-09-14 16:01 ` [PATCH 4/4] tools/nolibc: automatically detect necessity to use pselect6 Thomas Weißschuh
2023-09-17 3:07 ` Willy Tarreau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2bd688b7-5f1b-44ca-a41b-6e90dc3e8557@t-8ch.de \
--to=linux@weissschuh.net \
--cc=aou@eecs.berkeley.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=shuah@kernel.org \
--cc=w@1wt.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®