Skip to content

misc: fix clang-specific warnings in luajit's asserts

Summary

  • sptree: don't use variable length arrays

This causes warnings if compiled with clang-18. Let's define a sane upper limit for the max tree depth and use it for allocating arrays on stack. Note that we don't really care about performance because sptree is used only in unit tests.

Closes #10354

NO_DOC=internal NO_TEST=internal NO_CHANGELOG=internal

  • misc: fix clang-specific warnings in luajit's asserts

Apparently, clang 18 is not particularly happy about luajit's static assert implementation:

In file included from tarantool/src/box/box.cc:38:
In file included from tarantool/src/lua/utils.h:47:
In file included from tarantool/third_party/luajit/src/lj_state.h:9:
tarantool/third_party/luajit/src/lj_obj.h:488:1: error: variable length arrays in C++ are a Clang extension; did you mean to use 'static_assert'? [-Werror,-Wvla-extension-static-assert]
  488 | LJ_STATIC_ASSERT(offsetof(Node, val) == 0);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tarantool/third_party/luajit/src/lj_def.h:370:71: note: expanded from macro 'LJ_STATIC_ASSERT'
  370 |   extern void LJ_ASSERT_NAME(__COUNTER__)(int STATIC_ASSERTION_FAILED[(cond)?1:-1])
      |                                                                       ^~~~~~~~~~~
tarantool/third_party/luajit/src/lj_obj.h:488:18: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
  488 | LJ_STATIC_ASSERT(offsetof(Node, val) == 0);
      | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
tarantool/src/trivia/util.h:273:33: note: expanded from macro 'offsetof'
  273 | #define offsetof(type, member) ((size_t) &((type *)0)->member)
      |                                 ^
tarantool/third_party/luajit/src/lj_def.h:370:72: note: expanded from macro 'LJ_STATIC_ASSERT'
  370 |   extern void LJ_ASSERT_NAME(__COUNTER__)(int STATIC_ASSERTION_FAILED[(cond)?1:-1])
      |

Luckily, we can just mute this.

NO_DOC= NO_TEST= NO_CHANGELOG=

Close #... Docs follow-up: not necessary / new issue

Merge request reports