commaai / panda

code powering the comma.ai panda
MIT License
1.54k stars 783 forks source link

misra2.5: safety modes + stm32* #2032

Closed maxime-desroches closed 2 months ago

maxime-desroches commented 2 months ago

cppcheck does not work well for Misra2.5 for 2 reasons:

  1. It will flag SOMETHING as unused when CANFD is not defined in the following example:
#ifdef CANFD
  #define SOMETHING
#endif

...

#ifdef CANFD
  use SOMETHING
#endif
  1. It will also consider a macro declared in a file included behing #ifdef... (even if the condition is false) but it will not check for usages of that macro in that file if the condition is false, making that macro a violation of Misra2.5

Because of that we won't be able to fix all Misra2.5 right now