[Lint] Added InsertBraces to linter to unify codebase to one standard

This commit is contained in:
Gliniak
2026-05-08 18:47:25 +02:00
parent 2c68a2fc4b
commit 74f34818e7
39 changed files with 426 additions and 170 deletions

View File

@@ -205,7 +205,9 @@ ConfigVar<T>::ConfigVar(const char* name, T* default_value,
template <class T>
void CommandVar<T>::UpdateValue() {
if (commandline_value_) return SetValue(*commandline_value_);
if (commandline_value_) {
return SetValue(*commandline_value_);
}
return SetValue(default_value_);
}
template <class T>
@@ -213,8 +215,12 @@ void ConfigVar<T>::UpdateValue() {
if (this->commandline_value_) {
return this->SetValue(*this->commandline_value_);
}
if (game_config_value_) return this->SetValue(*game_config_value_);
if (config_value_) return this->SetValue(*config_value_);
if (game_config_value_) {
return this->SetValue(*game_config_value_);
}
if (config_value_) {
return this->SetValue(*config_value_);
}
return this->SetValue(this->default_value_);
}
template <class T>
@@ -268,7 +274,9 @@ bool ConfigVar<T>::is_transient() const {
}
template <class T>
std::string ConfigVar<T>::config_value() const {
if (config_value_) return this->ToString(*config_value_);
if (config_value_) {
return this->ToString(*config_value_);
}
return this->ToString(this->default_value_);
}
template <class T>

View File

@@ -143,7 +143,9 @@ class xe_unlikely_mutex {
#if XE_ARCH_AMD64 == 1
_mm_pause();
#endif
if (_tryget()) return;
if (_tryget()) {
return;
}
}
// Fall back to yielding
while (!_tryget()) {

View File

@@ -100,7 +100,9 @@ TEST_CASE("Fence") {
pFence->Signal();
for (auto& t : threads) t.join();
for (auto& t : threads) {
t.join();
}
REQUIRE(finished.load() == threads.size());
} // namespace test

View File

@@ -417,7 +417,9 @@ class PosixCondition<Semaphore> final : public PosixConditionBase {
if (count_ + release_count > maximum_count_) {
return false;
}
if (out_previous_count) *out_previous_count = count_;
if (out_previous_count) {
*out_previous_count = count_;
}
count_ += release_count;
cond_.notify_all();
return true;
@@ -583,7 +585,9 @@ class PosixCondition<Thread> final : public PosixConditionBase {
ThreadStartData* start_data) {
start_data->create_suspended = params.create_suspended;
pthread_attr_t attr;
if (pthread_attr_init(&attr) != 0) return false;
if (pthread_attr_init(&attr) != 0) {
return false;
}
if (pthread_attr_setstacksize(&attr, params.stack_size) != 0) {
pthread_attr_destroy(&attr);
return false;
@@ -782,8 +786,12 @@ class PosixCondition<Thread> final : public PosixConditionBase {
// Center: fifo 16 → nice 0.
int nice_val = 16 - new_priority;
// Clamp to valid nice range.
if (nice_val < -20) nice_val = -20;
if (nice_val > 19) nice_val = 19;
if (nice_val < -20) {
nice_val = -20;
}
if (nice_val > 19) {
nice_val = 19;
}
if (tid_ > 0) {
setpriority(PRIO_PROCESS, tid_, nice_val);
}
@@ -1027,9 +1035,13 @@ WaitResult Wait(WaitHandle* wait_handle, bool is_alertable,
if (posix_wait_handle == nullptr) {
return WaitResult::kFailed;
}
if (is_alertable) alertable_state_ = true;
if (is_alertable) {
alertable_state_ = true;
}
auto result = posix_wait_handle->condition().Wait(timeout);
if (is_alertable) alertable_state_ = false;
if (is_alertable) {
alertable_state_ = false;
}
return result;
}
@@ -1045,11 +1057,15 @@ WaitResult SignalAndWait(WaitHandle* wait_handle_to_signal,
posix_wait_handle_to_wait_on == nullptr) {
return WaitResult::kFailed;
}
if (is_alertable) alertable_state_ = true;
if (is_alertable) {
alertable_state_ = true;
}
if (posix_wait_handle_to_signal->condition().Signal()) {
result = posix_wait_handle_to_wait_on->condition().Wait(timeout);
}
if (is_alertable) alertable_state_ = false;
if (is_alertable) {
alertable_state_ = false;
}
return result;
}
@@ -1066,10 +1082,14 @@ std::pair<WaitResult, size_t> WaitMultiple(WaitHandle* wait_handles[],
}
conditions.push_back(&handle->condition());
}
if (is_alertable) alertable_state_ = true;
if (is_alertable) {
alertable_state_ = true;
}
auto result = PosixConditionBase::WaitMultiple(std::move(conditions),
wait_all, timeout);
if (is_alertable) alertable_state_ = false;
if (is_alertable) {
alertable_state_ = false;
}
return result;
}
@@ -1305,7 +1325,9 @@ std::unique_ptr<Thread> Thread::Create(CreationParameters params,
install_signal_handler(SignalType::kThreadTerminate);
#endif
auto thread = std::make_unique<PosixThread>();
if (!thread->Initialize(params, std::move(start_routine))) return nullptr;
if (!thread->Initialize(params, std::move(start_routine))) {
return nullptr;
}
assert_not_null(thread);
return thread;
}