fenugrec / freediag

OBD2 scantool
GNU General Public License v3.0
329 stars 73 forks source link

add (optional) cppcheck and other static analysis to cmake #69

Closed fenugrec closed 3 years ago

fenugrec commented 3 years ago

ideas: 1- https://stackoverflow.com/questions/48625499/cppcheck-support-in-cmake

2- The method described in cppcheck docs to do a "single run" doesn't really work:

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..

The file compile_commands.json is created in the current folder. Now run Cppcheck like this:

cppcheck --project=compile_commands.json

fails with Bailing out from checking ...scantool/scantool_aif.c since there was an internal error: bad macro syntax. macroname=CURFILE value=\"scantool_aif.c\" etc.

3- Running cppcheck standalone, per file, fails differently because it doesn't define stuff like unix etc.

4- Running cppcheck-gui with the cppcheck_proj file I just committed isn't perfect : it manually defines unix and HAVE_STRCASECMP, but otherwise doesn't duplicate what the cmake configuration would do.

fenugrec commented 3 years ago

fixed via #70 , thanks to @cfehse !