General: Make use of [[maybe_unused]]

Replaces uses of (void)variable with the attribute introduced in C++17.
This commit is contained in:
Lioncash 2019-09-09 21:42:36 -04:00
parent 4f4250baf7
commit 23cdae9e97
4 changed files with 26 additions and 65 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

@ -155,67 +155,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() {}
}; };
@ -278,10 +245,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;
@ -289,7 +253,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

@ -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,