Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org,
	Sergey Kaplun <skaplun@tarantool.org>
Subject: [Tarantool-patches] [PATCH luajit] test: define UNUSED macros only once
Date: Wed, 29 Jan 2025 12:39:43 +0300	[thread overview]
Message-ID: <9b29c3fc69a0245861959fe80a322dc84ba8160b.1738143566.git.sergeyb@tarantool.org> (raw)

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

             reply	other threads:[~2025-01-29  9:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-29  9:39 Sergey Bronnikov via Tarantool-patches [this message]
2025-01-29 14:55 ` Sergey Kaplun via Tarantool-patches
2025-01-30 13:55   ` Sergey Bronnikov via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9b29c3fc69a0245861959fe80a322dc84ba8160b.1738143566.git.sergeyb@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=estetus@gmail.com \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit] test: define UNUSED macros only once' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox