cppcheck/test/cfg/qt.cpp

29 lines
650 B
C++
Raw Normal View History

2017-04-18 18:04:27 +02:00
// Test library configuration for qt.cfg
//
// Usage:
2017-04-18 18:47:35 +02:00
// $ cppcheck --check-library --enable=information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr --library=qt test/cfg/qt.cpp
2017-04-18 18:04:27 +02:00
// =>
// 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';
}
}
2017-04-18 18:47:35 +02:00
int QString2() {
QString s;
2017-04-18 19:21:34 +02:00
// cppcheck-suppress ignoredReturnValue
2017-04-18 18:47:35 +02:00
// cppcheck-suppress reademptycontainer
2017-04-18 19:26:54 +02:00
return s.size();
}