diff options
-rw-r--r-- | meson.build | 1 | ||||
-rw-r--r-- | test/meson.build | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/meson.build b/meson.build index 0675045..3a99f85 100644 --- a/meson.build +++ b/meson.build @@ -16,6 +16,7 @@ project( ) zix_src_root = meson.current_source_dir() +zix_build_root = meson.current_build_dir() major_version = meson.project_version().split('.')[0] version_suffix = '-@0@'.format(major_version) versioned_name = 'zix' + version_suffix 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 |