[Tarantool-patches] [PATCH luajit] test: define UNUSED macros only once
Sergey Bronnikov
estetus at gmail.com
Wed Jan 29 12:39:43 MSK 2025
The macros `UNUSED` is widely used across the suite
`tarantool-c-tests`. The patch defines macros only once in
`test.h` to reuse it in other tests and removes definitions in
tests.
---
Branch: https://github.com/tarantool/luajit/tree/ligurio/gh-xxxx-define-unused
test/tarantool-c-tests/fix-yield-c-hook.test.c | 2 --
test/tarantool-c-tests/gh-8594-sysprof-ffunc-crash.test.c | 2 --
test/tarantool-c-tests/lj-1168-unmarked-finalizer-tab.test.c | 2 --
test/tarantool-c-tests/lj-549-lua-load.test.c | 2 --
test/tarantool-c-tests/misclib-sysprof-capi.test.c | 2 --
test/tarantool-c-tests/test.h | 2 ++
test/tarantool-c-tests/unit-tap.test.c | 2 --
7 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/test/tarantool-c-tests/fix-yield-c-hook.test.c b/test/tarantool-c-tests/fix-yield-c-hook.test.c
index 0e9fa5d6..aff4a371 100644
--- a/test/tarantool-c-tests/fix-yield-c-hook.test.c
+++ b/test/tarantool-c-tests/fix-yield-c-hook.test.c
@@ -3,8 +3,6 @@
#include "test.h"
#include "utils.h"
-#define UNUSED(x) ((void)(x))
-
/*
* This test demonstrates LuaJIT's incorrect behaviour, when
* calling `lua_yield()` inside a C hook.
diff --git a/test/tarantool-c-tests/gh-8594-sysprof-ffunc-crash.test.c b/test/tarantool-c-tests/gh-8594-sysprof-ffunc-crash.test.c
index 769d333a..2550f43c 100644
--- a/test/tarantool-c-tests/gh-8594-sysprof-ffunc-crash.test.c
+++ b/test/tarantool-c-tests/gh-8594-sysprof-ffunc-crash.test.c
@@ -46,8 +46,6 @@
* * https://github.com/tarantool/tarantool/issues/9387
*/
-#define UNUSED(x) ((void)(x))
-
#define MESSAGE "Canary is alive"
#define LUACALL "local a = tostring('" MESSAGE "') return a"
diff --git a/test/tarantool-c-tests/lj-1168-unmarked-finalizer-tab.test.c b/test/tarantool-c-tests/lj-1168-unmarked-finalizer-tab.test.c
index 9e57efb8..2d54da89 100644
--- a/test/tarantool-c-tests/lj-1168-unmarked-finalizer-tab.test.c
+++ b/test/tarantool-c-tests/lj-1168-unmarked-finalizer-tab.test.c
@@ -3,8 +3,6 @@
#include "test.h"
-#define UNUSED(x) ((void)(x))
-
/*
* This test demonstrates LuaJIT's incorrect behaviour on
* loading Lua chunk with cdata numbers.
diff --git a/test/tarantool-c-tests/lj-549-lua-load.test.c b/test/tarantool-c-tests/lj-549-lua-load.test.c
index 42a14be5..b0e94f6f 100644
--- a/test/tarantool-c-tests/lj-549-lua-load.test.c
+++ b/test/tarantool-c-tests/lj-549-lua-load.test.c
@@ -3,8 +3,6 @@
#include "lj_def.h"
-#define UNUSED(x) ((void)(x))
-
/*
* XXX: In C language, objects with static storage duration have
* to be initialized with constant expressions or with aggregate
diff --git a/test/tarantool-c-tests/misclib-sysprof-capi.test.c b/test/tarantool-c-tests/misclib-sysprof-capi.test.c
index 21e40d22..f0dc4405 100644
--- a/test/tarantool-c-tests/misclib-sysprof-capi.test.c
+++ b/test/tarantool-c-tests/misclib-sysprof-capi.test.c
@@ -18,8 +18,6 @@
/* Need for skipcond for OS and ARCH. */
#include "lj_arch.h"
-#define UNUSED(x) ((void)(x))
-
/* --- utils -------------------------------------------------- */
#define SYSPROF_INTERVAL_DEFAULT 100
diff --git a/test/tarantool-c-tests/test.h b/test/tarantool-c-tests/test.h
index 3b22fb92..c1717932 100644
--- a/test/tarantool-c-tests/test.h
+++ b/test/tarantool-c-tests/test.h
@@ -4,6 +4,8 @@
#include <stdio.h>
#include <stdlib.h>
+#define UNUSED(x) ((void)(x))
+
/*
* Test module, based on TAP 14 specification [1].
* [1]: https://testanything.org/tap-version-14-specification.html
diff --git a/test/tarantool-c-tests/unit-tap.test.c b/test/tarantool-c-tests/unit-tap.test.c
index ca0709ca..1f9a37ef 100644
--- a/test/tarantool-c-tests/unit-tap.test.c
+++ b/test/tarantool-c-tests/unit-tap.test.c
@@ -1,7 +1,5 @@
#include "test.h"
-#define UNUSED(x) ((void)(x))
-
static int test_ok(void *test_state)
{
UNUSED(test_state);
--
2.34.1
More information about the Tarantool-patches
mailing list