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