From aa4c895c1e1374ee46669df8a9a224c18bf37376 Mon Sep 17 00:00:00 2001 From: damageboy <125730+damageboy@users.noreply.github.com> Date: Wed, 5 Jan 2022 12:51:57 +0200 Subject: [PATCH 1/2] add .editorconfig to ease contribution by external devs --- .editorconfig | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4532a86 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,25 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*.{h,cpp}] +end_of_line = lf +indent_style = space +indent_size = 4 +insert_final_newline = true + +# Matches multiple files with brace expansion notation +# Set default charset +[*.json] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 4 +insert_final_newline = true + +# 4 space indentation +[CMakeLists.txt] +end_of_line = lf +indent_style = space +indent_size = 4 +insert_final_newline = true From 7424c4fe94bd85b45fc9f85e20f3fda223aef6c7 Mon Sep 17 00:00:00 2001 From: damageboy <125730+damageboy@users.noreply.github.com> Date: Tue, 7 Dec 2021 11:58:55 +0200 Subject: [PATCH 2/2] Resolve majority of clang+libstdc++ warnings --- src/logid/actions/Action.h | 2 ++ src/logid/actions/gesture/Gesture.h | 4 +++- src/logid/backend/dj/Receiver.h | 2 +- src/logid/backend/dj/ReceiverMonitor.h | 2 +- src/logid/backend/hidpp20/Feature.h | 1 + src/logid/backend/hidpp20/features/ReprogControls.h | 8 ++++---- src/logid/backend/raw/DeviceMonitor.h | 2 +- src/logid/features/DeviceFeature.h | 1 + 8 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/logid/actions/Action.h b/src/logid/actions/Action.h index 846abd7..46024ee 100644 --- a/src/logid/actions/Action.h +++ b/src/logid/actions/Action.h @@ -63,6 +63,8 @@ namespace actions { virtual uint8_t reprogFlags() const = 0; + virtual ~Action() = default; + class Config { protected: diff --git a/src/logid/actions/gesture/Gesture.h b/src/logid/actions/gesture/Gesture.h index 648f1df..dcb84ea 100644 --- a/src/logid/actions/gesture/Gesture.h +++ b/src/logid/actions/gesture/Gesture.h @@ -31,7 +31,7 @@ namespace actions explicit InvalidGesture(std::string what="") : _what (what) { } - virtual const char* what() + virtual const char* what() const noexcept { return _what.c_str(); } @@ -49,6 +49,8 @@ namespace actions virtual bool wheelCompatibility() const = 0; virtual bool metThreshold() const = 0; + virtual ~Gesture() = default; + class Config { public: diff --git a/src/logid/backend/dj/Receiver.h b/src/logid/backend/dj/Receiver.h index 96b74db..767689a 100644 --- a/src/logid/backend/dj/Receiver.h +++ b/src/logid/backend/dj/Receiver.h @@ -49,7 +49,7 @@ namespace dj Reason _reason; }; - class Receiver + class Receiver final { public: explicit Receiver(std::string path); diff --git a/src/logid/backend/dj/ReceiverMonitor.h b/src/logid/backend/dj/ReceiverMonitor.h index b56aced..88d7686 100644 --- a/src/logid/backend/dj/ReceiverMonitor.h +++ b/src/logid/backend/dj/ReceiverMonitor.h @@ -33,7 +33,7 @@ namespace dj { public: explicit ReceiverMonitor(std::string path); - ~ReceiverMonitor(); + virtual ~ReceiverMonitor(); void enumerate(); void run(); diff --git a/src/logid/backend/hidpp20/Feature.h b/src/logid/backend/hidpp20/Feature.h index 9f11e0c..3469ce6 100644 --- a/src/logid/backend/hidpp20/Feature.h +++ b/src/logid/backend/hidpp20/Feature.h @@ -41,6 +41,7 @@ namespace hidpp20 { static const uint16_t ID; virtual uint16_t getID() = 0; uint8_t featureIndex(); + virtual ~Feature() = default; protected: explicit Feature(Device* dev, uint16_t _id); std::vector callFunction(uint8_t function_id, diff --git a/src/logid/backend/hidpp20/features/ReprogControls.h b/src/logid/backend/hidpp20/features/ReprogControls.h index a62b464..9f0d4d5 100644 --- a/src/logid/backend/hidpp20/features/ReprogControls.h +++ b/src/logid/backend/hidpp20/features/ReprogControls.h @@ -122,7 +122,7 @@ namespace hidpp20 { public: static const uint16_t ID = FeatureID::REPROG_CONTROLS_V2; - virtual uint16_t getID() { return ID; } + virtual uint16_t getID() override { return ID; } explicit ReprogControlsV2(Device* dev); protected: @@ -133,7 +133,7 @@ namespace hidpp20 { public: static const uint16_t ID = FeatureID::REPROG_CONTROLS_V2_2; - virtual uint16_t getID() { return ID; } + virtual uint16_t getID() override { return ID; } explicit ReprogControlsV2_2(Device* dev); protected: @@ -144,7 +144,7 @@ namespace hidpp20 { public: static const uint16_t ID = FeatureID::REPROG_CONTROLS_V3; - virtual uint16_t getID() { return ID; } + virtual uint16_t getID() override { return ID; } explicit ReprogControlsV3(Device* dev); protected: @@ -155,7 +155,7 @@ namespace hidpp20 { public: static const uint16_t ID = FeatureID::REPROG_CONTROLS_V4; - virtual uint16_t getID() { return ID; } + virtual uint16_t getID() override { return ID; } bool supportsRawXY() override { return true; } diff --git a/src/logid/backend/raw/DeviceMonitor.h b/src/logid/backend/raw/DeviceMonitor.h index 8239da9..d795019 100644 --- a/src/logid/backend/raw/DeviceMonitor.h +++ b/src/logid/backend/raw/DeviceMonitor.h @@ -40,7 +40,7 @@ namespace raw void stop(); protected: DeviceMonitor(); - ~DeviceMonitor(); + virtual ~DeviceMonitor(); virtual void addDevice(std::string device) = 0; virtual void removeDevice(std::string device) = 0; private: diff --git a/src/logid/features/DeviceFeature.h b/src/logid/features/DeviceFeature.h index e4bbfc1..b5d60ee 100644 --- a/src/logid/features/DeviceFeature.h +++ b/src/logid/features/DeviceFeature.h @@ -43,6 +43,7 @@ namespace features } virtual void configure() = 0; virtual void listen() = 0; + virtual ~DeviceFeature() = default; class Config { public: