This commit is contained in:
parent
c76b05ad75
commit
30131837b5
|
@ -350,6 +350,10 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
|||
mSettings.addEnabled("performance");
|
||||
mSettings.addEnabled("portability");
|
||||
}
|
||||
if (enable_arg.find("information") != std::string::npos) {
|
||||
mSettings->addEnabled("missingInclude");
|
||||
printMessage("'--enable=information' will no longer implicitly enable 'missingInclude' starting with 2.16. Please enable it explicitly if you require it.");
|
||||
}
|
||||
}
|
||||
|
||||
// print all possible error messages..
|
||||
|
|
|
@ -155,7 +155,6 @@ std::string Settings::parseEnabled(const std::string &str, std::tuple<SimpleEnab
|
|||
severity.enable(Severity::portability);
|
||||
} else if (str == "information") {
|
||||
severity.enable(Severity::information);
|
||||
checks.enable(Checks::missingInclude);
|
||||
} else if (str == "unusedFunction") {
|
||||
checks.enable(Checks::unusedFunction);
|
||||
} else if (str == "missingInclude") {
|
||||
|
|
|
@ -4,3 +4,4 @@ release notes for cppcheck-2.11
|
|||
- It is no longer necessary to run "--check-config" to get detailed "missingInclude" and "missingIncludeSystem" messages. They will always be issued in the regular analysis if "missingInclude" is enabled.
|
||||
- "missingInclude" and "missingIncludeSystem" are reported with "-j" is > 1 and processes are used in the backend (default in non-Windows binaries)
|
||||
- "missingInclude" and "missingIncludeSystem" will now cause the "--error-exitcode" to be applied
|
||||
- "--enable=information" will no longer implicitly enable "missingInclude" starting with 2.16. Please enable it explicitly if you require it.
|
|
@ -109,6 +109,7 @@ if (BUILD_TESTS)
|
|||
endif()
|
||||
if ("cfg-${TEST_NAME}" IN_LIST SKIP_TESTS)
|
||||
else()
|
||||
# TODO: remove missingInclude disabling when it no longer is implied by --enable=information
|
||||
# TODO: add syntax check
|
||||
add_test(NAME cfg-${TEST_NAME}
|
||||
COMMAND $<TARGET_FILE:cppcheck>
|
||||
|
@ -119,7 +120,7 @@ if (BUILD_TESTS)
|
|||
--inconclusive
|
||||
--force
|
||||
--error-exitcode=1
|
||||
--suppress=missingIncludeSystem
|
||||
--disable=missingInclude
|
||||
--inline-suppr
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cfg/${CFG_TEST}
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for boost.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=boost --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/boost.cpp
|
||||
// $ cppcheck --check-library --library=boost --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/boost.cpp
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Test library configuration for bsd.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=bsd --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/bsd.c
|
||||
// $ cppcheck --check-library --library=bsd --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/bsd.c
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for cairo.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=cairo --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/cairo.c
|
||||
// $ cppcheck --check-library --library=cairo --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/cairo.c
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Test library configuration for cppunit.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=cppunit --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/cppunit.cpp
|
||||
// $ cppcheck --check-library --library=cppunit --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/cppunit.cpp
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for gnu.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=gnu --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/gnu.c
|
||||
// $ cppcheck --check-library --library=gnu --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/gnu.c
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for googletest.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=googletest --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/googletest.cpp
|
||||
// $ cppcheck --check-library --library=googletest --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/googletest.cpp
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for gtk.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=gtk --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr --library=gtk test/cfg/gtk.cpp
|
||||
// $ cppcheck --check-library --library=gtk --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr --library=gtk test/cfg/gtk.cpp
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for kde.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=kde --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/kde.cpp
|
||||
// $ cppcheck --check-library --library=kde --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/kde.cpp
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for libcurl.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=libcurl --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/libcurl.c
|
||||
// $ cppcheck --check-library --library=libcurl --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/libcurl.c
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for libsigc++.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=libsigc++ --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/libsigc++.cpp
|
||||
// $ cppcheck --check-library --library=libsigc++ --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/libsigc++.cpp
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for lua.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=lua --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/lua.c
|
||||
// $ cppcheck --check-library --library=lua --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/lua.c
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for opencv2.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=opencv2 --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/opencv2.cpp
|
||||
// $ cppcheck --check-library --library=opencv2 --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/opencv2.cpp
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for openmp.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=openmp --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/openmp.c
|
||||
// $ cppcheck --check-library --library=openmp --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/openmp.c
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for openssl.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=openssl --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/openssl.c
|
||||
// $ cppcheck --check-library --library=openssl --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/openssl.c
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for posix.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=posix --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/posix.c
|
||||
// $ cppcheck --check-library --library=posix --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/posix.c
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for python.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=python --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/python.c
|
||||
// $ cppcheck --check-library --library=python --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/python.c
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for qt.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=qt --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/qt.cpp
|
||||
// $ cppcheck --check-library --library=qt --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/qt.cpp
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -22,8 +22,9 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/
|
|||
CPPCHECK="$DIR"../../cppcheck
|
||||
CFG="$DIR"../../cfg/
|
||||
|
||||
# TODO: remove missingInclude disabling when it no longer is implied by --enable=information
|
||||
# Cppcheck options
|
||||
CPPCHECK_OPT='--check-library --platform=unix64 --enable=style,information --inconclusive --force --error-exitcode=-1 --suppress=missingIncludeSystem --inline-suppr --template="{file}:{line}:{severity}:{id}:{message}"'
|
||||
CPPCHECK_OPT='--check-library --platform=unix64 --enable=style,information --inconclusive --force --error-exitcode=-1 --disable=missingInclude --inline-suppr --template="{file}:{line}:{severity}:{id}:{message}"'
|
||||
|
||||
# Compiler settings
|
||||
CXX=g++
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for sqlite3.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=sqlite3 --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/sqlite3.c
|
||||
// $ cppcheck --check-library --library=sqlite3 --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/sqlite3.c
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for std.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=std --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/std.c
|
||||
// $ cppcheck --check-library --library=std --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/std.c
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for std.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=std --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/std.cpp
|
||||
// $ cppcheck --check-library --library=std --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/std.cpp
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for windows.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=windows --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/windows.cpp
|
||||
// $ cppcheck --check-library --library=windows --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/windows.cpp
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Test library configuration for wxwidgets.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ ./cppcheck --check-library --library=wxwidgets --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/wxwidgets.cpp
|
||||
// $ ./cppcheck --check-library --library=wxwidgets --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/wxwidgets.cpp
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
|
|
@ -93,6 +93,7 @@ private:
|
|||
TEST_CASE(enabledStyle);
|
||||
TEST_CASE(enabledPerformance);
|
||||
TEST_CASE(enabledPortability);
|
||||
TEST_CASE(enabledInformation);
|
||||
TEST_CASE(enabledUnusedFunction);
|
||||
TEST_CASE(enabledMissingInclude);
|
||||
#ifdef CHECK_INTERNAL
|
||||
|
@ -105,6 +106,8 @@ private:
|
|||
TEST_CASE(disableAll);
|
||||
TEST_CASE(disableMultiple);
|
||||
TEST_CASE(disableStylePartial);
|
||||
TEST_CASE(disableInformationPartial);
|
||||
TEST_CASE(disableInformationPartial2);
|
||||
TEST_CASE(disableInvalid);
|
||||
TEST_CASE(disableError);
|
||||
TEST_CASE(disableEmpty);
|
||||
|
@ -637,6 +640,16 @@ private:
|
|||
ASSERT_EQUALS("", GET_REDIRECT_OUTPUT);
|
||||
}
|
||||
|
||||
void enabledInformation() {
|
||||
REDIRECT;
|
||||
const char * const argv[] = {"cppcheck", "--enable=information", "file.cpp"};
|
||||
settings = Settings();
|
||||
ASSERT(defParser.parseFromArgs(3, argv));
|
||||
ASSERT(settings.severity.isEnabled(Severity::information));
|
||||
ASSERT(settings.checks.isEnabled(Checks::missingInclude));
|
||||
ASSERT_EQUALS("cppcheck: '--enable=information' will no longer implicitly enable 'missingInclude' starting with 2.16. Please enable it explicitly if you require it.\n", GET_REDIRECT_OUTPUT);
|
||||
}
|
||||
|
||||
void enabledUnusedFunction() {
|
||||
REDIRECT;
|
||||
const char * const argv[] = {"cppcheck", "--enable=unusedFunction", "file.cpp"};
|
||||
|
@ -759,6 +772,26 @@ private:
|
|||
ASSERT_EQUALS("", GET_REDIRECT_OUTPUT);
|
||||
}
|
||||
|
||||
void disableInformationPartial() {
|
||||
REDIRECT;
|
||||
const char * const argv[] = {"cppcheck", "--enable=information", "--disable=missingInclude", "file.cpp"};
|
||||
settings = Settings();
|
||||
ASSERT(defParser.parseFromArgs(4, argv));
|
||||
ASSERT(settings.severity.isEnabled(Severity::information));
|
||||
ASSERT(!settings.checks.isEnabled(Checks::missingInclude));
|
||||
ASSERT_EQUALS("cppcheck: '--enable=information' will no longer implicitly enable 'missingInclude' starting with 2.16. Please enable it explicitly if you require it.\n", GET_REDIRECT_OUTPUT);
|
||||
}
|
||||
|
||||
void disableInformationPartial2() {
|
||||
REDIRECT;
|
||||
const char * const argv[] = {"cppcheck", "--enable=missingInclude", "--disable=information", "file.cpp"};
|
||||
settings = Settings();
|
||||
ASSERT(defParser.parseFromArgs(4, argv));
|
||||
ASSERT(!settings.severity.isEnabled(Severity::information));
|
||||
ASSERT(settings.checks.isEnabled(Checks::missingInclude));
|
||||
ASSERT_EQUALS("", GET_REDIRECT_OUTPUT);
|
||||
}
|
||||
|
||||
void disableInvalid() {
|
||||
REDIRECT;
|
||||
const char * const argv[] = {"cppcheck", "--disable=leaks", "file.cpp"};
|
||||
|
|
|
@ -15,7 +15,7 @@ import shlex
|
|||
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
|
||||
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
|
||||
# changes)
|
||||
CLIENT_VERSION = "1.3.44"
|
||||
CLIENT_VERSION = "1.3.45"
|
||||
|
||||
# Timeout for analysis with Cppcheck in seconds
|
||||
CPPCHECK_TIMEOUT = 30 * 60
|
||||
|
@ -439,8 +439,9 @@ def scan_package(cppcheck_path, source_path, libraries, capture_callstack=True):
|
|||
|
||||
dir_to_scan = source_path
|
||||
|
||||
# TODO: remove missingInclude disabling when it no longer is implied by --enable=information
|
||||
# Reference for GNU C: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
|
||||
options = libs + ' --showtime=top5 --check-library --inconclusive --enable=style,information --inline-suppr --suppress=unmatchedSuppression --template=daca2'
|
||||
options = libs + ' --showtime=top5 --check-library --inconclusive --enable=style,information --inline-suppr --disable=missingInclude --suppress=unmatchedSuppression --template=daca2'
|
||||
options += ' --debug-warnings --suppress=autoNoType --suppress=valueFlowBailout --suppress=bailoutUninitVar --suppress=symbolDatabaseWarning --suppress=valueFlowBailoutIncompleteVar'
|
||||
options += ' -D__GNUC__ --platform=unix64'
|
||||
options_rp = options + ' -rp={}'.format(dir_to_scan)
|
||||
|
|
Loading…
Reference in New Issue