Skip to content

Commit 35863cb

Browse files
Fix #12661 FP constParameterPointer with Qt containers (#6438)
Also added some missing `<pure/>`.
1 parent dc385f3 commit 35863cb

File tree

2 files changed

+36
-22
lines changed

2 files changed

+36
-22
lines changed

cfg/qt.cfg

+31-22
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<define name="SLOT(X)" value="#X"/>
6464
<!-- T qAbs(const T &t) -->
6565
<function name="qAbs">
66+
<pure/>
6667
<noreturn>false</noreturn>
6768
<use-retval/>
6869
<arg nr="1" direction="in">
@@ -101,6 +102,7 @@
101102
<!-- quint32 qFloatDistance(float a, float b) -->
102103
<!-- quint64 qFloatDistance(double a, double b) -->
103104
<function name="qFloatDistance">
105+
<pure/>
104106
<noreturn>false</noreturn>
105107
<use-retval/>
106108
<leak-ignore/>
@@ -132,6 +134,7 @@
132134
<!-- bool qFuzzyCompare(double p1, double p2) -->
133135
<!-- bool qFuzzyCompare(float p1, float p2) -->
134136
<function name="qFuzzyCompare">
137+
<pure/>
135138
<noreturn>false</noreturn>
136139
<returnValue type="bool"/>
137140
<use-retval/>
@@ -147,6 +150,7 @@
147150
<!-- bool qFuzzyIsNull(double d) -->
148151
<!-- bool qFuzzyIsNull(float f) -->
149152
<function name="qFuzzyIsNull">
153+
<pure/>
150154
<noreturn>false</noreturn>
151155
<returnValue type="bool"/>
152156
<use-retval/>
@@ -177,6 +181,7 @@
177181
<!-- bool qIsFinite(double d) -->
178182
<!-- bool qIsFinite(float f) -->
179183
<function name="qIsFinite">
184+
<pure/>
180185
<noreturn>false</noreturn>
181186
<returnValue type="bool"/>
182187
<use-retval/>
@@ -189,6 +194,7 @@
189194
<!-- bool qIsInf(double d) -->
190195
<!-- bool qIsInf(float f) -->
191196
<function name="qIsInf">
197+
<pure/>
192198
<noreturn>false</noreturn>
193199
<returnValue type="bool"/>
194200
<use-retval/>
@@ -201,6 +207,7 @@
201207
<!-- bool qIsNaN(double d) -->
202208
<!-- bool qIsNaN(float f) -->
203209
<function name="qIsNaN">
210+
<pure/>
204211
<noreturn>false</noreturn>
205212
<returnValue type="bool"/>
206213
<use-retval/>
@@ -267,6 +274,7 @@
267274
<!-- int qRound(double d) -->
268275
<!-- int qRound(float d) -->
269276
<function name="qRound">
277+
<pure/>
270278
<noreturn>false</noreturn>
271279
<returnValue type="int"/>
272280
<use-retval/>
@@ -278,6 +286,7 @@
278286
<!-- qint64 qRound64(double d) -->
279287
<!-- qint64 qRound64(float d) -->
280288
<function name="qRound64">
289+
<pure/>
281290
<noreturn>false</noreturn>
282291
<returnValue type="qint64"/>
283292
<use-retval/>
@@ -780,7 +789,7 @@
780789
<function name="QList::append,QStringList::append">
781790
<noreturn>false</noreturn>
782791
<returnValue type="void"/>
783-
<arg nr="1" direction="in">
792+
<arg nr="1" direction="in" indirect="0">
784793
<not-uninit/>
785794
</arg>
786795
</function>
@@ -1604,7 +1613,7 @@
16041613
<function name="QList::prepend,QStringList::prepend">
16051614
<noreturn>false</noreturn>
16061615
<returnValue type="void"/>
1607-
<arg nr="1" direction="in">
1616+
<arg nr="1" direction="in" indirect="0">
16081617
<not-uninit/>
16091618
</arg>
16101619
</function>
@@ -1628,7 +1637,7 @@
16281637
<function name="QList::push_back,QStringList::push_back">
16291638
<noreturn>false</noreturn>
16301639
<returnValue type="void"/>
1631-
<arg nr="1" direction="in">
1640+
<arg nr="1" direction="in" indirect="0">
16321641
<not-uninit/>
16331642
</arg>
16341643
</function>
@@ -1646,7 +1655,7 @@
16461655
<function name="QList::push_front,QStringList::push_front">
16471656
<noreturn>false</noreturn>
16481657
<returnValue type="void"/>
1649-
<arg nr="1" direction="in">
1658+
<arg nr="1" direction="in" indirect="0">
16501659
<not-uninit/>
16511660
</arg>
16521661
</function>
@@ -1709,7 +1718,7 @@
17091718
<function name="QList::removeAll,QStringList::removeAll">
17101719
<noreturn>false</noreturn>
17111720
<returnValue type="int"/>
1712-
<arg nr="1" direction="in">
1721+
<arg nr="1" direction="in" indirect="0">
17131722
<not-uninit/>
17141723
</arg>
17151724
</function>
@@ -2599,7 +2608,7 @@
25992608
<function name="QBoxLayout::addWidget,QVBoxLayout::addWidget,QHBoxLayout::addWidget">
26002609
<noreturn>false</noreturn>
26012610
<returnValue type="void"/>
2602-
<arg nr="1" direction="in">
2611+
<arg nr="1" direction="in" indirect="0">
26032612
<not-uninit/>
26042613
</arg>
26052614
<arg nr="2" default="0" direction="in">
@@ -4185,7 +4194,7 @@
41854194
<noreturn>false</noreturn>
41864195
<returnValue type="void"/>
41874196
<leak-ignore/>
4188-
<arg nr="1" direction="in">
4197+
<arg nr="1" direction="in" indirect="0">
41894198
<not-uninit/>
41904199
</arg>
41914200
</function>
@@ -4207,7 +4216,7 @@
42074216
<use-retval/>
42084217
<leak-ignore/>
42094218
<const/>
4210-
<arg nr="1" direction="in">
4219+
<arg nr="1" direction="in" indirect="0">
42114220
<not-uninit/>
42124221
</arg>
42134222
</function>
@@ -4229,14 +4238,14 @@
42294238
<returnValue type="bool"/>
42304239
<use-retval/>
42314240
<const/>
4232-
<arg nr="1" direction="in">
4241+
<arg nr="1" direction="in" indirect="0">
42334242
<not-uninit/>
42344243
</arg>
42354244
</function>
42364245
<!-- QVector<T> &QVector::fill(const T &value, int size = ...) -->
42374246
<function name="QVector::fill,QStack::fill">
42384247
<noreturn>false</noreturn>
4239-
<arg nr="1" direction="in">
4248+
<arg nr="1" direction="in" indirect="0">
42404249
<not-uninit/>
42414250
</arg>
42424251
<arg nr="2" direction="in" default="-1">
@@ -4251,7 +4260,7 @@
42514260
<use-retval/>
42524261
<leak-ignore/>
42534262
<const/>
4254-
<arg nr="1" direction="in">
4263+
<arg nr="1" direction="in" indirect="0">
42554264
<not-uninit/>
42564265
</arg>
42574266
<arg nr="2" direction="in" default="">
@@ -4264,13 +4273,13 @@
42644273
<function name="QVector::insert,QStack::insert">
42654274
<noreturn>false</noreturn>
42664275
<leak-ignore/>
4267-
<arg nr="1">
4276+
<arg nr="1" direction="in" indirect="0">
42684277
<not-uninit/>
42694278
</arg>
42704279
<arg nr="2" direction="in">
42714280
<not-uninit/>
42724281
</arg>
4273-
<arg nr="3" direction="in">
4282+
<arg nr="3" direction="in" indirect="0">
42744283
<not-uninit/>
42754284
</arg>
42764285
</function>
@@ -4281,7 +4290,7 @@
42814290
<use-retval/>
42824291
<leak-ignore/>
42834292
<const/>
4284-
<arg nr="1" direction="in">
4293+
<arg nr="1" direction="in" indirect="0">
42854294
<not-uninit/>
42864295
</arg>
42874296
<arg nr="2" direction="in" default="-1">
@@ -4295,7 +4304,7 @@
42954304
<noreturn>false</noreturn>
42964305
<returnValue type="void"/>
42974306
<leak-ignore/>
4298-
<arg nr="1" direction="in">
4307+
<arg nr="1" direction="in" indirect="0">
42994308
<not-uninit/>
43004309
</arg>
43014310
</function>
@@ -4317,7 +4326,7 @@
43174326
<function name="QVector::removeAll,QStack::removeAll">
43184327
<noreturn>false</noreturn>
43194328
<returnValue type="int"/>
4320-
<arg nr="1" direction="in">
4329+
<arg nr="1" direction="in" indirect="0">
43214330
<not-uninit/>
43224331
</arg>
43234332
</function>
@@ -4337,7 +4346,7 @@
43374346
<not-uninit/>
43384347
<valid>0:</valid>
43394348
</arg>
4340-
<arg nr="2" direction="in">
4349+
<arg nr="2" direction="in" indirect="0">
43414350
<not-uninit/>
43424351
</arg>
43434352
</function>
@@ -4376,7 +4385,7 @@
43764385
<use-retval/>
43774386
<leak-ignore/>
43784387
<const/>
4379-
<arg nr="1" direction="in">
4388+
<arg nr="1" direction="in" indirect="0">
43804389
<not-uninit/>
43814390
</arg>
43824391
</function>
@@ -4437,7 +4446,7 @@
44374446
<noreturn>false</noreturn>
44384447
<returnValue type="void"/>
44394448
<leak-ignore/>
4440-
<arg nr="1" direction="in">
4449+
<arg nr="1" direction="in" indirect="0">
44414450
<not-uninit/>
44424451
</arg>
44434452
</function>
@@ -4448,7 +4457,7 @@
44484457
<returnValue type="int"/>
44494458
<use-retval/>
44504459
<const/>
4451-
<arg nr="1" direction="in" default="">
4460+
<arg nr="1" direction="in" indirect="0">
44524461
<not-uninit/>
44534462
</arg>
44544463
</function>
@@ -4459,7 +4468,7 @@
44594468
<use-retval/>
44604469
<leak-ignore/>
44614470
<const/>
4462-
<arg nr="1" direction="in">
4471+
<arg nr="1" direction="in" indirect="0">
44634472
<not-uninit/>
44644473
</arg>
44654474
</function>
@@ -4488,7 +4497,7 @@
44884497
<use-retval/>
44894498
<leak-ignore/>
44904499
<const/>
4491-
<arg nr="1" direction="in">
4500+
<arg nr="1" direction="in" indirect="0">
44924501
<not-uninit/>
44934502
</arg>
44944503
</function>

test/cfg/qt.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -785,3 +785,8 @@ void unreadVariable_QMapIterator(QMap<QString, QObject*>& m)
785785
it.value() = new QObject();
786786
}
787787
}
788+
789+
void constVariablePointer_QVector(QVector<int*>& qv, int* p)
790+
{
791+
qv.push_back(p); // #12661
792+
}

0 commit comments

Comments
 (0)