Remove spaces after control statements keywords
Spaces are useful to separate independent constructs, but can cause
confusion when added between dependent ones. For example "a*b [i]"
is hard for humans to read correctly at a glance. "a*b[i]" is better,
and "a * b[i]" is the easiest to understand immediately.
Control statements are no different. "if (a)if (b)x;" is hard to parse.
"if (a) if (b) x;" is better, but "if(a) if(b) x;" leaves no confusion
of what belongs where.
This recommendation also follows the 'zero one infinity' rule of thumb:
https://en.wikipedia.org/wiki/Zero_one_infinity_rule
Whether we write "a + b" or "a + b", they are equally readable, and
the additional spaces may help with alignment of surrounding
expressions. "for (int i : c)" on the other hand makes the keyword
unintentionally even more dissociated from its header than
"for (int i : c)" already does.
The argument that the space helps set it apart from function calls seems
moot when practically every editor supports keyword highlighting,
function names are typically longer than 2-3 characters, and function
calls are not followed by curly brackets (which while optional for
singular statements, are still recommended for reasons other than this
one).
Bug: b/144825072
Change-Id: I3432fadae8e5604123f5c537097323504fecbc8c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39588
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Vulkan/VkQueue.cpp b/src/Vulkan/VkQueue.cpp
index 4c5f798..36fb0a8 100644
--- a/src/Vulkan/VkQueue.cpp
+++ b/src/Vulkan/VkQueue.cpp
@@ -115,7 +115,7 @@
void Queue::submitQueue(const Task& task)
{
- if (renderer == nullptr)
+ if(renderer == nullptr)
{
renderer.reset(new sw::Renderer(device));
}
@@ -144,7 +144,7 @@
}
}
- if (task.pSubmits)
+ if(task.pSubmits)
{
toDelete.put(task.pSubmits);
}
@@ -202,10 +202,10 @@
void Queue::garbageCollect()
{
- while (true)
+ while(true)
{
auto v = toDelete.tryTake();
- if (!v.second) { break; }
+ if(!v.second) { break; }
vk::deallocate(v.first, DEVICE_MEMORY);
}
}
@@ -226,11 +226,11 @@
for(uint32_t i = 0; i < presentInfo->swapchainCount; i++)
{
VkResult res = vk::Cast(presentInfo->pSwapchains[i])->present(presentInfo->pImageIndices[i]);
- if (presentInfo->pResults != nullptr)
+ if(presentInfo->pResults != nullptr)
{
presentInfo->pResults[i] = res;
}
- if (res != VK_SUCCESS)
+ if(res != VK_SUCCESS)
result = res;
}