mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_Empty: introduce get_HAL_mutable() to complement get_HAL()
Returns a mutable reference to the same HAL for certain purposes where the HAL needs to be mutated to avoid UB problems with casting away const and to make the fact that mutation is happening obvious.
This commit is contained in:
parent
2dbf5aefb3
commit
db12f428c5
|
@ -66,9 +66,14 @@ void HAL_Empty::run(int argc, char* const argv[], Callbacks* callbacks) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HAL_Empty hal_empty;
|
||||||
|
|
||||||
const AP_HAL::HAL& AP_HAL::get_HAL() {
|
const AP_HAL::HAL& AP_HAL::get_HAL() {
|
||||||
static const HAL_Empty hal;
|
return hal_empty;
|
||||||
return hal;
|
}
|
||||||
|
|
||||||
|
AP_HAL::HAL& AP_HAL::get_HAL_mutable() {
|
||||||
|
return hal_empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue