aboutsummaryrefslogtreecommitdiffstats
path: root/examples/sybok.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-02 21:28:04 +0100
committerDavid Robillard <d@drobilla.net>2021-01-02 21:28:04 +0100
commita0efc4054f0f341a5bcec218c9bab8abffa312a6 (patch)
treeaa39dba903f51b8eff9b3652267b282e343cfd0d /examples/sybok.hpp
parentf6ca60606561ddbe5dab526ab1bc6b89f6dbe082 (diff)
downloadpugl-a0efc4054f0f341a5bcec218c9bab8abffa312a6.tar.gz
pugl-a0efc4054f0f341a5bcec218c9bab8abffa312a6.tar.bz2
pugl-a0efc4054f0f341a5bcec218c9bab8abffa312a6.zip
Fix clang-tidy warnings
Diffstat (limited to 'examples/sybok.hpp')
-rw-r--r--examples/sybok.hpp38
1 files changed, 27 insertions, 11 deletions
diff --git a/examples/sybok.hpp b/examples/sybok.hpp
index 05b2c3d..6805efa 100644
--- a/examples/sybok.hpp
+++ b/examples/sybok.hpp
@@ -63,6 +63,15 @@
#ifndef SYBOK_HPP
#define SYBOK_HPP
+#ifdef VULKAN_CORE_H_
+# error "sybok.hpp must be included before or instead of vulkan headers"
+#endif
+
+#ifdef __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wswitch-enum"
+#endif
+
#define VK_NO_PROTOTYPES
// On 64-bit platforms, all handles are "dispatchable" pointers
@@ -72,7 +81,7 @@
defined(__powerpc64__)
# define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) \
- typedef struct object##_T* object;
+ typedef struct object##_T* object; // NOLINT(bugprone-macro-parentheses)
// On 32-bit platforms, some "non-dispatchable" handles are 64 bit integers
#else
@@ -91,7 +100,7 @@ struct NonDispatchableHandle {
#endif
-#include <vulkan/vulkan_core.h>
+#include <vulkan/vulkan_core.h> // IWYU pragma: export
#include <array>
#include <cassert>
@@ -116,7 +125,7 @@ namespace sk {
class CommandScope;
class RenderCommandScope;
-static inline const char*
+inline const char*
string(const VkResult result)
{
switch (result) {
@@ -177,7 +186,7 @@ string(const VkResult result)
return "Unknown error";
}
-static inline const char*
+inline const char*
string(const VkPresentModeKHR presentMode)
{
switch (presentMode) {
@@ -196,7 +205,7 @@ string(const VkPresentModeKHR presentMode)
return "Unknown present mode";
}
-static inline const char*
+inline const char*
string(const VkDebugReportFlagBitsEXT flag)
{
switch (flag) {
@@ -226,6 +235,7 @@ public:
GlobalDeleter() = default;
~GlobalDeleter() = default;
+ // NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
GlobalDeleter(DestroyFunc destroyFunc) noexcept
: _destroyFunc{destroyFunc}
{}
@@ -390,6 +400,7 @@ public:
const Handle& get() const noexcept { return _handle; }
+ // NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
operator Handle() const noexcept { return _handle; }
private:
@@ -533,13 +544,13 @@ class OptionalParameter
public:
using Handle = typename T::Handle;
+ // NOLINTNEXTLINE(hicpp-explicit-conversions, google-explicit-constructor)
OptionalParameter(const T& value) noexcept
: _handle{value.get()}
{}
- OptionalParameter() noexcept
- : _handle{}
- {}
+ OptionalParameter() noexcept = default;
+ ~OptionalParameter() noexcept = default;
OptionalParameter(const OptionalParameter&) = delete;
OptionalParameter& operator=(const OptionalParameter&) = delete;
@@ -547,7 +558,7 @@ public:
OptionalParameter(OptionalParameter&&) = delete;
OptionalParameter& operator=(OptionalParameter&&) = delete;
- const Handle get() const noexcept { return _handle; }
+ Handle get() const noexcept { return _handle; }
private:
Handle _handle{};
@@ -810,7 +821,7 @@ public:
}
private:
- PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{};
#define SK_FUNC(name) \
PFN_##name name {}
@@ -1779,6 +1790,7 @@ public:
CommonCommandScope(CommonCommandScope&& scope) noexcept
: _api{scope._api}
, _commandBuffer{scope._commandBuffer}
+ , _result{scope._result}
{
scope._commandBuffer = {};
}
@@ -2266,7 +2278,7 @@ public:
}
};
-CommandScope
+inline CommandScope
VulkanApi::beginCommandBuffer(
VkCommandBuffer commandBuffer,
const VkCommandBufferBeginInfo beginInfo) const noexcept
@@ -2296,4 +2308,8 @@ inline MappedMemory::~MappedMemory() noexcept
} // namespace sk
+#ifdef __GNUC__
+# pragma GCC diagnostic pop
+#endif
+
#endif // SYBOK_HPP