cpplint fixes for "Single-parameter constructors should be marked explicit. [runtime/explicit] "

pull/911/head
Jesse Vincent 4 years ago committed by Gergely Nagy
parent e950aa1830
commit 7ed7d98657
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -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<typename MatrixAddr__>
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");

@ -113,7 +113,7 @@ class Bitfield : public internal::_BaseBitfield {
static constexpr size_t n_bytes_ = nBytesForBits(BitCount__);
template<typename ... Bits__>
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<BitCount__> constructor. \n"
"Compare the number of bits supplied with the provided template \n"

@ -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();

@ -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);

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

@ -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) {

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

@ -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);

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

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

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

@ -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);

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

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

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

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

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

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

@ -85,7 +85,7 @@ struct ArrayLikeStorage<StoredType__, true /* is of appropriate type */> {
public:
constexpr ArrayLikeStorage(StoredType__ entry)
explicit constexpr ArrayLikeStorage(StoredType__ entry)
: entry_(entry)
{}
@ -103,7 +103,7 @@ struct ArrayLikeStorage<StoredType__, false /* not of appropriate type */> {
public:
template<typename AnyType__>
constexpr ArrayLikeStorage(AnyType__/* non-matching entity */) {}
explicit constexpr ArrayLikeStorage(AnyType__/* non-matching entity */) {}
static constexpr uint8_t n_entries = 0;

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

Loading…
Cancel
Save