diff options
author | David Robillard <d@drobilla.net> | 2021-01-02 21:52:20 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-01-02 21:52:20 +0100 |
commit | 59296974c71dfc7db7d003b40af84fa36a5e93c6 (patch) | |
tree | da05c022c534e8bd1d2800310e9c80c4d98c6046 /examples | |
parent | 416478739315ca41ad236197b25f87b83ab7f312 (diff) | |
download | pugl-59296974c71dfc7db7d003b40af84fa36a5e93c6.tar.gz pugl-59296974c71dfc7db7d003b40af84fa36a5e93c6.tar.bz2 pugl-59296974c71dfc7db7d003b40af84fa36a5e93c6.zip |
Avoid "else" after "return"
Diffstat (limited to 'examples')
-rw-r--r-- | examples/.clang-tidy | 2 | ||||
-rw-r--r-- | examples/pugl_shader_demo.c | 4 | ||||
-rw-r--r-- | examples/pugl_vulkan_demo.c | 8 | ||||
-rw-r--r-- | examples/sybok.hpp | 20 |
4 files changed, 24 insertions, 10 deletions
diff --git a/examples/.clang-tidy b/examples/.clang-tidy index 3410f19..fdfa4ea 100644 --- a/examples/.clang-tidy +++ b/examples/.clang-tidy @@ -30,12 +30,10 @@ Checks: > -hicpp-no-array-decay, -hicpp-signed-bitwise, -hicpp-vararg, - -llvm-else-after-return, -llvm-header-guard, -llvmlibc-*, -misc-misplaced-const, -modernize-use-trailing-return-type, - -readability-else-after-return, -readability-implicit-bool-conversion, -readability-named-parameter, FormatStyle: file diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c index d038b3f..087afc5 100644 --- a/examples/pugl_shader_demo.c +++ b/examples/pugl_shader_demo.c @@ -249,7 +249,9 @@ parseOptions(PuglTestApp* app, int argc, char** argv) if (endptr != argv[1] + strlen(argv[1])) { logError("Invalid GL major version: %s\n", argv[1]); return 1; - } else if (app->glMajorVersion == 4) { + } + + if (app->glMajorVersion == 4) { app->glMinorVersion = 2; } else if (app->glMajorVersion != 3) { logError("Unsupported GL major version %d\n", app->glMajorVersion); diff --git a/examples/pugl_vulkan_demo.c b/examples/pugl_vulkan_demo.c index 3af6d19..0dfbadd 100644 --- a/examples/pugl_vulkan_demo.c +++ b/examples/pugl_vulkan_demo.c @@ -312,7 +312,9 @@ getGraphicsQueueIndex(VkSurfaceKHR surface, device, q, surface, &supported))) { free(props); return r; - } else if (supported) { + } + + if (supported) { *graphicsIndex = q; free(props); return VK_SUCCESS; @@ -1059,7 +1061,9 @@ main(int argc, char** argv) // Create world and view if (!(app.world = puglNewWorld(PUGL_PROGRAM, PUGL_WORLD_THREADS))) { return logError("Failed to create world\n"); - } else if (!(app.view = puglNewView(app.world))) { + } + + if (!(app.view = puglNewView(app.world))) { puglFreeWorld(app.world); return logError("Failed to create Pugl World and View\n"); } diff --git a/examples/sybok.hpp b/examples/sybok.hpp index ed82afb..7740824 100644 --- a/examples/sybok.hpp +++ b/examples/sybok.hpp @@ -782,7 +782,9 @@ public: VkInstance h = {}; if (const VkResult r = vkCreateInstance(&createInfo, nullptr, &h)) { return r; - } else if (!h) { + } + + if (!h) { // Shouldn't actually happen, but this lets the compiler know that return VK_ERROR_INITIALIZATION_FAILED; } @@ -1392,7 +1394,9 @@ public: VkDeviceMemory h = {}; if (const VkResult r = vkAllocateMemory(device, &info, nullptr, &h)) { return r; - } else if (!h) { + } + + if (!h) { return VK_ERROR_OUT_OF_DEVICE_MEMORY; } @@ -1484,7 +1488,9 @@ public: if (const VkResult r = vkCreateDebugReportCallbackEXT(instance, &createInfo, nullptr, &h)) { return r; - } else if (!h) { + } + + if (!h) { return VK_ERROR_FEATURE_NOT_PRESENT; } @@ -1577,7 +1583,9 @@ public: if (r) { return r; - } else if (!h) { + } + + if (!h) { return VK_ERROR_INCOMPATIBLE_DRIVER; } @@ -1763,7 +1771,9 @@ private: { if (r) { return r; - } else if (!handle) { + } + + if (!handle) { return VK_ERROR_INITIALIZATION_FAILED; } |