diff --git a/src/kaleidoscope/MatrixAddr.h b/src/kaleidoscope/MatrixAddr.h index 350190fd..f5aa07c7 100644 --- a/src/kaleidoscope/MatrixAddr.h +++ b/src/kaleidoscope/MatrixAddr.h @@ -47,7 +47,7 @@ class MatrixAddr { constexpr MatrixAddr(uint8_t row, uint8_t col) : offset_(row * cols + col) {} - constexpr MatrixAddr(uint8_t offset) + explicit constexpr MatrixAddr(uint8_t offset) : offset_(offset) {} // Rely on the default copy and move constructor. @@ -57,8 +57,8 @@ class MatrixAddr { // ridiculously bad assembler code for each copy construction, // that would bloat the default firmware by 1K of PROGMEM! // - constexpr MatrixAddr(const ThisType &other) = default; - constexpr MatrixAddr(ThisType &&other) = default; + explicit constexpr MatrixAddr(const ThisType &other) = default; + explicit constexpr MatrixAddr(ThisType &&other) = default; //constexpr MatrixAddr(const ThisType &other) : offset_(other.offset_) {} //constexpr MatrixAddr(ThisType &&other) : offset_(other.offset_) {} @@ -66,8 +66,7 @@ class MatrixAddr { ThisType &operator=(ThisType &&) = default; template - explicit - constexpr MatrixAddr(const MatrixAddr__ &other) + explicit constexpr MatrixAddr(const MatrixAddr__ &other) : MatrixAddr(other.row(), other.col()) { static_assert(MatrixAddr__::rows <= ThisType::rows, "Matrix type conversion failed. Source type must not have greater row size than target type"); diff --git a/src/kaleidoscope/bitfields.h b/src/kaleidoscope/bitfields.h index 3a59c854..52621143 100644 --- a/src/kaleidoscope/bitfields.h +++ b/src/kaleidoscope/bitfields.h @@ -113,7 +113,7 @@ class Bitfield : public internal::_BaseBitfield { static constexpr size_t n_bytes_ = nBytesForBits(BitCount__); template - constexpr Bitfield(Bits__...bits) : bits_(bits...) { + explicit constexpr Bitfield(Bits__...bits) : bits_(bits...) { static_assert(sizeof...(Bits__) == n_bits_, "Invalid number of bits supplied to Bitfield constructor. \n" "Compare the number of bits supplied with the provided template \n" diff --git a/src/kaleidoscope/device/dygma/raise/Hand.h b/src/kaleidoscope/device/dygma/raise/Hand.h index 57c6ec1d..95791f68 100644 --- a/src/kaleidoscope/device/dygma/raise/Hand.h +++ b/src/kaleidoscope/device/dygma/raise/Hand.h @@ -56,7 +56,7 @@ typedef union { class Hand { public: - Hand(byte ad01) : ad01_(ad01), twi_(i2c_addr_base_ | ad01) {} + explicit Hand(byte ad01) : ad01_(ad01), twi_(i2c_addr_base_ | ad01) {} int readVersion(); int readSLEDVersion(); diff --git a/src/kaleidoscope/device/dygma/raise/TWI.h b/src/kaleidoscope/device/dygma/raise/TWI.h index 75298b21..ba191b09 100644 --- a/src/kaleidoscope/device/dygma/raise/TWI.h +++ b/src/kaleidoscope/device/dygma/raise/TWI.h @@ -27,7 +27,7 @@ namespace raise { class TWI { public: - TWI(int addr) : addr_(addr), crc_errors_(0) {} + explicit TWI(int addr) : addr_(addr), crc_errors_(0) {} uint8_t writeTo(uint8_t *data, size_t length); uint8_t readFrom(uint8_t* data, size_t length); diff --git a/src/kaleidoscope/driver/led/Base.h b/src/kaleidoscope/driver/led/Base.h index dedec421..d2d727bf 100644 --- a/src/kaleidoscope/driver/led/Base.h +++ b/src/kaleidoscope/driver/led/Base.h @@ -75,7 +75,7 @@ class Base { uint8_t offset_; public: LEDRangeIterator() : offset_(0) {} - LEDRangeIterator(uint8_t offset) : offset_(offset) {} + explicit LEDRangeIterator(uint8_t offset) : offset_(offset) {} typedef LEDRangeIterator ThisType; diff --git a/src/kaleidoscope/key_defs.h b/src/kaleidoscope/key_defs.h index cca19bf3..8a7de806 100644 --- a/src/kaleidoscope/key_defs.h +++ b/src/kaleidoscope/key_defs.h @@ -36,7 +36,7 @@ class Key { Key() = default; - constexpr Key(uint16_t raw) + explicit constexpr Key(uint16_t raw) : Key{(uint8_t)(raw & 0x00FF), (uint8_t)(raw >> 8)} {} @@ -140,7 +140,7 @@ class Key { DataProxy() = default; - constexpr DataProxy(uint8_t value) : value_{value} {} + explicit constexpr DataProxy(uint8_t value) : value_{value} {} DEPRECATED(DIRECT_KEY_MEMBER_ACCESS) DataProxy &operator=(uint8_t value) { diff --git a/src/kaleidoscope/plugin/Colormap.h b/src/kaleidoscope/plugin/Colormap.h index 0389792b..bef68994 100644 --- a/src/kaleidoscope/plugin/Colormap.h +++ b/src/kaleidoscope/plugin/Colormap.h @@ -42,7 +42,7 @@ class ColormapEffect : public Plugin, // for those LED modes that require access to // members of their parent class. Most LED modes can do without. // - TransientLEDMode(const ColormapEffect *parent) : parent_(parent) {} + explicit TransientLEDMode(const ColormapEffect *parent) : parent_(parent) {} protected: diff --git a/src/kaleidoscope/plugin/Heatmap.h b/src/kaleidoscope/plugin/Heatmap.h index 6a27bc48..53774b97 100644 --- a/src/kaleidoscope/plugin/Heatmap.h +++ b/src/kaleidoscope/plugin/Heatmap.h @@ -45,7 +45,7 @@ class Heatmap : public Plugin, // for those LED modes that require access to // members of their parent class. Most LED modes can do without. // - TransientLEDMode(const Heatmap *parent); + explicit TransientLEDMode(const Heatmap *parent); void resetMap(); EventHandlerResult onKeyswitchEvent(Key &mapped_key, KeyAddr key_addr, uint8_t key_state); diff --git a/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index a865207d..d82587ca 100644 --- a/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -39,7 +39,7 @@ class LEDActiveLayerColorEffect : public Plugin, // for those LED modes that require access to // members of their parent class. Most LED modes can do without. // - TransientLEDMode(const LEDActiveLayerColorEffect *parent); + explicit TransientLEDMode(const LEDActiveLayerColorEffect *parent); protected: diff --git a/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h index 73eeae77..fffe6861 100644 --- a/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h +++ b/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -36,7 +36,7 @@ class AlphaSquareEffect : public Plugin, // class TransientLEDMode : public LEDMode { public: - TransientLEDMode(AlphaSquareEffect *parent); + explicit TransientLEDMode(AlphaSquareEffect *parent); protected: void update(void) final; diff --git a/src/kaleidoscope/plugin/LED-Stalker.h b/src/kaleidoscope/plugin/LED-Stalker.h index db099e94..8da6022a 100644 --- a/src/kaleidoscope/plugin/LED-Stalker.h +++ b/src/kaleidoscope/plugin/LED-Stalker.h @@ -50,7 +50,7 @@ class StalkerEffect : public Plugin, // for those LED modes that require access to // members of their parent class. Most LED modes can do without. // - TransientLEDMode(const StalkerEffect *parent); + explicit TransientLEDMode(const StalkerEffect *parent); protected: diff --git a/src/kaleidoscope/plugin/LED-Wavepool.h b/src/kaleidoscope/plugin/LED-Wavepool.h index d52b40d1..1ff8faf9 100644 --- a/src/kaleidoscope/plugin/LED-Wavepool.h +++ b/src/kaleidoscope/plugin/LED-Wavepool.h @@ -51,7 +51,7 @@ class WavepoolEffect : public Plugin, // for those LED modes that require access to // members of their parent class. Most LED modes can do without. // - TransientLEDMode(const WavepoolEffect *parent); + explicit TransientLEDMode(const WavepoolEffect *parent); EventHandlerResult onKeyswitchEvent(Key &mapped_key, KeyAddr key_addr, uint8_t key_state); diff --git a/src/kaleidoscope/plugin/LEDEffect-BootGreeting.h b/src/kaleidoscope/plugin/LEDEffect-BootGreeting.h index 180d244c..6a5478d0 100644 --- a/src/kaleidoscope/plugin/LEDEffect-BootGreeting.h +++ b/src/kaleidoscope/plugin/LEDEffect-BootGreeting.h @@ -24,7 +24,7 @@ namespace plugin { class BootGreetingEffect : public kaleidoscope::Plugin { public: BootGreetingEffect(void) {} - BootGreetingEffect(KeyAddr key_addr); + explicit BootGreetingEffect(KeyAddr key_addr); static KeyAddr user_key_addr; static Key search_key; diff --git a/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/src/kaleidoscope/plugin/LEDEffect-Breathe.h index ee99ef04..2f08669e 100644 --- a/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -37,7 +37,7 @@ class LEDBreatheEffect : public Plugin, // for those LED modes that require access to // members of their parent class. Most LED modes can do without. // - TransientLEDMode(const LEDBreatheEffect *parent) + explicit TransientLEDMode(const LEDBreatheEffect *parent) : parent_(parent) {} protected: diff --git a/src/kaleidoscope/plugin/LEDEffect-Chase.h b/src/kaleidoscope/plugin/LEDEffect-Chase.h index 0ccb4400..183219e5 100644 --- a/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -47,7 +47,7 @@ class LEDChaseEffect : public Plugin, // for those LED modes that require access to // members of their parent class. Most LED modes can do without. // - TransientLEDMode(const LEDChaseEffect *parent) + explicit TransientLEDMode(const LEDChaseEffect *parent) : parent_(parent), last_update_(Runtime.millisAtCycleStart()) {} protected: diff --git a/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index 1d454561..fb3cb7e7 100644 --- a/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -43,7 +43,7 @@ class LEDRainbowEffect : public Plugin, // for those LED modes that require access to // members of their parent class. Most LED modes can do without. // - TransientLEDMode(const LEDRainbowEffect *parent) + explicit TransientLEDMode(const LEDRainbowEffect *parent) : parent_(parent) {} void update() final; @@ -88,7 +88,7 @@ class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { // for those LED modes that require access to // members of their parent class. Most LED modes can do without. // - TransientLEDMode(const LEDRainbowWaveEffect *parent) + explicit TransientLEDMode(const LEDRainbowWaveEffect *parent) : parent_(parent) {} void update() final; diff --git a/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index 64527431..a825cfa0 100644 --- a/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -37,7 +37,7 @@ class LEDSolidColor : public Plugin, // for those LED modes that require access to // members of their parent class. Most LED modes can do without. // - TransientLEDMode(const LEDSolidColor *parent) + explicit TransientLEDMode(const LEDSolidColor *parent) : parent_(parent) {} protected: diff --git a/src/kaleidoscope/plugin/TriColor.h b/src/kaleidoscope/plugin/TriColor.h index 83eebcf2..574ea100 100644 --- a/src/kaleidoscope/plugin/TriColor.h +++ b/src/kaleidoscope/plugin/TriColor.h @@ -37,7 +37,7 @@ class TriColor : public Plugin, // for those LED modes that require access to // members of their parent class. Most LED modes can do without. // - TransientLEDMode(const TriColor *parent) + explicit TransientLEDMode(const TriColor *parent) : parent_(parent) {} protected: diff --git a/src/kaleidoscope_internal/array_like_storage.h b/src/kaleidoscope_internal/array_like_storage.h index 10ad9222..6001126b 100644 --- a/src/kaleidoscope_internal/array_like_storage.h +++ b/src/kaleidoscope_internal/array_like_storage.h @@ -85,7 +85,7 @@ struct ArrayLikeStorage { public: - constexpr ArrayLikeStorage(StoredType__ entry) + explicit constexpr ArrayLikeStorage(StoredType__ entry) : entry_(entry) {} @@ -103,7 +103,7 @@ struct ArrayLikeStorage { public: template - constexpr ArrayLikeStorage(AnyType__/* non-matching entity */) {} + explicit constexpr ArrayLikeStorage(AnyType__/* non-matching entity */) {} static constexpr uint8_t n_entries = 0; diff --git a/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h b/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h index 494469af..34ce8d55 100644 --- a/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h +++ b/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h @@ -35,7 +35,7 @@ class KeymapAdaptor { static constexpr uint8_t n_layers = _n_layers; static constexpr uint8_t layer_size = _layer_size; - constexpr KeymapAdaptor(const Key(&keymap)[_n_layers][_layer_size]) + explicit constexpr KeymapAdaptor(const Key(&keymap)[_n_layers][_layer_size]) : keymap_{keymap} {} @@ -119,7 +119,7 @@ class EmptyKeymapAccumulationHelper { public: - constexpr EmptyKeymapAccumulationHelper(const _Accumulation &op) + explicit constexpr EmptyKeymapAccumulationHelper(const _Accumulation &op) : op_{op} {} @@ -147,7 +147,7 @@ struct NumKeysEqual { typedef uint8_t ResultType; static constexpr ResultType init_value = 0; - constexpr NumKeysEqual(Key k) : k_{k} {} + explicit constexpr NumKeysEqual(Key k) : k_{k} {} constexpr ResultType apply(Key test_key, ResultType r) const { return (test_key == k_) ? r + 1 : r; @@ -163,7 +163,7 @@ struct HasKey { typedef bool ResultType; static constexpr ResultType init_value = false; - constexpr HasKey(Key k) : k_{k} {} + explicit constexpr HasKey(Key k) : k_{k} {} constexpr ResultType apply(Key test_key, ResultType r) const { return (test_key == k_) ? true : r;