Skip to content

Commit 06854c4

Browse files
Add support for LLVM 21
- Enable new clang 21 warnings, disable inline as needed - Enable -fsanitize=vptr under UBSan for clang 21 - On macOS and Homebrew-installed LLVM 21, use Homebrew-packaged libc++ instead of XCode standard C++ library for linking - Replace some auto return types with spelled out ones - Disable modernize-use-scoped-lock and llvm-prefer-static-over-anonymous-namespaces clang-tidy checks globally - No longer disable cppcoreguidelines-pro-bounds-pointer-arithmetic check globally, instead suppress it inline where needed - Bump clang version to 21 in GitHub Actions build.yml - Add clang 20 to GitHub Actions old-compilers.yml - Bump clang version to 21 in CircleCI config
1 parent 595363f commit 06854c4

12 files changed

Lines changed: 106 additions & 26 deletions

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parameters:
77
default: "14"
88
CLANG_VERSION:
99
type: string
10-
default: "20"
10+
default: "21"
1111

1212
jobs:
1313
build-linux:
@@ -59,7 +59,7 @@ jobs:
5959
curl 'https://apt.llvm.org/llvm-snapshot.gpg.key' \
6060
| sudo apt-key add -
6161
sudo add-apt-repository -y \
62-
"deb http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main"
62+
"deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${CLANG_VERSION} main"
6363
sudo apt-get update
6464
sudo apt-get install -y clang-${CLANG_VERSION} \
6565
clang-tidy-${CLANG_VERSION} iwyu \
@@ -73,7 +73,7 @@ jobs:
7373
- run:
7474
name: Installing dependencies (LLVM Release)
7575
command: |
76-
sudo apt-get install -y libomp5-${CLANG_VERSION} \
76+
sudo apt-get install -y libomp5 \
7777
llvm-${CLANG_VERSION} lld-${CLANG_VERSION}
7878
- when:
7979
condition: << parameters.tsan >>

.clang-tidy

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@
99
# unfixable signatures
1010
# - cppcoreguidelines-avoid-c-arrays: duplicated by modernize-avoid-c-arrays
1111
# - cppcoreguidelines-macro-usage: does not respect __LINE__ in macro definition
12-
# - cppcoreguidelines-pro-bounds-pointer-arithmetic: because leaf nodes are
13-
# std::byte arrays
1412
# - cppcoreguidelines-pro-type-const-cast: because VALGRIND_MALLOCLIKE_BLOCK
1513
# expands a to C-style cast, and we have -Wold-style-cast anyway
1614
# - hicpp-avoid-c-arrays: duplicated by modernize-avoid-c-arrays
1715
# - hicpp-explicit-conversions: duplicated by google-explicit-constructor
1816
# - hicpp-no-assembler: Valgrind client requests
1917
# - modernize-use-equals-default: until foo() noexcept = default is accepted by
2018
# clang
21-
Checks: '*,-altera-id-dependent-backward-branch,-altera-struct-pack-align,-altera-unroll-loops,-boost-use-ranges,-bugprone-easily-swappable-parameters,-bugprone-use-after-move,-clang-diagnostic-error,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-cplusplus.Move,-clang-analyzer-unix.Malloc,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-init-variables,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-cstyle-cast,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-union-access,-fuchsia-default-arguments-calls,-fuchsia-default-arguments-declarations,-fuchsia-overloaded-operator,-google-readability-braces-around-statements,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-braces-around-statements,-hicpp-explicit-conversions,-hicpp-invalid-access-moved,-hicpp-member-init,-hicpp-named-parameter,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-use-equals-default,-llvm-include-order,-llvmlibc*,-misc-no-recursion,-misc-non-private-member-variables-in-classes,-modernize-use-equals-default,-modernize-use-trailing-return-type,-portability-simd-intrinsics,-readability-braces-around-statements,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-named-parameter,-readability-magic-numbers'
19+
# - modernize-use-scoped-lock: std::lock_guard is perfectly fine for its use
20+
# cases
21+
# - llvm-prefer-static-over-anonymous-namespace: I prefer anonymous namespace
22+
Checks: '*,-altera-id-dependent-backward-branch,-altera-struct-pack-align,-altera-unroll-loops,-boost-use-ranges,-bugprone-easily-swappable-parameters,-bugprone-use-after-move,-clang-diagnostic-error,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-cplusplus.Move,-clang-analyzer-unix.Malloc,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-init-variables,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-cstyle-cast,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-union-access,-fuchsia-default-arguments-calls,-fuchsia-default-arguments-declarations,-fuchsia-overloaded-operator,-google-readability-braces-around-statements,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-braces-around-statements,-hicpp-explicit-conversions,-hicpp-invalid-access-moved,-hicpp-member-init,-hicpp-named-parameter,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-use-equals-default,-llvm-include-order,-llvmlibc*,-llvm-prefer-static-over-anonymous-namespace,-misc-no-recursion,-misc-non-private-member-variables-in-classes,-modernize-use-equals-default,-modernize-use-scoped-lock,-modernize-use-trailing-return-type,-portability-simd-intrinsics,-readability-braces-around-statements,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-named-parameter,-readability-magic-numbers'
2223
WarningsAsErrors: '*'
2324
CheckOptions:
2425
- key: performance-unnecessary-value-param.AllowedTypes

.github/workflows/build.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,59 +99,59 @@ jobs:
9999
os: ubuntu-latest
100100
COMPILER: gcc
101101

102-
- name: clang 20 Release
102+
- name: clang 21 Release
103103
os: ubuntu-latest
104104
BUILD_TYPE: Release
105105
COMPILER: clang
106106

107-
- name: clang 20 Release with ASan
107+
- name: clang 21 Release with ASan
108108
os: ubuntu-latest
109109
BUILD_TYPE: Release
110110
SANITIZE_ADDRESS: ON
111111
COMPILER: clang
112112

113-
- name: clang 20 Release with TSan
113+
- name: clang 21 Release with TSan
114114
os: ubuntu-latest
115115
BUILD_TYPE: Release
116116
SANITIZE_THREAD: ON
117117
COMPILER: clang
118118

119-
- name: clang 20 Release with UBSan
119+
- name: clang 21 Release with UBSan
120120
os: ubuntu-latest
121121
BUILD_TYPE: Release
122122
SANITIZE_UB: ON
123123
COMPILER: clang
124124

125-
- name: clang 20 Debug
125+
- name: clang 21 Debug
126126
os: ubuntu-latest
127127
BUILD_TYPE: Debug
128128
COMPILER: clang
129129

130-
- name: clang 20 Debug with ASan
130+
- name: clang 21 Debug with ASan
131131
os: ubuntu-latest
132132
BUILD_TYPE: Debug
133133
SANITIZE_ADDRESS: ON
134134
COMPILER: clang
135135

136-
- name: clang 20 Debug with TSan
136+
- name: clang 21 Debug with TSan
137137
os: ubuntu-latest
138138
BUILD_TYPE: Debug
139139
SANITIZE_THREAD: ON
140140
COMPILER: clang
141141

142-
- name: clang 20 Debug with UBSan
142+
- name: clang 21 Debug with UBSan
143143
os: ubuntu-latest
144144
BUILD_TYPE: Debug
145145
SANITIZE_UB: ON
146146
COMPILER: clang
147147

148-
- name: clang 20 Release static analysis
148+
- name: clang 21 Release static analysis
149149
os: ubuntu-latest
150150
BUILD_TYPE: Release
151151
COMPILER: clang
152152
STATIC_ANALYSIS: ON
153153

154-
- name: clang 20 Debug static analysis
154+
- name: clang 21 Debug static analysis
155155
os: ubuntu-latest
156156
BUILD_TYPE: Debug
157157
COMPILER: clang
@@ -293,25 +293,25 @@ jobs:
293293
curl 'https://apt.llvm.org/llvm-snapshot.gpg.key' \
294294
| sudo apt-key add -
295295
sudo add-apt-repository -y \
296-
"deb http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main"
296+
"deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main"
297297
sudo apt-get update
298-
sudo apt-get install -y clang-20 iwyu
298+
sudo apt-get install -y clang-21 iwyu
299299
if: runner.os == 'Linux' && env.COMPILER == 'clang'
300300

301301
- name: Setup dependencies for Linux LLVM (Release)
302-
run: sudo apt-get install -y libomp5-20 llvm-20 lld-20
302+
run: sudo apt-get install -y libomp5 llvm-21 lld-21
303303
if: >
304304
runner.os == 'Linux' && env.COMPILER == 'clang'
305305
&& env.BUILD_TYPE == 'Release'
306306
307307
- name: Setup dependencies for Linux LLVM (static analysis)
308-
run: sudo apt-get install -y clang-tools-20
308+
run: sudo apt-get install -y clang-tools-21
309309
if: >
310310
runner.os == 'Linux' && env.COMPILER == 'clang'
311311
&& env.STATIC_ANALYSIS == 'ON'
312312
313313
- name: Setup dependencies for Linux LLVM (not static analysis)
314-
run: sudo apt-get install -y clang-tidy-20
314+
run: sudo apt-get install -y clang-tidy-21
315315
if: >
316316
runner.os == 'Linux' && env.COMPILER == 'clang'
317317
&& env.STATIC_ANALYSIS != 'ON'
@@ -348,7 +348,7 @@ jobs:
348348
export CC=gcc-$V
349349
export CXX=g++-$V
350350
elif [[ $COMPILER == "clang" ]]; then
351-
V=20
351+
V=21
352352
export CC=clang-$V
353353
export CXX=clang++-$V
354354
if [[ $BUILD_TYPE == "Release" ]]; then
@@ -401,7 +401,7 @@ jobs:
401401
- name: clang static analysis
402402
working-directory: ${{github.workspace}}/build
403403
run: |
404-
/usr/bin/scan-build-20 --status-bugs -stats -analyze-headers \
404+
/usr/bin/scan-build-21 --status-bugs -stats -analyze-headers \
405405
--force-analyze-debug-code make -j3 -k;
406406
if: env.STATIC_ANALYSIS == 'ON' && env.COMPILER == 'clang'
407407

.github/workflows/old-compilers.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,52 @@ jobs:
469469
COMPILER: clang
470470
VERSION: 19
471471

472+
- name: clang 20 Release
473+
BUILD_TYPE: Release
474+
COMPILER: clang
475+
VERSION: 20
476+
477+
- name: clang 20 Release with ASan
478+
BUILD_TYPE: Release
479+
SANITIZE_ADDRESS: ON
480+
COMPILER: clang
481+
VERSION: 20
482+
483+
- name: clang 20 Release with TSan
484+
BUILD_TYPE: Release
485+
SANITIZE_THREAD: ON
486+
COMPILER: clang
487+
VERSION: 20
488+
489+
- name: clang 20 Release with UBSan
490+
BUILD_TYPE: Release
491+
SANITIZE_UB: ON
492+
COMPILER: clang
493+
VERSION: 20
494+
495+
- name: clang 20 Debug
496+
BUILD_TYPE: Debug
497+
COMPILER: clang
498+
VERSION: 20
499+
500+
- name: clang 20 Debug with ASan
501+
BUILD_TYPE: Debug
502+
SANITIZE_ADDRESS: ON
503+
COMPILER: clang
504+
VERSION: 20
505+
506+
- name: clang 20 Debug with TSan
507+
BUILD_TYPE: Debug
508+
SANITIZE_THREAD: ON
509+
COMPILER: clang
510+
VERSION: 20
511+
512+
- name: clang 20 Debug with UBSan
513+
BUILD_TYPE: Debug
514+
SANITIZE_UB: ON
515+
COMPILER: clang
516+
VERSION: 20
517+
472518
- name: GCC 10 Release
473519
BUILD_TYPE: Release
474520
COMPILER: gcc

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ set(CLANG_LT_13_CXX_WARNING_FLAGS "-Wreserved-id-macro")
8888
set(CLANG_GE_13_CXX_WARNING_FLAGS "-Wreserved-identifier")
8989
# Do not enable clang 16+ -Wunsafe-buffer-usage because it warns on all memcpy
9090
# calls and our pointer- and span-like class implementations.
91+
set(CLANG_GE_21_CXX_WARNING_FLAGS "-Wnrvo" "-Wunique-object-duplication"
92+
"-Wshift-bool" "-Wc99-designator" "-Wms-bitfield-padding")
9193

9294
set(GCC_CXX_WARNING_FLAGS
9395
# Warning groups
@@ -296,6 +298,9 @@ if(SANITIZE_UB)
296298
if(is_clang AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)
297299
list(APPEND SANITIZER_CXX_FLAGS "-fsanitize=implicit-bitfield-conversion")
298300
endif()
301+
if(is_clang AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 21.0)
302+
list(APPEND SANITIZER_CXX_FLAGS "-fsanitize=vptr")
303+
endif()
299304
endif()
300305

301306
set(SANITIZER_LD_FLAGS "-fsanitize=undefined")
@@ -402,9 +407,11 @@ set(cxx_ge_12 "$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,12.0>")
402407
set(cxx_lt_13 "$<VERSION_LESS:$<CXX_COMPILER_VERSION>,13.0>")
403408
set(cxx_ge_13 "$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,13.0>")
404409
set(cxx_ge_14 "$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,14.0>")
410+
set(cxx_ge_21 "$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,21.0>")
405411
set(is_clang_lt_13_not_windows "$<AND:${is_clang_not_windows},${cxx_lt_13}>")
406412
set(is_clang_ge_13_not_windows "$<AND:${is_clang_not_windows},${cxx_ge_13}>")
407413
set(is_clang_ge_14_not_windows "$<AND:${is_clang_not_windows},${cxx_ge_14}>")
414+
set(is_clang_ge_21_not_windows "$<AND:${is_clang_not_windows},${cxx_ge_21}>")
408415
set(is_gxx_ge_11 "$<AND:${is_gxx_genex},${cxx_ge_11}>")
409416
set(is_gxx_ge_12 "$<AND:${is_gxx_genex},${cxx_ge_12}>")
410417
set(is_gxx_ge_14 "$<AND:${is_gxx_genex},${cxx_ge_14}>")
@@ -709,6 +716,7 @@ function(COMMON_TARGET_PROPERTIES TARGET)
709716
"$<$<AND:${is_standalone},${is_any_clang_genex},${is_not_windows}>:${CLANG_CXX_WARNING_FLAGS}>"
710717
"$<$<AND:${is_standalone},${is_clang_lt_13_not_windows}>:${CLANG_LT_13_CXX_WARNING_FLAGS}>"
711718
"$<$<AND:${is_standalone},${is_clang_ge_13_not_windows}>:${CLANG_GE_13_CXX_WARNING_FLAGS}>"
719+
"$<$<AND:${is_standalone},${is_clang_ge_21_not_windows}>:${CLANG_GE_21_CXX_WARNING_FLAGS}>"
712720
"$<$<AND:${is_standalone},${is_gxx_genex}>:${GCC_CXX_WARNING_FLAGS}>"
713721
"$<$<AND:${is_standalone},${is_gxx_ge_11}>:${GCC_GE_11_CXX_WARNING_FLAGS}>"
714722
"$<$<AND:${is_standalone},${is_gxx_ge_12}>:${GCC_GE_12_CXX_WARNING_FLAGS}>"
@@ -721,6 +729,8 @@ function(COMMON_TARGET_PROPERTIES TARGET)
721729
target_link_options(${TARGET} INTERFACE "$<${coverage_on}:--coverage>")
722730
target_link_options(${TARGET} PRIVATE
723731
"$<${is_apple_clang_genex}:-Wl,-no_warn_duplicate_libraries>"
732+
"$<$<AND:$<PLATFORM_ID:Darwin>,${is_clang_genex}>:-L/opt/homebrew/opt/llvm/lib/c++>"
733+
"$<$<AND:$<PLATFORM_ID:Darwin>,${is_clang_genex}>:-Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++>"
724734
"${SANITIZER_LD_FLAGS}"
725735
)
726736
target_link_libraries(${TARGET} PRIVATE

art_internal_impl.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,7 @@ class basic_inode_4 : public basic_inode_4_parent<ArtPolicy> {
14441444
keys.byte_array.cbegin(), keys.byte_array.cbegin() + children_count_));
14451445
}
14461446

1447+
UNODB_DETAIL_DISABLE_CLANG_21_WARNING("-Wnrvo")
14471448
[[nodiscard]] constexpr auto leave_last_child(std::uint8_t child_to_delete,
14481449
db_type &db_instance) noexcept {
14491450
UNODB_DETAIL_ASSERT(this->is_min_size());
@@ -1465,6 +1466,7 @@ class basic_inode_4 : public basic_inode_4_parent<ArtPolicy> {
14651466
}
14661467
return child_to_leave_ptr;
14671468
}
1469+
UNODB_DETAIL_RESTORE_CLANG_21_WARNINGS()
14681470

14691471
[[nodiscard, gnu::pure]] find_result find_child(std::byte key_byte) noexcept {
14701472
#ifdef UNODB_DETAIL_X86_64

benchmark/micro_benchmark_node_utils.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ number_to_full_node_tree_with_gaps_key(std::uint64_t i) noexcept {
229229
// Key vectors
230230

231231
template <typename NumberToKeyFn>
232-
[[nodiscard]] auto generate_keys_to_limit(std::uint64_t key_limit,
233-
NumberToKeyFn number_to_key_fn) {
232+
[[nodiscard]] std::vector<std::uint64_t> generate_keys_to_limit(
233+
std::uint64_t key_limit, NumberToKeyFn number_to_key_fn) {
234234
std::vector<std::uint64_t> result;
235235
std::uint64_t i = 0;
236236
while (true) {

global.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@
9292
/// Re-enable the warning that was previously disabled with
9393
/// UNODB_DETAIL_DISABLE_CLANG_WARNING().
9494

95+
/// \def UNODB_DETAIL_DISABLE_CLANG_21_WARNING(x)
96+
/// Disable a clang version 21 or later warning \a x until
97+
/// UNODB_DETAIL_RESTORE_CLANG_21_WARNINGS().
98+
99+
/// \def UNODB_DETAIL_RESTORE_CLANG_21_WARNINGS()
100+
/// Re-enable the warning that was previously disabled with
101+
/// UNODB_DETAIL_DISABLE_CLANG_21_WARNING().
102+
95103
/// \def UNODB_DETAIL_DISABLE_GCC_WARNING(x)
96104
/// Disable a GCC warning \a x until UNODB_DETAIL_RESTORE_GCC_WARNINGS()
97105

@@ -345,6 +353,14 @@
345353
#define UNODB_DETAIL_RESTORE_CLANG_WARNINGS()
346354
#endif
347355

356+
#if defined(__clang__) && __clang_major__ >= 21
357+
#define UNODB_DETAIL_DISABLE_CLANG_21_WARNING(x) UNODB_DETAIL_DISABLE_WARNING(x)
358+
#define UNODB_DETAIL_RESTORE_CLANG_21_WARNINGS() UNODB_DETAIL_RESTORE_WARNINGS()
359+
#else
360+
#define UNODB_DETAIL_DISABLE_CLANG_21_WARNING(x)
361+
#define UNODB_DETAIL_RESTORE_CLANG_21_WARNINGS()
362+
#endif
363+
348364
#if defined(__GNUG__) && !defined(__clang__)
349365
#define UNODB_DETAIL_DISABLE_GCC_WARNING(x) UNODB_DETAIL_DISABLE_WARNING(x)
350366
#define UNODB_DETAIL_RESTORE_GCC_WARNINGS() UNODB_DETAIL_RESTORE_WARNINGS()

qsbr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ void qsbr_per_thread::orphan_pending_requests() noexcept {
231231
UNODB_DETAIL_ASSERT(current_interval_orphan_list_node == nullptr);
232232
}
233233

234+
UNODB_DETAIL_DISABLE_CLANG_21_WARNING("-Wnrvo")
234235
detail::qsbr_epoch qsbr::register_thread() noexcept {
235236
auto old_state = get_state();
236237

@@ -279,6 +280,7 @@ detail::qsbr_epoch qsbr::register_thread() noexcept {
279280
}
280281
// LCOV_EXCL_STOP
281282
}
283+
UNODB_DETAIL_RESTORE_CLANG_21_WARNINGS()
282284

283285
void qsbr::unregister_thread(std::uint64_t quiescent_states_since_epoch_change,
284286
detail::qsbr_epoch thread_epoch,

test/test_key_encode_decode.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ class key_factory {
678678
const auto sz{kv.size()};
679679
key_views.emplace_back(sz);
680680
auto& a = key_views.back(); // a *reference* to data emplaced_back.
681+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
681682
std::copy(kv.data(), kv.data() + sz, a.begin()); // copy data to inner vec
682683
return {a.data(), sz}; // view of inner vec's data.
683684
}
@@ -702,6 +703,7 @@ void do_simple_pad_test(unodb::key_encoder& enc, std::string_view sv) {
702703
// Check the pad length.
703704
const st padlen{static_cast<st>(unodb::key_encoder::maxlen - sz)};
704705
st tmp;
706+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
705707
std::memcpy(&tmp, kv.data() + sz + 1, sizeof(st)); // copy out pad length.
706708
const st tmp2 = unodb::detail::bswap(tmp); // decode.
707709
UNODB_EXPECT_EQ(tmp2, padlen)

0 commit comments

Comments
 (0)