Skip to content

Commit

Permalink
test: define UNUSED macro only once
Browse files Browse the repository at this point in the history
The macro `UNUSED` is widely used across the suite
`tarantool-c-tests`. The patch defines macro only once in
`test.h` to reuse it in other tests and removes definitions in
tests.
  • Loading branch information
ligurio committed Jan 30, 2025
1 parent baa7554 commit 0b6e814
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 12 deletions.
2 changes: 0 additions & 2 deletions test/tarantool-c-tests/fix-yield-c-hook.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions test/tarantool-c-tests/gh-8594-sysprof-ffunc-crash.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 0 additions & 2 deletions test/tarantool-c-tests/lj-1168-unmarked-finalizer-tab.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions test/tarantool-c-tests/lj-549-lua-load.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions test/tarantool-c-tests/misclib-sysprof-capi.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/tarantool-c-tests/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include <stdio.h>
#include <stdlib.h>

#ifndef UNUSED
#define UNUSED(x) ((void)(x))
#endif

/*
* Test module, based on TAP 14 specification [1].
* [1]: https://testanything.org/tap-version-14-specification.html
Expand Down
2 changes: 0 additions & 2 deletions test/tarantool-c-tests/unit-tap.test.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "test.h"

#define UNUSED(x) ((void)(x))

static int test_ok(void *test_state)
{
UNUSED(test_state);
Expand Down

0 comments on commit 0b6e814

Please sign in to comment.