From 5e9dc9f1400148bcaf77c07f5bc73db39bbaf6a7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 22 Jun 2024 19:03:01 -0400 Subject: Add cppcheck test --- test/meson.build | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test') diff --git a/test/meson.build b/test/meson.build index 2ef815e..128bf0b 100644 --- a/test/meson.build +++ b/test/meson.build @@ -34,6 +34,34 @@ if not meson.is_subproject() and get_option('lint') suite: 'code', ) endif + + # Check code with cppcheck + if not meson.is_subproject() + cppcheck = find_program('cppcheck', required: false) + if cppcheck.found() + compdb_path = join_paths(zix_build_root, 'compile_commands.json') + test( + 'cppcheck', + cppcheck, + args: [ + '--check-level=exhaustive', + '--enable=warning,style,performance,portability', + '--error-exitcode=1', + '--project=' + compdb_path, + '--suppress=assertWithSideEffect', + '--suppress=constParameterCallback', + '--suppress=constParameterPointer', + '--suppress=constVariablePointer', + '--suppress=invalidPrintfArgType_uint', + '--suppress=knownConditionTrueFalse', + '--suppress=selfAssignment', + '--suppress=unreadVariable', + '-q', + ], + suite: 'code', + ) + endif + endif endif # Set warning suppression flags specific to tests -- cgit v1.2.1