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 {
friend class WindowCocoa;
friend class WindowXCB;
virtual void _setCallback(class IWindowCallback* cb) { (void)cb; }
virtual void _setCallback([[maybe_unused]] class IWindowCallback* cb) {}
public:
enum class EGraphicsAPI {

View File

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

View File

@ -89,10 +89,7 @@ public:
void waitForRetrace() override {}
uintptr_t getPlatformHandle() const override { return 0; }
bool _incomingEvent(void* event) override {
(void)event;
return false;
}
bool _incomingEvent([[maybe_unused]] void* event) override { return false; }
void _cleanup() override {}
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,
r.bottom - r.top, nullptr, nullptr, nullptr, nullptr);
HINSTANCE wndInstance = HINSTANCE(GetWindowLongPtr(m_hwnd, GWLP_HINSTANCE));
m_imc = ImmGetContext(m_hwnd);
#if BOO_HAS_VULKAN
HINSTANCE wndInstance = HINSTANCE(GetWindowLongPtr(m_hwnd, GWLP_HINSTANCE));
if (b3dCtx.m_vulkanDxFactory) {
m_gfxCtx.reset(new GraphicsContextWin32Vulkan(this, wndInstance, m_hwnd, &g_VulkanContext, b3dCtx));
if (m_gfxCtx->initializeContext(nullptr))
return;
}
#else
(void)wndInstance;
#endif
IGraphicsContext::EGraphicsAPI api = IGraphicsContext::EGraphicsAPI::D3D11;
if (b3dCtx.m_ctxOgl.m_dxFactory) {
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;
bool m_singleInstance;
void _deletedWindow(IWindow* window) override { (void)window; }
void _deletedWindow([[maybe_unused]] IWindow* window) override {}
public:
ApplicationWayland(IApplicationCallback& callback, std::string_view uniqueName, std::string_view friendlyName,