chore: Enable clang-tidy misc checks (#6655)

This commit is contained in:
Alex Kremer
2026-03-31 18:29:45 +01:00
committed by GitHub
parent c3fae847f3
commit 2502befb42
469 changed files with 3915 additions and 3965 deletions

View File

@@ -191,16 +191,16 @@ public:
testcase("Basics");
{
TIBase::ResetStatesGuard rsg{true};
TIBase::ResetStatesGuard const rsg{true};
TIBase b;
TIBase const b;
BEAST_EXPECT(b.use_count() == 1);
b.addWeakRef();
BEAST_EXPECT(b.use_count() == 1);
auto s = b.releaseStrongRef();
BEAST_EXPECT(s == ReleaseStrongRefAction::partialDestroy);
BEAST_EXPECT(b.use_count() == 0);
TIBase* pb = &b;
TIBase const* pb = &b;
partialDestructorFinished(&pb);
BEAST_EXPECT(!pb);
auto w = b.releaseWeakRef();
@@ -210,7 +210,7 @@ public:
std::vector<SharedIntrusive<TIBase>> strong;
std::vector<WeakIntrusive<TIBase>> weak;
{
TIBase::ResetStatesGuard rsg{true};
TIBase::ResetStatesGuard const rsg{true};
using enum TrackedState;
auto b = make_SharedIntrusive<TIBase>();
@@ -251,7 +251,7 @@ public:
BEAST_EXPECT(TIBase::getState(id) == deleted);
}
{
TIBase::ResetStatesGuard rsg{true};
TIBase::ResetStatesGuard const rsg{true};
using enum TrackedState;
auto b = make_SharedIntrusive<TIBase>();
@@ -275,7 +275,7 @@ public:
BEAST_EXPECT(TIBase::getState(id) == deleted);
}
{
TIBase::ResetStatesGuard rsg{true};
TIBase::ResetStatesGuard const rsg{true};
using enum TrackedState;
using swu = SharedWeakUnion<TIBase>;
@@ -309,7 +309,7 @@ public:
{
// Testing SharedWeakUnion assignment operator
TIBase::ResetStatesGuard rsg{true};
TIBase::ResetStatesGuard const rsg{true};
auto strong1 = make_SharedIntrusive<TIBase>();
auto strong2 = make_SharedIntrusive<TIBase>();
@@ -338,7 +338,7 @@ public:
// 2) Test self-assignment
BEAST_EXPECT(union1.isStrong());
BEAST_EXPECT(TIBase::getState(id1) == TrackedState::alive);
int initialRefCount = strong1->use_count();
int const initialRefCount = strong1->use_count();
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
union1 = union1; // Self-assignment
@@ -374,7 +374,7 @@ public:
using enum TrackedState;
TIBase::ResetStatesGuard rsg{true};
TIBase::ResetStatesGuard const rsg{true};
auto strong = make_SharedIntrusive<TIBase>();
WeakIntrusive<TIBase> weak{strong};
@@ -441,7 +441,7 @@ public:
using enum TrackedState;
TIBase::ResetStatesGuard rsg{true};
TIBase::ResetStatesGuard const rsg{true};
auto strong = make_SharedIntrusive<TIBase>();
WeakIntrusive<TIBase> weak{strong};
@@ -486,12 +486,12 @@ public:
// and check that the invariants hold.
using enum TrackedState;
TIBase::ResetStatesGuard rsg{true};
TIBase::ResetStatesGuard const rsg{true};
std::atomic<int> destructionState{0};
// returns destructorRan and partialDestructorRan (in that order)
auto getDestructorState = [&]() -> std::pair<bool, bool> {
int s = destructionState.load(std::memory_order_relaxed);
int const s = destructionState.load(std::memory_order_relaxed);
return {(s & 1) != 0, (s & 2) != 0};
};
auto setDestructorRan = [&]() -> void {
@@ -620,12 +620,12 @@ public:
using enum TrackedState;
TIBase::ResetStatesGuard rsg{true};
TIBase::ResetStatesGuard const rsg{true};
std::atomic<int> destructionState{0};
// returns destructorRan and partialDestructorRan (in that order)
auto getDestructorState = [&]() -> std::pair<bool, bool> {
int s = destructionState.load(std::memory_order_relaxed);
int const s = destructionState.load(std::memory_order_relaxed);
return {(s & 1) != 0, (s & 2) != 0};
};
auto setDestructorRan = [&]() -> void {
@@ -761,12 +761,12 @@ public:
using enum TrackedState;
TIBase::ResetStatesGuard rsg{true};
TIBase::ResetStatesGuard const rsg{true};
std::atomic<int> destructionState{0};
// returns destructorRan and partialDestructorRan (in that order)
auto getDestructorState = [&]() -> std::pair<bool, bool> {
int s = destructionState.load(std::memory_order_relaxed);
int const s = destructionState.load(std::memory_order_relaxed);
return {(s & 1) != 0, (s & 2) != 0};
};
auto setDestructorRan = [&]() -> void {
@@ -832,7 +832,7 @@ public:
// Multiple threads all create a weak pointer from the same
// strong pointer
WeakIntrusive weak{toLock[threadId]};
WeakIntrusive const weak{toLock[threadId]};
for (int wi = 0; wi < lockWeakLoopIters; ++wi)
{
BEAST_EXPECT(!weak.expired());