From 181bd895918c341e0a2ef1d0558a591028bf2d7d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 19 Sep 2020 13:22:17 +0200 Subject: Fix clang-tidy warnings --- .clang-tidy | 2 -- pugl/pugl.hpp | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 7e79698..c8039e1 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -8,8 +8,6 @@ Checks: > -cert-flp30-c, -clang-analyzer-alpha.*, -clang-analyzer-security.FloatLoopCounter, - -fuchsia-default-arguments-calls, - -fuchsia-default-arguments-declarations, -google-runtime-references, -hicpp-multiway-paths-covered, -hicpp-signed-bitwise, diff --git a/pugl/pugl.hpp b/pugl/pugl.hpp index 90036e4..3072560 100644 --- a/pugl/pugl.hpp +++ b/pugl/pugl.hpp @@ -274,7 +274,7 @@ private: class World : public detail::Wrapper { public: - explicit World(WorldType type, WorldFlags flags = {}) + explicit World(WorldType type, WorldFlags flags) : Wrapper{puglNewWorld(static_cast(type), flags)} , _clock(*this) { @@ -283,6 +283,14 @@ public: } } + explicit World(WorldType type) + : World{type, {}} + { + if (!cobj()) { + throw std::runtime_error("Failed to create pugl::World"); + } + } + /// @copydoc puglGetNativeWorld void* nativeWorld() { return puglGetNativeWorld(cobj()); } @@ -394,6 +402,12 @@ public: virtual ~View() = default; + View(const View&) = delete; + View& operator=(const View&) = delete; + + View(View&&) = delete; + View&& operator=(View&&) = delete; + const pugl::World& world() const { return _world; } pugl::World& world() { return _world; } @@ -580,7 +594,7 @@ private: template static const Typed& typedEventRef(const Base& base) { - const Typed& event = static_cast(base); + const auto& event = static_cast(base); static_assert(sizeof(event) == sizeof(typename Typed::BaseEvent), ""); static_assert(std::is_standard_layout::value, ""); assert(event.type == Typed::type); -- cgit v1.2.1