diff --git a/cppcheck.supp b/cppcheck.supp new file mode 100644 index 000000000..437431e0a --- /dev/null +++ b/cppcheck.supp @@ -0,0 +1,32 @@ +// cppcheck suppression file for swift. +// +// In order to suppress a false positive add a line using one of the following templates: +// [Explaining reason - comments] +// [error id]:[filename2] +// [error id] + +// False positive caused by missing support for C++11 feature +unusedPrivateFunction:src/blackmisc/lockfree.h + +// Ignore noExplicitConstructor for now. +noExplicitConstructor + +// Ignore style issues in g2clib +variableScope:src/plugins/weatherdata/gfs/g2clib/*.c + +// std::initializer_list should always be passed by value +passedByValue:src/blackmisc/input/actionhotkeylist.h +passedByValue:src/blackmisc/logcategorylist.h + +// Shared pointers should be passed by value +passedByValue:src/blackmisc/lockfree.h + +// False positive caused by cppcheck getting confused with preprocessor defines +ConfigurationNotChecked:src/xbus/libxplanemp/src/XObjReadWrite.cpp + +// Passing std::function by value is acceptable +passedByValue:src/xbus/libxplanemp/src/ResourceManager.h +passedByValue:src/xbus/command.h + +// Unique pointers should be passed by value +passedByValue:src/xbus/menus.h diff --git a/cppcheck_suppressions.conf b/cppcheck_suppressions.conf deleted file mode 100644 index 0fddc704f..000000000 --- a/cppcheck_suppressions.conf +++ /dev/null @@ -1,37 +0,0 @@ -// cppcheck suppression file for swift. -// -// In order to suppress a false positive add a line using one of the following templates: -// [Explaining reason - comments] -// [error id]:[filename2] -// [error id] - -// Not sensible qualification errors -// unnecessaryQualification -// no longer needed as discussed in slack - -// Optional is a special case, this member should not be initialized -uninitMemberVar:src/blackmisc/optional.h - -// False positive caused by missing support for C++11 feature -unusedPrivateFunction:src/blackmisc/tuple_private.h -unusedPrivateFunction:src/blackmisc/blackmiscfreefunctions.h -unusedPrivateFunction:src/blackmisc/compare.h -unusedPrivateFunction:src/blackmisc/lockfree.h - -unusedPrivateFunction:src/blackmisc/dictionary.h - -// cppcheck shouldn’t assume operator* is commutative -duplicateExpression:tests/blackmisc/testvectormatrix.cpp -duplicateExpression:tests/blackmisc/testphysicalquantities.cpp - -// Ignore intentional hiding -variableHidingEnum:src/blackmisc/statusmessage.h - -// Ignore any preprocessor directives. -preprocessorErrorDirective - -// Ignore noExplicitConstructor for now. -noExplicitConstructor - -// Ignore style issues in g2clib -variableScope:src/plugins/weatherdata/gfs/g2clib/*.c diff --git a/src/blackmisc/datacache.cpp b/src/blackmisc/datacache.cpp index 2fbb77b1d..c297b4deb 100644 --- a/src/blackmisc/datacache.cpp +++ b/src/blackmisc/datacache.cpp @@ -332,6 +332,7 @@ namespace BlackMisc class BLACKMISC_EXPORT CDataCacheRevision::Session { public: + // cppcheck-suppress unusedFunction Session(const QString &filename) : m_filename(filename) {} void updateSession(); const QUuid &uuid() const { return m_uuid; } diff --git a/src/blackmisc/stacktrace.cpp b/src/blackmisc/stacktrace.cpp index 322d420b4..b989e1df0 100644 --- a/src/blackmisc/stacktrace.cpp +++ b/src/blackmisc/stacktrace.cpp @@ -118,6 +118,7 @@ namespace BlackMisc return result; } #else + // cppcheck-suppress unusedFunction QStringList getStackTrace() { return { "No stack trace on this platform" }; diff --git a/src/blackmisc/verify.cpp b/src/blackmisc/verify.cpp index 9387e3cc7..2c9d7bb5c 100644 --- a/src/blackmisc/verify.cpp +++ b/src/blackmisc/verify.cpp @@ -27,6 +27,7 @@ namespace BlackMisc { namespace Private { + // cppcheck-suppress unusedFunction void failedVerify(const char *condition, const char *filename, int line, const char *context, const char *message) { Q_UNUSED(condition);