opendbc
opendbc copied to clipboard
No-op changes to make Panda happy
No-op change for https://github.com/commaai/panda/issues/2171
- Moves some functions and declarations around so that they can be correctly included in Panda headers.
Details
In panda, we currently need some defintions from safety.h. But we can't include safety.h directly because it contains function implementatinos (we eventually should link the implementations at compile time).
So in this PR, we're just safely moving code that will allow us to include headers from opendbc without compiler errors.
- Panda needs access to
SAFETY_ALLOUTPUT. But we can't directly include safety.h anywhere in panda because safety.h contains implementations (can't link multiple objects files that contain definitions for the same functions).- Hence, we move the definition of
SAFETY_ALLOUTPUTto safety_declarations.h, which we can then include in panda source.
- Hence, we move the definition of
- Move forward declarations of
generic_rx_checksandstock_ecu_checkfrom safety_declarations.h to safety.h (since can't include forward-declared static functions without their corresponding implementation) - make
get_ts_elapsedstatic inline! This way we can safely include utils.h without compiler errors for multiple definitions.
Further discussion: https://github.com/commaai/panda/issues/2171#issuecomment-2784918381
LGTM, @sshane any comments?