[Tarantool-patches] [PATCH luajit] test: define UNUSED macros only once

Sergey Kaplun skaplun at tarantool.org
Wed Jan 29 17:55:16 MSK 2025


Hi, Sergey!
Thanks for the patch!
LGTM, with a minor comment below.

On 29.01.25, Sergey Bronnikov wrote:
> The macros `UNUSED` is widely used across the suite

Typo: s/macros/macro/

> `tarantool-c-tests`. The patch defines macros only once in

Typo: s/macros/macro/

> `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
> 

<snipped>

> 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))

Minor: I suggest to wrapping this into the `#ifndef`, since the
`UNUSED()` is a very common macro. The same one is used in the LuaJIT.
For now these macros are the same [1] but to avoid rewriting code in the
case of the changes, it is better to use `#ifndef` directive here.

> +
>  /*
>   * Test module, based on TAP 14 specification [1].
>   * [1]: https://testanything.org/tap-version-14-specification.html

<snipped>

[1]: https://gcc.gnu.org/onlinedocs/cpp/Undefining-and-Redefining-Macros.html

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list