lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 31 Jul 2023 09:08:15 +0200
From:   Thomas Weißschuh <linux@...ssschuh.net>
To:     Zhangjin Wu <falcon@...ylab.org>
Cc:     linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
        shuah@...nel.org, tanyuan@...ylab.org, w@....eu
Subject: Re: [PATCH 1/4] selftests/nolibc: drop unused test helpers

Note:

It seems your mail client does not add the prefix "Re: " to responses.
Is that intentional?

On 2023-07-31 14:48:26+0800, Zhangjin Wu wrote:
> Hi, Thomas
> 
> > As we want to enable compiler warnings in the future these would be
> > reported as unused functions.
> > 
> > If we need them in the future they are easy to recreate from their still
> > existing siblings.
> > 
> > Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
> > ---
> >  tools/testing/selftests/nolibc/nolibc-test.c | 99 ----------------------------
> >  1 file changed, 99 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
> > index 03b1d30f5507..53e2d448eded 100644
> > --- a/tools/testing/selftests/nolibc/nolibc-test.c
> > +++ b/tools/testing/selftests/nolibc/nolibc-test.c
> > @@ -161,31 +161,6 @@ static void result(int llen, enum RESULT r)
> >   * of failures, thus either 0 or 1.
> >   */
> >  
> > -#define EXPECT_ZR(cond, expr)				\
> > -	do { if (!(cond)) result(llen, SKIPPED); else ret += expect_zr(expr, llen); } while (0)
> > -
> > -static int expect_zr(int expr, int llen)
> > -{
> 
> Why not a simple 'static __attribute__((unused))' line, then, no need to
> add them again next time.
> 
>     -static int expect_zr(int expr, int llen)
>     +static __attribute__((unused))
>     +int expect_zr(int expr, int llen)
>      {

Personally I don't like having dead code lying around that needs to be
maintained and skipped over while reading.
It's not a given that we will need those helpers in the future at all.

Thomas

> 
> Thanks,
> Zhangjin
> 
> > -	int ret = !(expr == 0);
> > -
> > -	llen += printf(" = %d ", expr);
> > -	result(llen, ret ? FAIL : OK);
> > -	return ret;
> > -}
> > -
> > -
> > -#define EXPECT_NZ(cond, expr, val)			\
> > -	do { if (!(cond)) result(llen, SKIPPED); else ret += expect_nz(expr, llen; } while (0)
> > -
> > -static int expect_nz(int expr, int llen)
> > -{
> > -	int ret = !(expr != 0);
> > -
> > -	llen += printf(" = %d ", expr);
> > -	result(llen, ret ? FAIL : OK);
> > -	return ret;
> > -}
> > -
> > [...]
> > -- 
> > 2.41.0
> > 
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ