Skip to content

Commit

Permalink
Fix #12661 FP constParameterPointer with Qt containers (#6438)
Browse files Browse the repository at this point in the history
Also added some missing `<pure/>`.
  • Loading branch information
chrchr-github authored Jun 8, 2024
1 parent dc385f3 commit 35863cb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 22 deletions.
53 changes: 31 additions & 22 deletions cfg/qt.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<define name="SLOT(X)" value="#X"/>
<!-- T qAbs(const T &t) -->
<function name="qAbs">
<pure/>
<noreturn>false</noreturn>
<use-retval/>
<arg nr="1" direction="in">
Expand Down Expand Up @@ -101,6 +102,7 @@
<!-- quint32 qFloatDistance(float a, float b) -->
<!-- quint64 qFloatDistance(double a, double b) -->
<function name="qFloatDistance">
<pure/>
<noreturn>false</noreturn>
<use-retval/>
<leak-ignore/>
Expand Down Expand Up @@ -132,6 +134,7 @@
<!-- bool qFuzzyCompare(double p1, double p2) -->
<!-- bool qFuzzyCompare(float p1, float p2) -->
<function name="qFuzzyCompare">
<pure/>
<noreturn>false</noreturn>
<returnValue type="bool"/>
<use-retval/>
Expand All @@ -147,6 +150,7 @@
<!-- bool qFuzzyIsNull(double d) -->
<!-- bool qFuzzyIsNull(float f) -->
<function name="qFuzzyIsNull">
<pure/>
<noreturn>false</noreturn>
<returnValue type="bool"/>
<use-retval/>
Expand Down Expand Up @@ -177,6 +181,7 @@
<!-- bool qIsFinite(double d) -->
<!-- bool qIsFinite(float f) -->
<function name="qIsFinite">
<pure/>
<noreturn>false</noreturn>
<returnValue type="bool"/>
<use-retval/>
Expand All @@ -189,6 +194,7 @@
<!-- bool qIsInf(double d) -->
<!-- bool qIsInf(float f) -->
<function name="qIsInf">
<pure/>
<noreturn>false</noreturn>
<returnValue type="bool"/>
<use-retval/>
Expand All @@ -201,6 +207,7 @@
<!-- bool qIsNaN(double d) -->
<!-- bool qIsNaN(float f) -->
<function name="qIsNaN">
<pure/>
<noreturn>false</noreturn>
<returnValue type="bool"/>
<use-retval/>
Expand Down Expand Up @@ -267,6 +274,7 @@
<!-- int qRound(double d) -->
<!-- int qRound(float d) -->
<function name="qRound">
<pure/>
<noreturn>false</noreturn>
<returnValue type="int"/>
<use-retval/>
Expand All @@ -278,6 +286,7 @@
<!-- qint64 qRound64(double d) -->
<!-- qint64 qRound64(float d) -->
<function name="qRound64">
<pure/>
<noreturn>false</noreturn>
<returnValue type="qint64"/>
<use-retval/>
Expand Down Expand Up @@ -780,7 +789,7 @@
<function name="QList::append,QStringList::append">
<noreturn>false</noreturn>
<returnValue type="void"/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand Down Expand Up @@ -1604,7 +1613,7 @@
<function name="QList::prepend,QStringList::prepend">
<noreturn>false</noreturn>
<returnValue type="void"/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand All @@ -1628,7 +1637,7 @@
<function name="QList::push_back,QStringList::push_back">
<noreturn>false</noreturn>
<returnValue type="void"/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand All @@ -1646,7 +1655,7 @@
<function name="QList::push_front,QStringList::push_front">
<noreturn>false</noreturn>
<returnValue type="void"/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand Down Expand Up @@ -1709,7 +1718,7 @@
<function name="QList::removeAll,QStringList::removeAll">
<noreturn>false</noreturn>
<returnValue type="int"/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand Down Expand Up @@ -2599,7 +2608,7 @@
<function name="QBoxLayout::addWidget,QVBoxLayout::addWidget,QHBoxLayout::addWidget">
<noreturn>false</noreturn>
<returnValue type="void"/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
<arg nr="2" default="0" direction="in">
Expand Down Expand Up @@ -4185,7 +4194,7 @@
<noreturn>false</noreturn>
<returnValue type="void"/>
<leak-ignore/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand All @@ -4207,7 +4216,7 @@
<use-retval/>
<leak-ignore/>
<const/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand All @@ -4229,14 +4238,14 @@
<returnValue type="bool"/>
<use-retval/>
<const/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
<!-- QVector<T> &QVector::fill(const T &value, int size = ...) -->
<function name="QVector::fill,QStack::fill">
<noreturn>false</noreturn>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
<arg nr="2" direction="in" default="-1">
Expand All @@ -4251,7 +4260,7 @@
<use-retval/>
<leak-ignore/>
<const/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
<arg nr="2" direction="in" default="">
Expand All @@ -4264,13 +4273,13 @@
<function name="QVector::insert,QStack::insert">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
<arg nr="3" direction="in">
<arg nr="3" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand All @@ -4281,7 +4290,7 @@
<use-retval/>
<leak-ignore/>
<const/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
<arg nr="2" direction="in" default="-1">
Expand All @@ -4295,7 +4304,7 @@
<noreturn>false</noreturn>
<returnValue type="void"/>
<leak-ignore/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand All @@ -4317,7 +4326,7 @@
<function name="QVector::removeAll,QStack::removeAll">
<noreturn>false</noreturn>
<returnValue type="int"/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand All @@ -4337,7 +4346,7 @@
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="in">
<arg nr="2" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand Down Expand Up @@ -4376,7 +4385,7 @@
<use-retval/>
<leak-ignore/>
<const/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand Down Expand Up @@ -4437,7 +4446,7 @@
<noreturn>false</noreturn>
<returnValue type="void"/>
<leak-ignore/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand All @@ -4448,7 +4457,7 @@
<returnValue type="int"/>
<use-retval/>
<const/>
<arg nr="1" direction="in" default="">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand All @@ -4459,7 +4468,7 @@
<use-retval/>
<leak-ignore/>
<const/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand Down Expand Up @@ -4488,7 +4497,7 @@
<use-retval/>
<leak-ignore/>
<const/>
<arg nr="1" direction="in">
<arg nr="1" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand Down
5 changes: 5 additions & 0 deletions test/cfg/qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,3 +785,8 @@ void unreadVariable_QMapIterator(QMap<QString, QObject*>& m)
it.value() = new QObject();
}
}

void constVariablePointer_QVector(QVector<int*>& qv, int* p)
{
qv.push_back(p); // #12661
}

0 comments on commit 35863cb

Please sign in to comment.