Merge pull request #41 from lioncash/unused

General: Make use of [[maybe_unused]]
This commit is contained in:
Phillip Stephens 2019-09-10 04:04:45 -07:00 committed by GitHub
commit e342ea5754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 68 deletions

View File

@ -10,7 +10,7 @@ struct IGraphicsDataFactory;
class IGraphicsContext { class IGraphicsContext {
friend class WindowCocoa; friend class WindowCocoa;
friend class WindowXCB; friend class WindowXCB;
virtual void _setCallback(class IWindowCallback* cb) { (void)cb; } virtual void _setCallback([[maybe_unused]] class IWindowCallback* cb) {}
public: public:
enum class EGraphicsAPI { enum class EGraphicsAPI {

View File

@ -146,67 +146,34 @@ struct ITextInputCallback {
class IWindowCallback { class IWindowCallback {
public: public:
virtual void resized(const SWindowRect& rect, bool sync) { (void)rect; } virtual void resized([[maybe_unused]] const SWindowRect& rect, [[maybe_unused]] bool sync) {}
virtual void mouseDown(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) { virtual void mouseDown([[maybe_unused]] const SWindowCoord& coord, [[maybe_unused]] EMouseButton button,
(void)coord; [[maybe_unused]] EModifierKey mods) {}
(void)button; virtual void mouseUp([[maybe_unused]] const SWindowCoord& coord, [[maybe_unused]] EMouseButton button,
(void)mods; [[maybe_unused]] EModifierKey mods) {}
} virtual void mouseMove([[maybe_unused]] const SWindowCoord& coord) {}
virtual void mouseUp(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) { virtual void mouseEnter([[maybe_unused]] const SWindowCoord& coord) {}
(void)coord; virtual void mouseLeave([[maybe_unused]] const SWindowCoord& coord) {}
(void)button; virtual void scroll([[maybe_unused]] const SWindowCoord& coord, [[maybe_unused]] const SScrollDelta& scroll) {}
(void)mods;
}
virtual void mouseMove(const SWindowCoord& coord) { (void)coord; }
virtual void mouseEnter(const SWindowCoord& coord) { (void)coord; }
virtual void mouseLeave(const SWindowCoord& coord) { (void)coord; }
virtual void scroll(const SWindowCoord& coord, const SScrollDelta& scroll) {
(void)coord;
(void)scroll;
}
virtual void touchDown(const STouchCoord& coord, uintptr_t tid) { virtual void touchDown([[maybe_unused]] const STouchCoord& coord, [[maybe_unused]] uintptr_t tid) {}
(void)coord; virtual void touchUp([[maybe_unused]] const STouchCoord& coord, [[maybe_unused]] uintptr_t tid) {}
(void)tid; virtual void touchMove([[maybe_unused]] const STouchCoord& coord, [[maybe_unused]] uintptr_t tid) {}
}
virtual void touchUp(const STouchCoord& coord, uintptr_t tid) {
(void)coord;
(void)tid;
}
virtual void touchMove(const STouchCoord& coord, uintptr_t tid) {
(void)coord;
(void)tid;
}
virtual void charKeyDown(unsigned long charCode, EModifierKey mods, bool isRepeat) { virtual void charKeyDown([[maybe_unused]] unsigned long charCode, [[maybe_unused]] EModifierKey mods,
(void)charCode; [[maybe_unused]] bool isRepeat) {}
(void)mods; virtual void charKeyUp([[maybe_unused]] unsigned long charCode, [[maybe_unused]] EModifierKey mods) {}
(void)isRepeat; virtual void specialKeyDown([[maybe_unused]] ESpecialKey key, [[maybe_unused]] EModifierKey mods,
} [[maybe_unused]] bool isRepeat) {}
virtual void charKeyUp(unsigned long charCode, EModifierKey mods) { virtual void specialKeyUp([[maybe_unused]] ESpecialKey key, [[maybe_unused]] EModifierKey mods) {}
(void)charCode; virtual void modKeyDown([[maybe_unused]] EModifierKey mod, [[maybe_unused]] bool isRepeat) {}
(void)mods; virtual void modKeyUp([[maybe_unused]] EModifierKey mod) {}
}
virtual void specialKeyDown(ESpecialKey key, EModifierKey mods, bool isRepeat) {
(void)key;
(void)mods;
(void)isRepeat;
}
virtual void specialKeyUp(ESpecialKey key, EModifierKey mods) {
(void)key;
(void)mods;
}
virtual void modKeyDown(EModifierKey mod, bool isRepeat) {
(void)mod;
(void)isRepeat;
}
virtual void modKeyUp(EModifierKey mod) { (void)mod; }
virtual ITextInputCallback* getTextInputCallback() { return nullptr; } virtual ITextInputCallback* getTextInputCallback() { return nullptr; }
virtual void focusLost() {} virtual void focusLost() {}
virtual void focusGained() {} virtual void focusGained() {}
virtual void windowMoved(const SWindowRect& rect) { (void)rect; } virtual void windowMoved([[maybe_unused]] const SWindowRect& rect) {}
virtual void destroyed() {} virtual void destroyed() {}
}; };
@ -269,10 +236,7 @@ public:
virtual int waitForRetrace() = 0; virtual int waitForRetrace() = 0;
virtual uintptr_t getPlatformHandle() const = 0; virtual uintptr_t getPlatformHandle() const = 0;
virtual bool _incomingEvent(void* event) { virtual bool _incomingEvent([[maybe_unused]] void* event) { return false; }
(void)event;
return false;
}
virtual void _cleanup() {} virtual void _cleanup() {}
virtual ETouchType getTouchType() const = 0; virtual ETouchType getTouchType() const = 0;
@ -280,7 +244,7 @@ public:
virtual void setStyle(EWindowStyle style) = 0; virtual void setStyle(EWindowStyle style) = 0;
virtual EWindowStyle getStyle() const = 0; virtual EWindowStyle getStyle() const = 0;
virtual void setTouchBarProvider(void*) {} virtual void setTouchBarProvider([[maybe_unused]] void* provider) {}
virtual IGraphicsCommandQueue* getCommandQueue() = 0; virtual IGraphicsCommandQueue* getCommandQueue() = 0;
virtual IGraphicsDataFactory* getDataFactory() = 0; virtual IGraphicsDataFactory* getDataFactory() = 0;

View File

@ -89,10 +89,7 @@ public:
void waitForRetrace() override {} void waitForRetrace() override {}
uintptr_t getPlatformHandle() const override { return 0; } uintptr_t getPlatformHandle() const override { return 0; }
bool _incomingEvent(void* event) override { bool _incomingEvent([[maybe_unused]] void* event) override { return false; }
(void)event;
return false;
}
void _cleanup() override {} void _cleanup() override {}
ETouchType getTouchType() const override { return ETouchType::Display; } ETouchType getTouchType() const override { return ETouchType::Display; }

View File

@ -859,18 +859,17 @@ public:
m_hwnd = CreateWindowW(L"BooWindow", title.data(), WS_OVERLAPPEDWINDOW, r.left, r.top, r.right - r.left, m_hwnd = CreateWindowW(L"BooWindow", title.data(), WS_OVERLAPPEDWINDOW, r.left, r.top, r.right - r.left,
r.bottom - r.top, nullptr, nullptr, nullptr, nullptr); r.bottom - r.top, nullptr, nullptr, nullptr, nullptr);
HINSTANCE wndInstance = HINSTANCE(GetWindowLongPtr(m_hwnd, GWLP_HINSTANCE));
m_imc = ImmGetContext(m_hwnd); m_imc = ImmGetContext(m_hwnd);
#if BOO_HAS_VULKAN #if BOO_HAS_VULKAN
HINSTANCE wndInstance = HINSTANCE(GetWindowLongPtr(m_hwnd, GWLP_HINSTANCE));
if (b3dCtx.m_vulkanDxFactory) { if (b3dCtx.m_vulkanDxFactory) {
m_gfxCtx.reset(new GraphicsContextWin32Vulkan(this, wndInstance, m_hwnd, &g_VulkanContext, b3dCtx)); m_gfxCtx.reset(new GraphicsContextWin32Vulkan(this, wndInstance, m_hwnd, &g_VulkanContext, b3dCtx));
if (m_gfxCtx->initializeContext(nullptr)) if (m_gfxCtx->initializeContext(nullptr))
return; return;
} }
#else
(void)wndInstance;
#endif #endif
IGraphicsContext::EGraphicsAPI api = IGraphicsContext::EGraphicsAPI::D3D11; IGraphicsContext::EGraphicsAPI api = IGraphicsContext::EGraphicsAPI::D3D11;
if (b3dCtx.m_ctxOgl.m_dxFactory) { if (b3dCtx.m_ctxOgl.m_dxFactory) {
m_gfxCtx.reset(new GraphicsContextWin32GL(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this, m_hwnd, b3dCtx)); m_gfxCtx.reset(new GraphicsContextWin32GL(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this, m_hwnd, b3dCtx));

View File

@ -19,7 +19,7 @@ class ApplicationWayland final : public IApplication {
const std::vector<std::string> m_args; const std::vector<std::string> m_args;
bool m_singleInstance; bool m_singleInstance;
void _deletedWindow(IWindow* window) override { (void)window; } void _deletedWindow([[maybe_unused]] IWindow* window) override {}
public: public:
ApplicationWayland(IApplicationCallback& callback, std::string_view uniqueName, std::string_view friendlyName, ApplicationWayland(IApplicationCallback& callback, std::string_view uniqueName, std::string_view friendlyName,