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

Willy Tarreau w at 1wt.eu
Sun Sep 17 08:08:20 PDT 2023


On Sun, Sep 17, 2023 at 05:07:18PM +0200, Thomas Weißschuh wrote:
> On 2023-09-17 11:48:27+0200, Willy Tarreau wrote:
> > [..]
> > > 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 like it, I didn't think about varargs, it's an excellent idea! Let's
> > just do simpler, start with a first arg "syscall_num" that we may later
> > reuse for debugging, and just mark this one unused:
> > 
> >   static inline int __nolibc_enosys(int syscall_num, ...)
> >   {
> > 	(void)syscall_num;
> >   	return -ENOSYS;
> >   }
> 
> But which syscall_num to use, as the point of __nolibc_enosys() would be
> that no syscall number is available and the defines are missing.

good point :-)

> For debugging we could add a string argument, though.

That works for me.

Willy



More information about the linux-riscv mailing list