[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230814172233.225944-1-falcon@tinylab.org>
Date: Tue, 15 Aug 2023 01:22:33 +0800
From: Zhangjin Wu <falcon@...ylab.org>
To: falcon@...ylab.org
Cc: arnd@...db.de, david.laight@...lab.com,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
thomas@...ch.de, w@....eu
Subject: Re: [PATCH v5] tools/nolibc: fix up size inflate regression
Hi, Willy
> [...]
> > >
> > > /* __systry2() is used to select one of two provided low level syscalls */
> > > #define __systry2(a, sys_a, sys_b) \
> > > ((NOLIBC__NR_##a != NOLIBC__NR_NOSYS) ? (sys_a) : (sys_b))
> >
> > But this supposes that all of them are manually defined as you did above.
> > I'd rather implement an ugly is_numeric() macro based on argument
> > resolution. I've done it once in another project, I don't remember
> > precisely where it is but I vaguely remember that it used to check
> > that the string resolution of the argument gave a letter (when it
> > does not exist) or a digit (when it does). I can look into that later
> > if needed. But please avoid extra macro definitions as much as possible,
> > they're a real pain to handle in the code. There's no error when one is
> > missing or has a typo, it's difficult to follow them and they don't
> > appear in the debugger.
> >
>
> Yeah, your reply inspired me to look into the IS_ENABLED() from
> ../include/linux/kconfig.h macro again, there was a __is_defined() there, let's
> throw away the ugly sysnr.h. I thought of IS_ENABLED() was only for y/n/m
> before, but it does return 0 when the macro is not defined, it uses the same
> trick in syscall() to calculate the number of arguments, if the macro is not
> defined, then, 0 "argument".
>
The above trick is only for ""#define something 1" ;-)
BR,
Zhangjin
Powered by blists - more mailing lists