Skip to content
Snippets Groups Projects

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

Merged Dmitry Ivanov requested to merge funbringer/2.11.2-clang-18-fix-compilation into 2.11.2-picodata
  1. Sep 27, 2024
    • Vladimir Davydov's avatar
      sptree: don't use variable length arrays · 6281e617
      Vladimir Davydov authored and Dmitry Ivanov's avatar Dmitry Ivanov committed
      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
      6281e617
    • Dmitry Ivanov's avatar
      misc: fix clang-specific warnings in luajit's asserts · ff87c937
      Dmitry Ivanov authored
      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=<nothing interesting here>
      NO_TEST=<tested during build time>
      NO_CHANGELOG=<nothing interesting here>
      ff87c937
Loading