diff options
author | Russ Allbery <eagle@eyrie.org> | 2018-05-27 22:09:27 -0700 |
---|---|---|
committer | Russ Allbery <eagle@eyrie.org> | 2018-05-27 22:09:27 -0700 |
commit | b719ab5395b7b7aff88f01cea86c1c02f444ed00 (patch) | |
tree | 4b3356098b1ce6feb403cce6554b1cc4b158d54c | |
parent | cb5d14ab90abb9ba0a6f705176121534d92461b3 (diff) |
Add cppcheck testing target
No problems found, so nothing to fix.
-rw-r--r-- | Makefile.am | 6 | ||||
-rw-r--r-- | tests/data/cppcheck.supp | 30 |
2 files changed, 36 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index eb9ba7e..66193fe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -307,6 +307,12 @@ check-local: $(check_PROGRAMS) @echo '' cd perl && ./Build test +# Used by maintainers to check the source code with cppcheck. +check-cppcheck: + cd $(abs_top_srcdir) && cppcheck -q --error-exitcode=2 \ + --suppressions-list=tests/data/cppcheck.supp \ + --enable=warning,performance,portability,style . + # Alas, we have to disable this check because there's no way to do an # uninstall from Perl. distuninstallcheck: diff --git a/tests/data/cppcheck.supp b/tests/data/cppcheck.supp new file mode 100644 index 0000000..5a421df --- /dev/null +++ b/tests/data/cppcheck.supp @@ -0,0 +1,30 @@ +// Suppressions file for cppcheck. -*- conf -*- +// +// This includes suppressions for all of my projects, including files that +// aren't in rra-c-util, for ease of sharing between projects. The ones that +// don't apply to a particular project should hopefully be harmless. +// +// Copyright 2018 Russ Allbery <eagle@eyrie.org> +// +// Copying and distribution of this file, with or without modification, are +// permitted in any medium without royalty provided the copyright notice and +// this notice are preserved. This file is offered as-is, without any +// warranty. +// +// SPDX-License-Identifier: FSFAP + +// I like declaring variables at the top of a function rather than cluttering +// every if and loop body with declarations. +variableScope + +// False positive due to recursive function. +knownConditionTrueFalse:portable/getopt.c:146 + +// False positive since the string comes from a command-line define. +knownConditionTrueFalse:tests/tap/remctl.c:79 + +// Setting the variable to NULL explicitly after deallocation. +redundantAssignment:tests/pam-util/options-t.c + +// (remctl) Nested assignments in this test confuse cppcheck. +redundantAssignment:tests/server/acl-t.c |