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 <[email protected]>
---
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)
-{
- 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;
-}
-
#define EXPECT_EQ(cond, expr, val) \
do { if (!(cond)) result(llen, SKIPPED); else ret += expect_eq(expr, llen, val); } while (0)
@@ -239,19 +214,6 @@ static int expect_gt(int expr, int llen, int val)
}
-#define EXPECT_LE(cond, expr, val) \
- do { if (!(cond)) result(llen, SKIPPED); else ret += expect_le(expr, llen, val); } while (0)
-
-static int expect_le(int expr, int llen, int val)
-{
- int ret = !(expr <= val);
-
- llen += printf(" = %d ", expr);
- result(llen, ret ? FAIL : OK);
- return ret;
-}
-
-
#define EXPECT_LT(cond, expr, val) \
do { if (!(cond)) result(llen, SKIPPED); else ret += expect_lt(expr, llen, val); } while (0)
@@ -348,24 +310,6 @@ static int expect_syserr2(int expr, int expret, int experr1, int experr2, int ll
}
-#define EXPECT_PTRZR(cond, expr) \
- do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrzr(expr, llen); } while (0)
-
-static int expect_ptrzr(const void *expr, int llen)
-{
- int ret = 0;
-
- llen += printf(" = <%p> ", expr);
- if (expr) {
- ret = 1;
- result(llen, FAIL);
- } else {
- result(llen, OK);
- }
- return ret;
-}
-
-
#define EXPECT_PTRNZ(cond, expr) \
do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrnz(expr, llen); } while (0)
@@ -417,18 +361,6 @@ static int expect_ptrne(const void *expr, int llen, const void *cmp)
return ret;
}
-#define EXPECT_PTRGE(cond, expr, cmp) \
- do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrge(expr, llen, cmp); } while (0)
-
-static int expect_ptrge(const void *expr, int llen, const void *cmp)
-{
- int ret = !(expr >= cmp);
-
- llen += printf(" = <%p> ", expr);
- result(llen, ret ? FAIL : OK);
- return ret;
-}
-
#define EXPECT_PTRGT(cond, expr, cmp) \
do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrgt(expr, llen, cmp); } while (0)
@@ -442,19 +374,6 @@ static int expect_ptrgt(const void *expr, int llen, const void *cmp)
}
-#define EXPECT_PTRLE(cond, expr, cmp) \
- do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrle(expr, llen, cmp); } while (0)
-
-static int expect_ptrle(const void *expr, int llen, const void *cmp)
-{
- int ret = !(expr <= cmp);
-
- llen += printf(" = <%p> ", expr);
- result(llen, ret ? FAIL : OK);
- return ret;
-}
-
-
#define EXPECT_PTRLT(cond, expr, cmp) \
do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrlt(expr, llen, cmp); } while (0)
@@ -546,24 +465,6 @@ static int expect_streq(const char *expr, int llen, const char *cmp)
}
-#define EXPECT_STRNE(cond, expr, cmp) \
- do { if (!(cond)) result(llen, SKIPPED); else ret += expect_strne(expr, llen, cmp); } while (0)
-
-static int expect_strne(const char *expr, int llen, const char *cmp)
-{
- int ret = 0;
-
- llen += printf(" = <%s> ", expr);
- if (strcmp(expr, cmp) == 0) {
- ret = 1;
- result(llen, FAIL);
- } else {
- result(llen, OK);
- }
- return ret;
-}
-
-
/* declare tests based on line numbers. There must be exactly one test per line. */
#define CASE_TEST(name) \
case __LINE__: llen += printf("%d %s", test, #name);
--
2.41.0
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 <[email protected]>
> ---
> 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)
{
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
>
>
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 <[email protected]>
> > ---
> > 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
> >
> >