clang-tidy: partially fix modernize-use-equals-default

This commit is contained in:
Daniel Agar
2019-10-27 17:54:24 -04:00
parent 967446af4c
commit 380cae18d1
32 changed files with 31 additions and 40 deletions
-1
View File
@@ -79,7 +79,6 @@ Checks: '*,
-modernize-use-auto, -modernize-use-auto,
-modernize-use-bool-literals, -modernize-use-bool-literals,
-modernize-use-default-member-init, -modernize-use-default-member-init,
-modernize-use-emplace,
-modernize-use-equals-default, -modernize-use-equals-default,
-modernize-use-equals-delete, -modernize-use-equals-delete,
-modernize-use-override, -modernize-use-override,
+1 -1
View File
@@ -50,7 +50,7 @@ class VFile : public CDev
public: public:
static VFile *createFile(const char *fname, mode_t mode); static VFile *createFile(const char *fname, mode_t mode);
~VFile() {} ~VFile() = default;
ssize_t write(file_t *handlep, const char *buffer, size_t buflen) override; ssize_t write(file_t *handlep, const char *buffer, size_t buflen) override;
+1 -1
View File
@@ -66,7 +66,7 @@ public:
_index(0), _index(0),
_delay(-1) _delay(-1)
{} {}
virtual ~BlockDelay() {} virtual ~BlockDelay() = default;
matrix::Matrix<Type, M, N> update(const matrix::Matrix<Type, M, N> &u) matrix::Matrix<Type, M, N> update(const matrix::Matrix<Type, M, N> &u)
{ {
// store current value // store current value
+1 -1
View File
@@ -68,7 +68,7 @@ public:
_initialized(false), _initialized(false),
_lowPass(this, "LP") _lowPass(this, "LP")
{} {}
virtual ~BlockDerivative() {} virtual ~BlockDerivative() = default;
/** /**
* Update the state and get current derivative * Update the state and get current derivative
+1 -1
View File
@@ -69,7 +69,7 @@ public:
_y(0), _y(0),
_fCut(this, "") // only one parameter, no need to name _fCut(this, "") // only one parameter, no need to name
{} {}
virtual ~BlockHighPass() {} virtual ~BlockHighPass() = default;
float update(float input); float update(float input);
// accessors // accessors
float getU() {return _u;} float getU() {return _u;}
+1 -1
View File
@@ -64,7 +64,7 @@ public:
SuperBlock(parent, name), SuperBlock(parent, name),
_y(0), _y(0),
_limit(this, "") {} _limit(this, "") {}
virtual ~BlockIntegral() {} virtual ~BlockIntegral() = default;
float update(float input); float update(float input);
// accessors // accessors
float getY() {return _y;} float getY() {return _y;}
+1 -1
View File
@@ -72,7 +72,7 @@ public:
_u(0), _u(0),
_y(0), _y(0),
_limit(this, "") {} _limit(this, "") {}
virtual ~BlockIntegralTrap() {} virtual ~BlockIntegralTrap() = default;
float update(float input); float update(float input);
// accessors // accessors
float getU() {return _u;} float getU() {return _u;}
+1 -1
View File
@@ -69,7 +69,7 @@ public:
_min(this, "MIN"), _min(this, "MIN"),
_max(this, "MAX") _max(this, "MAX")
{} {}
virtual ~BlockLimit() {} virtual ~BlockLimit() = default;
float update(float input); float update(float input);
// accessors // accessors
float getMin() { return _min.get(); } float getMin() { return _min.get(); }
+1 -1
View File
@@ -68,7 +68,7 @@ public:
Block(parent, name), Block(parent, name),
_max(this, "MAX") _max(this, "MAX")
{} {}
virtual ~BlockLimitSym() {} virtual ~BlockLimitSym() = default;
float update(float input); float update(float input);
// accessors // accessors
float getMax() { return _max.get(); } float getMax() { return _max.get(); }
+1 -1
View File
@@ -69,7 +69,7 @@ public:
_state(NAN /* initialize to invalid val, force into is_finite() check on first call */), _state(NAN /* initialize to invalid val, force into is_finite() check on first call */),
_fCut(this, "") // only one parameter, no need to name _fCut(this, "") // only one parameter, no need to name
{} {}
virtual ~BlockLowPass() {} virtual ~BlockLowPass() = default;
float update(float input); float update(float input);
// accessors // accessors
float getState() { return _state; } float getState() { return _state; }
+1 -1
View File
@@ -69,7 +69,7 @@ public:
_fs(sample_freq), _fs(sample_freq),
_lp(_fs, _fCut.get()) _lp(_fs, _fCut.get())
{} {}
virtual ~BlockLowPass2() {} virtual ~BlockLowPass2() = default;
float update(float input); float update(float input);
// accessors // accessors
float getState() { return _state; } float getState() { return _state; }
+1 -1
View File
@@ -70,7 +70,7 @@ public:
_state(i) = 0.0f / 0.0f; _state(i) = 0.0f / 0.0f;
} }
} }
virtual ~BlockLowPassVector() {} virtual ~BlockLowPassVector() = default;
matrix::Vector<Type, M> update(const matrix::Matrix<Type, M, 1> &input) matrix::Vector<Type, M> update(const matrix::Matrix<Type, M, 1> &input)
{ {
for (size_t i = 0; i < M; i++) { for (size_t i = 0; i < M; i++) {
+1 -1
View File
@@ -70,7 +70,7 @@ public:
update(0); update(0);
} }
virtual ~BlockOutput() {} virtual ~BlockOutput() = default;
void update(float input) void update(float input)
{ {
_val = _limit.update(input + getTrim()); _val = _limit.update(input + getTrim());
+1 -1
View File
@@ -67,7 +67,7 @@ public:
Block(parent, name), Block(parent, name),
_kP(this, "") // only one param, no need to name _kP(this, "") // only one param, no need to name
{} {}
virtual ~BlockP() {} virtual ~BlockP() = default;
float update(float input) float update(float input)
{ {
return getKP() * input; return getKP() * input;
+1 -1
View File
@@ -69,7 +69,7 @@ public:
_kP(this, "P"), _kP(this, "P"),
_kD(this, "D") _kD(this, "D")
{} {}
virtual ~BlockPD() {} virtual ~BlockPD() = default;
float update(float input) float update(float input)
{ {
return getKP() * input + return getKP() * input +
+1 -1
View File
@@ -69,7 +69,7 @@ public:
_kP(this, "P"), _kP(this, "P"),
_kI(this, "I") _kI(this, "I")
{} {}
virtual ~BlockPI() {} virtual ~BlockPI() = default;
float update(float input) float update(float input)
{ {
return getKP() * input + return getKP() * input +
+1 -1
View File
@@ -71,7 +71,7 @@ public:
_kI(this, "I"), _kI(this, "I"),
_kD(this, "D") _kD(this, "D")
{} {}
virtual ~BlockPID() {} virtual ~BlockPID() = default;
float update(float input) float update(float input)
{ {
return getKP() * input + return getKP() * input +
+1 -1
View File
@@ -69,7 +69,7 @@ public:
// in main program for all calls to rand // in main program for all calls to rand
// XXX currently in nuttx if you seed to 0, rand breaks // XXX currently in nuttx if you seed to 0, rand breaks
} }
virtual ~BlockRandGauss() {} virtual ~BlockRandGauss() = default;
float update() float update()
{ {
static float V1, V2, S; static float V1, V2, S;
+1 -1
View File
@@ -72,7 +72,7 @@ public:
// in main program for all calls to rand // in main program for all calls to rand
// XXX currently in nuttx if you seed to 0, rand breaks // XXX currently in nuttx if you seed to 0, rand breaks
} }
virtual ~BlockRandUniform() {} virtual ~BlockRandUniform() = default;
float update() float update()
{ {
static float rand_max = RAND_MAX; static float rand_max = RAND_MAX;
+1 -1
View File
@@ -67,7 +67,7 @@ public:
_sumSq(), _sumSq(),
_count(0) _count(0)
{} {}
virtual ~BlockStats() {} virtual ~BlockStats() = default;
void update(const matrix::Vector<Type, M> &u) void update(const matrix::Vector<Type, M> &u)
{ {
_sum += u; _sum += u;
-4
View File
@@ -50,10 +50,6 @@ SMBus::SMBus(int bus_num, uint16_t address) :
{ {
} }
SMBus::~SMBus()
{
}
int SMBus::read_word(const uint8_t cmd_code, void *data) int SMBus::read_word(const uint8_t cmd_code, void *data)
{ {
// 2 data bytes + pec byte // 2 data bytes + pec byte
+1 -1
View File
@@ -48,7 +48,7 @@ class SMBus : public device::I2C
{ {
public: public:
SMBus(int bus_num, uint16_t address); SMBus(int bus_num, uint16_t address);
~SMBus(); ~SMBus() override = default;
/** /**
* @brief Sends a block write command. * @brief Sends a block write command.
+2 -2
View File
@@ -192,7 +192,7 @@ public:
* @param control_cb Callback invoked when reading controls. * @param control_cb Callback invoked when reading controls.
*/ */
Mixer(ControlCallback control_cb, uintptr_t cb_handle); Mixer(ControlCallback control_cb, uintptr_t cb_handle);
virtual ~Mixer() {} virtual ~Mixer() = default;
/** /**
* Perform the mixing function. * Perform the mixing function.
@@ -471,7 +471,7 @@ class NullMixer : public Mixer
{ {
public: public:
NullMixer(); NullMixer();
~NullMixer() {} ~NullMixer() = default;
/** /**
* Factory method. * Factory method.
@@ -48,7 +48,7 @@ TerrainEstimator::TerrainEstimator() :
_time_last_distance(0), _time_last_distance(0),
_time_last_gps(0) _time_last_gps(0)
{ {
memset(&_x._data[0], 0, sizeof(_x._data)); _x.zero();
_u_z = 0.0f; _u_z = 0.0f;
_P.setIdentity(); _P.setIdentity();
} }
@@ -60,7 +60,7 @@ class __EXPORT TerrainEstimator
{ {
public: public:
TerrainEstimator(); TerrainEstimator();
~TerrainEstimator() {} ~TerrainEstimator() = default;
bool is_valid() {return _terrain_valid;} bool is_valid() {return _terrain_valid;}
float get_distance_to_ground() {return -_x(0);} float get_distance_to_ground() {return -_x(0);}
@@ -56,6 +56,7 @@ class FixedwingLandDetector final : public LandDetector
{ {
public: public:
FixedwingLandDetector(); FixedwingLandDetector();
~FixedwingLandDetector() override = default;
protected: protected:
@@ -60,6 +60,7 @@ class MulticopterLandDetector : public LandDetector
{ {
public: public:
MulticopterLandDetector(); MulticopterLandDetector();
~MulticopterLandDetector() override = default;
protected: protected:
void _update_params() override; void _update_params() override;
@@ -50,6 +50,7 @@ class RoverLandDetector : public LandDetector
{ {
public: public:
RoverLandDetector() = default; RoverLandDetector() = default;
~RoverLandDetector() override = default;
protected: protected:
bool _get_ground_contact_state() override; bool _get_ground_contact_state() override;
@@ -46,10 +46,6 @@
namespace land_detector namespace land_detector
{ {
VtolLandDetector::VtolLandDetector()
{
}
void VtolLandDetector::_update_topics() void VtolLandDetector::_update_topics()
{ {
MulticopterLandDetector::_update_topics(); MulticopterLandDetector::_update_topics();
+2 -1
View File
@@ -52,7 +52,8 @@ namespace land_detector
class VtolLandDetector : public MulticopterLandDetector class VtolLandDetector : public MulticopterLandDetector
{ {
public: public:
VtolLandDetector(); VtolLandDetector() = default;
~VtolLandDetector() override = default;
protected: protected:
void _update_topics() override; void _update_topics() override;
-4
View File
@@ -66,10 +66,6 @@ MavlinkULog::MavlinkULog(int datarate, float max_rate_factor, uint8_t target_sys
_next_rate_check = _last_sent_time + _rate_calculation_delta_t * 1.e6f; _next_rate_check = _last_sent_time + _rate_calculation_delta_t * 1.e6f;
} }
MavlinkULog::~MavlinkULog()
{
}
void MavlinkULog::start_ack_received() void MavlinkULog::start_ack_received()
{ {
if (_waiting_for_initial_ack) { if (_waiting_for_initial_ack) {
+1 -1
View File
@@ -102,7 +102,7 @@ private:
MavlinkULog(int datarate, float max_rate_factor, uint8_t target_system, uint8_t target_component); MavlinkULog(int datarate, float max_rate_factor, uint8_t target_system, uint8_t target_component);
~MavlinkULog(); ~MavlinkULog() = default;
static void lock() static void lock()
{ {