[Tarantool-patches] [PATCH luajit] test: define UNUSED macros only once
Sergey Bronnikov
sergeyb at tarantool.org
Thu Jan 30 16:55:36 MSK 2025
Hi, Sergey,
thanks for review! Changes force-pushed.
Sergey
On 29.01.2025 17:55, Sergey Kaplun via Tarantool-patches wrote:
> 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/
Fixed.
>
>> `tarantool-c-tests`. The patch defines macros only once in
> Typo: s/macros/macro/
Fixed.
>
>> `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.
Updated:
--- a/test/tarantool-c-tests/test.h
+++ b/test/tarantool-c-tests/test.h
@@ -4,7 +4,9 @@
#include <stdio.h>
#include <stdlib.h>
+#ifndef UNUSED
#define UNUSED(x) ((void)(x))
+#endif
/*
* Test module, based on TAP 14 specification [1].
>
>> +
>> /*
>> * 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20250130/6c9b1012/attachment.htm>
More information about the Tarantool-patches
mailing list