qt.cfg: Add container configuration for QStack (inherits from QVector) (#2102)
This commit is contained in:
parent
4b231c53a4
commit
2c673bd380
83
cfg/qt.cfg
83
cfg/qt.cfg
|
@ -3328,10 +3328,11 @@
|
||||||
<const/>
|
<const/>
|
||||||
</function>
|
</function>
|
||||||
<!-- QVector https://doc.qt.io/qt-5/qvector.html -->
|
<!-- QVector https://doc.qt.io/qt-5/qvector.html -->
|
||||||
|
<!-- QStack inherits from QVector https://doc.qt.io/qt-5/qstack.html -->
|
||||||
<!-- void QVector::append(const T &value) -->
|
<!-- void QVector::append(const T &value) -->
|
||||||
<!-- void QVector::append(T &&value) -->
|
<!-- void QVector::append(T &&value) -->
|
||||||
<!-- void QVector::append(const QVector<T> &value) -->
|
<!-- void QVector::append(const QVector<T> &value) -->
|
||||||
<function name="QVector::append">
|
<function name="QVector::append,QStack::append">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="void"/>
|
<returnValue type="void"/>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
|
@ -3340,7 +3341,7 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- const T &QVector::at(int i) const -->
|
<!-- const T &QVector::at(int i) const -->
|
||||||
<function name="QVector::at">
|
<function name="QVector::at,QStack::at">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
|
@ -3351,12 +3352,12 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- void QVector::clear() -->
|
<!-- void QVector::clear() -->
|
||||||
<function name="QVector::clear">
|
<function name="QVector::clear,QStack::clear">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="void"/>
|
<returnValue type="void"/>
|
||||||
</function>
|
</function>
|
||||||
<!-- bool QVector::contains(const T &value) const -->
|
<!-- bool QVector::contains(const T &value) const -->
|
||||||
<function name="QVector::contains">
|
<function name="QVector::contains,QStack::contains">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="bool"/>
|
<returnValue type="bool"/>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
|
@ -3368,7 +3369,7 @@
|
||||||
</function>
|
</function>
|
||||||
<!-- int QVector::count(const T &value) const -->
|
<!-- int QVector::count(const T &value) const -->
|
||||||
<!-- int QVector::count() const -->
|
<!-- int QVector::count() const -->
|
||||||
<function name="QVector::count">
|
<function name="QVector::count,QStack::count">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="int"/>
|
<returnValue type="int"/>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
|
@ -3380,19 +3381,19 @@
|
||||||
</function>
|
</function>
|
||||||
<!-- T *QVector::data() -->
|
<!-- T *QVector::data() -->
|
||||||
<!-- const T *QVector::data() const -->
|
<!-- const T *QVector::data() const -->
|
||||||
<function name="QVector::data">
|
<function name="QVector::data,QStack::data">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
</function>
|
</function>
|
||||||
<!-- bool QVector::empty() const -->
|
<!-- bool QVector::empty() const -->
|
||||||
<function name="QVector::empty">
|
<function name="QVector::empty,QStack::empty">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="bool"/>
|
<returnValue type="bool"/>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
<const/>
|
<const/>
|
||||||
</function>
|
</function>
|
||||||
<!-- bool QVector::endsWith(const T &value) const -->
|
<!-- bool QVector::endsWith(const T &value) const -->
|
||||||
<function name="QVector::endsWith">
|
<function name="QVector::endsWith,QStack::endsWith">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="bool"/>
|
<returnValue type="bool"/>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
|
@ -3402,7 +3403,7 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- QVector<T> &QVector::fill(const T &value, int size = ...) -->
|
<!-- QVector<T> &QVector::fill(const T &value, int size = ...) -->
|
||||||
<function name="QVector::fill">
|
<function name="QVector::fill,QStack::fill">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<arg nr="1" direction="in">
|
<arg nr="1" direction="in">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
@ -3413,7 +3414,7 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- int QVector::indexOf(const T &value, int from = ...) const -->
|
<!-- int QVector::indexOf(const T &value, int from = ...) const -->
|
||||||
<function name="QVector::indexOf">
|
<function name="QVector::indexOf,QStack::indexOf">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="int"/>
|
<returnValue type="int"/>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
|
@ -3429,7 +3430,7 @@
|
||||||
</function>
|
</function>
|
||||||
<!-- void QVector::insert(int i, int count, const T &value) -->
|
<!-- void QVector::insert(int i, int count, const T &value) -->
|
||||||
<!-- QVector::iterator QVector::insert(QVector::iterator before, int count, const T &value) -->
|
<!-- QVector::iterator QVector::insert(QVector::iterator before, int count, const T &value) -->
|
||||||
<function name="QVector::insert">
|
<function name="QVector::insert,QStack::insert">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
@ -3443,14 +3444,14 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- bool QVector::isEmpty() const -->
|
<!-- bool QVector::isEmpty() const -->
|
||||||
<function name="QVector::isEmpty">
|
<function name="QVector::isEmpty,QStack::isEmpty">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="bool"/>
|
<returnValue type="bool"/>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
<const/>
|
<const/>
|
||||||
</function>
|
</function>
|
||||||
<!-- int QVector::lastIndexOf(const T &value, int from = ...) const -->
|
<!-- int QVector::lastIndexOf(const T &value, int from = ...) const -->
|
||||||
<function name="QVector::lastIndexOf">
|
<function name="QVector::lastIndexOf,QStack::lastIndexOf">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="int"/>
|
<returnValue type="int"/>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
|
@ -3465,7 +3466,7 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- int QVector::length() const -->
|
<!-- int QVector::length() const -->
|
||||||
<function name="QVector::length">
|
<function name="QVector::length,QStack::length">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="int"/>
|
<returnValue type="int"/>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
|
@ -3473,7 +3474,7 @@
|
||||||
</function>
|
</function>
|
||||||
<!-- void QVector::push_back(const T &value) -->
|
<!-- void QVector::push_back(const T &value) -->
|
||||||
<!-- void QVector::push_back(T &&value) -->
|
<!-- void QVector::push_back(T &&value) -->
|
||||||
<function name="QVector::push_back">
|
<function name="QVector::push_back,QStack::push_back">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="void"/>
|
<returnValue type="void"/>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
|
@ -3483,7 +3484,7 @@
|
||||||
</function>
|
</function>
|
||||||
<!-- void QVector::remove(int i) -->
|
<!-- void QVector::remove(int i) -->
|
||||||
<!-- void QVector::remove(int i, int count) -->
|
<!-- void QVector::remove(int i, int count) -->
|
||||||
<function name="QVector::remove">
|
<function name="QVector::remove,QStack::remove">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="void"/>
|
<returnValue type="void"/>
|
||||||
<arg nr="1" direction="in">
|
<arg nr="1" direction="in">
|
||||||
|
@ -3496,7 +3497,7 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- int QVector::removeAll(const T &t) -->
|
<!-- int QVector::removeAll(const T &t) -->
|
||||||
<function name="QVector::removeAll">
|
<function name="QVector::removeAll,QStack::removeAll">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="int"/>
|
<returnValue type="int"/>
|
||||||
<arg nr="1" direction="in">
|
<arg nr="1" direction="in">
|
||||||
|
@ -3504,7 +3505,7 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- void QVector::removeAt(int i) -->
|
<!-- void QVector::removeAt(int i) -->
|
||||||
<function name="QVector::removeAt">
|
<function name="QVector::removeAt,QStack::removeAt">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="void"/>
|
<returnValue type="void"/>
|
||||||
<arg nr="1" direction="in">
|
<arg nr="1" direction="in">
|
||||||
|
@ -3512,7 +3513,7 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- void QVector::replace(int i, const T &value) -->
|
<!-- void QVector::replace(int i, const T &value) -->
|
||||||
<function name="QVector::replace">
|
<function name="QVector::replace,QStack::replace">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="void"/>
|
<returnValue type="void"/>
|
||||||
<arg nr="1" direction="in">
|
<arg nr="1" direction="in">
|
||||||
|
@ -3524,7 +3525,7 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- void QVector::reserve(int size) -->
|
<!-- void QVector::reserve(int size) -->
|
||||||
<function name="QVector::reserve">
|
<function name="QVector::reserve,QStack::reserve">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="void"/>
|
<returnValue type="void"/>
|
||||||
<arg nr="1" direction="in">
|
<arg nr="1" direction="in">
|
||||||
|
@ -3532,27 +3533,27 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- void QVector::resize(int size) -->
|
<!-- void QVector::resize(int size) -->
|
||||||
<function name="QVector::resize">
|
<function name="QVector::resize,QStack::resize">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="false"/>
|
<returnValue type="void"/>
|
||||||
<arg nr="1" direction="in">
|
<arg nr="1" direction="in">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- int QVector::size() const -->
|
<!-- int QVector::size() const -->
|
||||||
<function name="QVector::size">
|
<function name="QVector::size,QStack::size">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="int"/>
|
<returnValue type="int"/>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
<const/>
|
<const/>
|
||||||
</function>
|
</function>
|
||||||
<!-- void QVector::squeeze() -->
|
<!-- void QVector::squeeze() -->
|
||||||
<function name="QVector::squeeze">
|
<function name="QVector::squeeze,QStack::squeeze">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="void"/>
|
<returnValue type="void"/>
|
||||||
</function>
|
</function>
|
||||||
<!-- bool QVector::startsWith(const T &value) const -->
|
<!-- bool QVector::startsWith(const T &value) const -->
|
||||||
<function name="QVector::startsWith">
|
<function name="QVector::startsWith,QStack::startsWith">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="bool"/>
|
<returnValue type="bool"/>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
|
@ -3563,14 +3564,14 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- void QVector::swap(QVector<T> &other) -->
|
<!-- void QVector::swap(QVector<T> &other) -->
|
||||||
<function name="QVector::swap">
|
<function name="QVector::swap,QStack::swap">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="void"/>
|
<returnValue type="void"/>
|
||||||
<arg nr="1"/>
|
<arg nr="1"/>
|
||||||
</function>
|
</function>
|
||||||
<!-- T QVector::value(int i) const -->
|
<!-- T QVector::value(int i) const -->
|
||||||
<!-- T QVector::value(int i, const T &defaultValue) const -->
|
<!-- T QVector::value(int i, const T &defaultValue) const -->
|
||||||
<function name="QVector::value">
|
<function name="QVector::value,QStack::value">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
<const/>
|
<const/>
|
||||||
|
@ -3582,6 +3583,25 @@
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
|
<!-- QStack https://doc.qt.io/qt-5/qstack.html -->
|
||||||
|
<!-- T QStack::pop() -->
|
||||||
|
<function name="QStack::pop">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
</function>
|
||||||
|
<!-- void QStack::push(const T &t) -->
|
||||||
|
<function name="QStack::push">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="void"/>
|
||||||
|
<arg nr="1" direction="in">
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
|
<!-- T &QStack::top() -->
|
||||||
|
<!-- const T &QStack::top() const -->
|
||||||
|
<function name="QStack::top">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<use-retval/>
|
||||||
|
</function>
|
||||||
<!-- QByteArray https://doc.qt.io/qt-5/qbytearray.html -->
|
<!-- QByteArray https://doc.qt.io/qt-5/qbytearray.html -->
|
||||||
<!-- char QByteArray::at(int i) const -->
|
<!-- char QByteArray::at(int i) const -->
|
||||||
<function name="QByteArray::at">
|
<function name="QByteArray::at">
|
||||||
|
@ -3765,6 +3785,15 @@
|
||||||
<function name="crend" yields="end-iterator"/>
|
<function name="crend" yields="end-iterator"/>
|
||||||
</access>
|
</access>
|
||||||
</container>
|
</container>
|
||||||
|
<container id="qtStack" startPattern="QStack <" inherits="qtVector">
|
||||||
|
<size>
|
||||||
|
<function name="push" action="push"/>
|
||||||
|
<function name="pop" action="pop"/>
|
||||||
|
</size>
|
||||||
|
<access indexOperator="array-like">
|
||||||
|
<function name="top" yields="item"/>
|
||||||
|
</access>
|
||||||
|
</container>
|
||||||
<container id="qtString" startPattern="QString" endPattern="" inherits="qtContainer" opLessAllowed="true" itEndPattern=":: iterator|const_iterator|reverse_iterator|const_reverse_iterator">
|
<container id="qtString" startPattern="QString" endPattern="" inherits="qtContainer" opLessAllowed="true" itEndPattern=":: iterator|const_iterator|reverse_iterator|const_reverse_iterator">
|
||||||
<type string="std-like"/>
|
<type string="std-like"/>
|
||||||
<size>
|
<size>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include <QStack>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QLinkedList>
|
#include <QLinkedList>
|
||||||
|
@ -280,6 +281,68 @@ QVector<int>::iterator QVector2()
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QStack1(QStack<int> intStackArg)
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= intStackArg.size(); ++i) {
|
||||||
|
// cppcheck-suppress stlOutOfBounds
|
||||||
|
intStackArg[i] = 1;
|
||||||
|
}
|
||||||
|
// cppcheck-suppress containerOutOfBoundsIndexExpression
|
||||||
|
intStackArg[intStackArg.length()] = 5;
|
||||||
|
// cppcheck-suppress containerOutOfBoundsIndexExpression
|
||||||
|
intStackArg[intStackArg.count()] = 10;
|
||||||
|
// cppcheck-suppress containerOutOfBoundsIndexExpression
|
||||||
|
printf("val: %d\n", intStackArg[intStackArg.size()]);
|
||||||
|
|
||||||
|
QStack<QString> qstringStack1;
|
||||||
|
qstringStack1.push("one");
|
||||||
|
qstringStack1.push("two");
|
||||||
|
(void)qstringStack1[1];
|
||||||
|
|
||||||
|
QStack<QString> qstringStack2;
|
||||||
|
qstringStack2 << "one" << "two";
|
||||||
|
// FIXME: The following containerOutOfBounds suppression is wrong #9242
|
||||||
|
// Please remove the suppression as soon as this is fixed
|
||||||
|
// cppcheck-suppress containerOutOfBounds
|
||||||
|
(void)qstringStack2[1];
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
qstringStack2.startsWith("one");
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
qstringStack2.endsWith("one");
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
qstringStack2.count();
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
qstringStack2.length();
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
qstringStack2.size();
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
qstringStack2.at(5);
|
||||||
|
// cppcheck-suppress invalidFunctionArg
|
||||||
|
(void)qstringStack2.at(-5);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStack<int>::iterator QStack2()
|
||||||
|
{
|
||||||
|
QStack<int> qstack1;
|
||||||
|
QStack<int> qstack2;
|
||||||
|
// cppcheck-suppress iterators2
|
||||||
|
for (QStack<int>::iterator it = qstack1.begin(); it != qstack2.end(); ++it)
|
||||||
|
{}
|
||||||
|
|
||||||
|
QStack<int>::iterator it = qstack1.begin();
|
||||||
|
// TODO cppcheck-suppress returnDanglingLifetime
|
||||||
|
return it;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QStack3()
|
||||||
|
{
|
||||||
|
QStack<int> intStack;
|
||||||
|
intStack.push(1);
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
intStack.top();
|
||||||
|
intStack.pop();
|
||||||
|
}
|
||||||
|
|
||||||
// Verify that Qt macros do not result in syntax errors, false positives or other issues.
|
// Verify that Qt macros do not result in syntax errors, false positives or other issues.
|
||||||
class MacroTest1: public QObject {
|
class MacroTest1: public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
Loading…
Reference in New Issue