From 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 13:23:58 +0200 Subject: Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027. --- core/command_queue_mt.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'core/command_queue_mt.cpp') diff --git a/core/command_queue_mt.cpp b/core/command_queue_mt.cpp index 60ab5d133b..d23a6425e3 100644 --- a/core/command_queue_mt.cpp +++ b/core/command_queue_mt.cpp @@ -33,30 +33,24 @@ #include "core/os/os.h" void CommandQueueMT::lock() { - mutex.lock(); } void CommandQueueMT::unlock() { - mutex.unlock(); } void CommandQueueMT::wait_for_flush() { - // wait one millisecond for a flush to happen OS::get_singleton()->delay_usec(1000); } CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() { - int idx = -1; while (true) { - lock(); for (int i = 0; i < SYNC_SEMAPHORES; i++) { - if (!sync_sems[i].in_use) { sync_sems[i].in_use = true; idx = i; -- cgit v1.2.3 From 0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 16:41:43 +0200 Subject: Style: Enforce braces around if blocks and loops Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html --- core/command_queue_mt.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'core/command_queue_mt.cpp') diff --git a/core/command_queue_mt.cpp b/core/command_queue_mt.cpp index d23a6425e3..ace210ca2c 100644 --- a/core/command_queue_mt.cpp +++ b/core/command_queue_mt.cpp @@ -94,12 +94,14 @@ tryagain: } CommandQueueMT::CommandQueueMT(bool p_sync) { - if (p_sync) + if (p_sync) { sync = memnew(Semaphore); + } } CommandQueueMT::~CommandQueueMT() { - if (sync) + if (sync) { memdelete(sync); + } memfree(command_mem); } -- cgit v1.2.3