From c229754a7051074376c3d107ddf2e2bec196d186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 18 Apr 2017 18:04:27 +0200 Subject: [PATCH] qt.cfg: Add configuration for QString --- cfg/qt.cfg | 35 +++++++++++++++++++++++++++++++++++ test/cfg/qt.cpp | 21 +++++++++++++++++++++ test/cfg/runtests.sh | 4 ++++ 3 files changed, 60 insertions(+) create mode 100644 test/cfg/qt.cpp diff --git a/cfg/qt.cfg b/cfg/qt.cfg index 0568665cc..aab37cba6 100644 --- a/cfg/qt.cfg +++ b/cfg/qt.cfg @@ -88,6 +88,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/cfg/qt.cpp b/test/cfg/qt.cpp new file mode 100644 index 000000000..59b205ee5 --- /dev/null +++ b/test/cfg/qt.cpp @@ -0,0 +1,21 @@ + +// Test library configuration for qt.cfg +// +// Usage: +// $ cppcheck --check-library --enable=information --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr --library=qt test/cfg/qt.cpp +// => +// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0 +// + +class QString { +public: + int size(); + char &operator[](int pos); +}; + +void QString1(QString s) { + for (int i = 0; i <= s.size(); ++i) { + // cppcheck-suppress stlOutOfBounds + s[i] = 'x'; + } +} diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh index ffed130a9..094e6c909 100755 --- a/test/cfg/runtests.sh +++ b/test/cfg/runtests.sh @@ -27,6 +27,10 @@ ${CPPCHECK} ${CPPCHECK_OPT} --library=posix ${DIR}posix.c ${CC} ${CC_OPT} -D_GNU_SOURCE ${DIR}gnu.c ${CPPCHECK} ${CPPCHECK_OPT} --library=gnu ${DIR}gnu.c +# qt.cpp +${CXX} ${CXX_OPT} ${DIR}qt.cpp +${CPPCHECK} --enable=style --enable=information --inline-suppr --error-exitcode=1 --library=qt ${DIR}qt.cpp + # std.c ${CC} ${CC_OPT} ${DIR}std.c ${CPPCHECK} ${CPPCHECK_OPT} ${DIR}std.c