mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 01:57:37 +08:00
fix(ci): enable clang-tidy bugprone-unhandled-self-assignment / cert-oop54-cpp (#26767)
Signed-off-by: kuralme <kuralme@protonmail.com>
This commit is contained in:
parent
ed58a83a5c
commit
113853f631
@ -141,8 +141,6 @@ Checks: '*,
|
||||
-cppcoreguidelines-avoid-goto,
|
||||
-hicpp-avoid-goto,
|
||||
-bugprone-branch-clone,
|
||||
-bugprone-unhandled-self-assignment,
|
||||
-cert-oop54-cpp,
|
||||
-performance-enum-size,
|
||||
-readability-avoid-nested-conditional-operator,
|
||||
-cppcoreguidelines-prefer-member-initializer,
|
||||
|
||||
@ -92,6 +92,11 @@ public:
|
||||
// copy assignment
|
||||
Subscription &operator=(const Subscription &other)
|
||||
{
|
||||
// Check for self-assignment
|
||||
if (this == &other) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
unsubscribe();
|
||||
_orb_id = other._orb_id;
|
||||
_instance = other._instance;
|
||||
|
||||
@ -87,6 +87,11 @@ public:
|
||||
|
||||
void operator=(const LatLonAlt &lla)
|
||||
{
|
||||
// Protect against self-assignment
|
||||
if (this == &lla) {
|
||||
return;
|
||||
}
|
||||
|
||||
_latitude_rad = lla.latitude_rad();
|
||||
_longitude_rad = lla.longitude_rad();
|
||||
_altitude = lla.altitude();
|
||||
|
||||
@ -59,6 +59,11 @@ public:
|
||||
// Separate function needed otherwise the default copy constructor matches before the deep copy implementation
|
||||
Self &operator=(const Self &other)
|
||||
{
|
||||
// Protect against self-assignment
|
||||
if (this == &other) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
return this->operator=<M, N>(other);
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void fuseBias(Vector2f bias, Vector2f bias_var)
|
||||
void fuseBias(const Vector2f &bias, const Vector2f &bias_var)
|
||||
{
|
||||
if ((_sensor_ref != _sensor) && _is_sensor_fusion_active) {
|
||||
_bias[0].fuseBias(bias(0), bias_var(0));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user