Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #10689 Several Qt containers are missing from qt.cfg #6146

Merged
merged 4 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions cfg/qt.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5160,6 +5160,22 @@
<function name="crend" yields="end-iterator"/>
</access>
</container>
<container id="qtLatin1String" startPattern="QLatin1String" endPattern="" inherits="qtContainer" opLessAllowed="true" itEndPattern=":: const_iterator|const_reverse_iterator">
<type string="std-like"/>
<size>
<function name="isNull" yields="empty"/>
<function name="chop" action="change"/>
</size>
<access indexOperator="array-like">
<function name="at" yields="at_index"/>
<function name="front" yields="item"/>
<function name="back" yields="item"/>
<function name="rbegin" yields="start-iterator"/>
<function name="crbegin" yields="start-iterator"/>
<function name="rend" yields="end-iterator"/>
<function name="crend" yields="end-iterator"/>
</access>
</container>
<container id="qtByteArray" startPattern="QByteArray" endPattern="" inherits="qtContainer" opLessAllowed="true" itEndPattern=":: iterator|const_iterator|reverse_iterator|const_reverse_iterator">
<size>
<function name="isNull" yields="empty"/>
Expand All @@ -5183,6 +5199,39 @@
<function name="crend" yields="end-iterator"/>
</access>
</container>
<container id="qtMap" startPattern="QMap|QMultiMap &lt;" inherits="qtContainer">
<type templateParameter="1" associative="std-like"/>
<rangeItemRecordType>
<member name="first" templateParameter="0"/>
<member name="second" templateParameter="1"/>
</rangeItemRecordType>
<access>
<function name="count" action="find"/>
<function name="find" action="find" yields="iterator"/>
<function name="insert" action="push"/>
<function name="lower_bound" yields="iterator"/>
<function name="upper_bound" yields="iterator"/>
</access>
</container>
<container id="qtSet" startPattern="QSet &lt;" inherits="qtContainer">
<access>
<function name="count" action="find"/>
<function name="find" action="find" yields="iterator"/>
<function name="insert" action="push"/>
</access>
</container>
<container id="qtQueue" startPattern="QQueue &lt;" inherits="qtContainer">
<access>
<function name="at" yields="at_index"/>
<function name="emplace" action="push" yields="item"/>
<function name="push_front" action="push"/>
<function name="push_back" action="push"/>
<function name="pop_back" action="pop"/>
<function name="pop_front" action="pop"/>
<function name="front" yields="item"/>
<function name="back" yields="item"/>
</access>
</container>
<type-checks>
<unusedvar>
<suppress>QApplication</suppress>
Expand Down
1 change: 0 additions & 1 deletion cfg/std.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8782,7 +8782,6 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
<member name="second" templateParameter="1"/>
</rangeItemRecordType>
<access>
<function name="at" yields="at_index"/>
chrchr-github marked this conversation as resolved.
Show resolved Hide resolved
<function name="count" action="find"/>
<function name="find" action="find" yields="iterator"/>
<function name="emplace_hint" action="push" yields="iterator"/>
Expand Down
21 changes: 20 additions & 1 deletion test/cfg/qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
#include <QByteArray>
#include <QList>
#include <QLinkedList>
#include <QMap>
#include <QMultiMap>
#include <QQueue>
#include <QSet>
#include <QtPlugin>
#include <QFile>
#include <cstdio>
#include <QCoreApplication>
#include <QLoggingCategory>
#include <QTest>
Expand All @@ -27,6 +30,8 @@
#include <QSize>
#include <QPoint>

#include <cstdio>

void unreadVariable_QPoint(const QPoint &s)
{
// cppcheck-suppress unreadVariable
Expand Down Expand Up @@ -713,3 +718,17 @@ bool knownConditionTrueFalse_QString_count(const QString& s) // #11036
return false;
return true;
}

void unusedVariable_qtContainers() // #10689
{
// cppcheck-suppress unusedVariable
QMap<int, int> qm;
// cppcheck-suppress unusedVariable
QSet<int> qs;
// cppcheck-suppress unusedVariable
QMultiMap<int, int> qmm;
// cppcheck-suppress unusedVariable
QQueue<int> qq;
// cppcheck-suppress unusedVariable
QLatin1String ql1s;
}
Loading