From 41049deb35be6853788aad406ee14a0fc72cc81d Mon Sep 17 00:00:00 2001 From: pixl Date: Fri, 10 Jul 2020 04:20:15 -0400 Subject: [PATCH] Fix compiler warnings --- src/logid/Configuration.cpp | 1 - src/logid/actions/Action.cpp | 4 ++-- src/logid/actions/Action.h | 2 ++ src/logid/actions/ToggleHiresScroll.cpp | 9 +-------- src/logid/actions/ToggleHiresScroll.h | 9 +-------- src/logid/actions/ToggleSmartShift.cpp | 8 +------- src/logid/actions/ToggleSmartShift.h | 9 +-------- src/logid/backend/hidpp20/features/ReprogControls.cpp | 1 + src/logid/util/worker_thread.h | 6 +++--- 9 files changed, 12 insertions(+), 37 deletions(-) diff --git a/src/logid/Configuration.cpp b/src/logid/Configuration.cpp index 0826c0f..5f9a7a9 100644 --- a/src/logid/Configuration.cpp +++ b/src/logid/Configuration.cpp @@ -70,7 +70,6 @@ Configuration::Configuration(const std::string& config_file) try { auto& timeout = root["io_timeout"]; if(timeout.isNumber()) { - auto t = timeout.getType(); if(timeout.getType() == Setting::TypeFloat) _io_timeout = duration_cast( duration(timeout)); diff --git a/src/logid/actions/Action.cpp b/src/logid/actions/Action.cpp index 5f52987..6de115d 100644 --- a/src/logid/actions/Action.cpp +++ b/src/logid/actions/Action.cpp @@ -50,9 +50,9 @@ std::shared_ptr Action::makeAction(Device *device, libconfig::Setting if(type == "keypress") return std::make_shared(device, setting); else if(type == "togglesmartshift") - return std::make_shared(device, setting); + return std::make_shared(device); else if(type == "togglehiresscroll") - return std::make_shared(device, setting); + return std::make_shared(device); else throw InvalidAction(type); diff --git a/src/logid/actions/Action.h b/src/logid/actions/Action.h index 6bdb87c..14ff244 100644 --- a/src/logid/actions/Action.h +++ b/src/logid/actions/Action.h @@ -52,6 +52,8 @@ namespace actions { virtual void release() = 0; virtual void move(int16_t x, int16_t y) { + // Suppress unused warning + (void)x; (void)y; } virtual bool pressed() diff --git a/src/logid/actions/ToggleHiresScroll.cpp b/src/logid/actions/ToggleHiresScroll.cpp index 7fbf5ac..0c57d54 100644 --- a/src/logid/actions/ToggleHiresScroll.cpp +++ b/src/logid/actions/ToggleHiresScroll.cpp @@ -17,15 +17,13 @@ */ #include "ToggleHiresScroll.h" #include "../Device.h" -#include "../util/log.h" #include "../util/task.h" #include "../backend/hidpp20/features/ReprogControls.h" using namespace logid::actions; using namespace logid::backend; -ToggleHiresScroll::ToggleHiresScroll(Device *dev, libconfig::Setting &config) : - Action (dev), _config (dev, config) +ToggleHiresScroll::ToggleHiresScroll(Device *dev) : Action (dev) { _hires_scroll = _device->getFeature("hiresscroll"); if(!_hires_scroll) @@ -56,9 +54,4 @@ void ToggleHiresScroll::release() uint8_t ToggleHiresScroll::reprogFlags() const { return hidpp20::ReprogControls::TemporaryDiverted; -} - -ToggleHiresScroll::Config::Config(Device *device, libconfig::Setting &root) : - Action::Config(device) -{ } \ No newline at end of file diff --git a/src/logid/actions/ToggleHiresScroll.h b/src/logid/actions/ToggleHiresScroll.h index 39377f5..bd60f71 100644 --- a/src/logid/actions/ToggleHiresScroll.h +++ b/src/logid/actions/ToggleHiresScroll.h @@ -27,20 +27,13 @@ namespace actions class ToggleHiresScroll : public Action { public: - ToggleHiresScroll(Device* dev, libconfig::Setting& config); + explicit ToggleHiresScroll(Device* dev); virtual void press(); virtual void release(); virtual uint8_t reprogFlags() const; - - class Config : public Action::Config - { - public: - explicit Config(Device* device, libconfig::Setting& root); - }; protected: - Config _config; std::shared_ptr _hires_scroll; }; }} diff --git a/src/logid/actions/ToggleSmartShift.cpp b/src/logid/actions/ToggleSmartShift.cpp index dfe86a9..28885ae 100644 --- a/src/logid/actions/ToggleSmartShift.cpp +++ b/src/logid/actions/ToggleSmartShift.cpp @@ -23,8 +23,7 @@ using namespace logid::actions; using namespace logid::backend; -ToggleSmartShift::ToggleSmartShift(Device *dev, libconfig::Setting &config) : - Action (dev), _config (dev, config) +ToggleSmartShift::ToggleSmartShift(Device *dev) : Action (dev) { _smartshift = _device->getFeature("smartshift"); if(!_smartshift) @@ -56,9 +55,4 @@ void ToggleSmartShift::release() uint8_t ToggleSmartShift::reprogFlags() const { return hidpp20::ReprogControls::TemporaryDiverted; -} - -ToggleSmartShift::Config::Config(Device *device, libconfig::Setting &root) : - Action::Config(device) -{ } \ No newline at end of file diff --git a/src/logid/actions/ToggleSmartShift.h b/src/logid/actions/ToggleSmartShift.h index 3cd8f95..7884f48 100644 --- a/src/logid/actions/ToggleSmartShift.h +++ b/src/logid/actions/ToggleSmartShift.h @@ -27,20 +27,13 @@ namespace actions { class ToggleSmartShift : public Action { public: - ToggleSmartShift(Device* dev, libconfig::Setting& config); + explicit ToggleSmartShift(Device* dev); virtual void press(); virtual void release(); virtual uint8_t reprogFlags() const; - - class Config : public Action::Config - { - public: - explicit Config(Device* device, libconfig::Setting& root); - }; protected: - Config _config; std::shared_ptr _smartshift; }; }} diff --git a/src/logid/backend/hidpp20/features/ReprogControls.cpp b/src/logid/backend/hidpp20/features/ReprogControls.cpp index 4200385..444096f 100644 --- a/src/logid/backend/hidpp20/features/ReprogControls.cpp +++ b/src/logid/backend/hidpp20/features/ReprogControls.cpp @@ -116,6 +116,7 @@ ReprogControls::ControlInfo ReprogControls::getControlReporting(uint16_t cid) void ReprogControls::setControlReporting(uint8_t cid, ControlInfo info) { // This function does not exist pre-v4 and cannot be emulated, ignore. + (void)cid; (void)info; // Suppress unused warnings } std::set ReprogControls::divertedButtonEvent( diff --git a/src/logid/util/worker_thread.h b/src/logid/util/worker_thread.h index c4305e5..0c252e1 100644 --- a/src/logid/util/worker_thread.h +++ b/src/logid/util/worker_thread.h @@ -42,13 +42,13 @@ namespace logid workqueue* _parent; std::size_t _worker_number; - std::unique_ptr _thread; - std::mutex _busy; - std::mutex _run_lock; std::atomic _continue_run; std::condition_variable _queue_cv; + std::unique_ptr _thread; + std::mutex _busy; + mutex_queue> _queue; }; }