Skip to content

Commit

Permalink
Merged into main
Browse files Browse the repository at this point in the history
  • Loading branch information
orbitcowboy committed Mar 21, 2024
2 parents d38418e + e64c368 commit 421bcfc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 28 deletions.
6 changes: 3 additions & 3 deletions cfg/qt.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5236,12 +5236,12 @@
<unusedvar>
<suppress>QApplication</suppress>
<suppress>QMutexLocker</suppress>
<check>QRectF</check>
<check>QSizeF</check>
<check>QPointF</check>
<check>QRect</check>
<check>QRectF</check>
<check>QSize</check>
<check>QSizeF</check>
<check>QPoint</check>
<check>QPointF</check>
<check>QRegion</check>
</unusedvar>
<operatorEqVarError>
Expand Down
4 changes: 3 additions & 1 deletion lib/checkunusedvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,10 +713,12 @@ void CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(const Scope* const
type = Variables::pointer;
else if (mTokenizer->isC() ||
i->typeEndToken()->isStandardType() ||
i->isStlType() ||
isRecordTypeWithoutSideEffects(i->type()) ||
mSettings->library.detectContainer(i->typeStartToken()) ||
i->isStlType())
mSettings->library.getTypeCheck("unusedvar", i->typeStartToken()->str()) == Library::TypeCheck::check)
type = Variables::standard;

if (type == Variables::none || isPartOfClassStructUnion(i->typeStartToken()))
continue;
const Token* defValTok = i->nameToken()->next();
Expand Down
22 changes: 11 additions & 11 deletions test/cfg/qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
#include <QCoreApplication>
#include <QLoggingCategory>
#include <QTest>
#include <QRectF>
#include <QRegion>
#include <QSizeF>
#include <QPointF>
#include <QRect>
#include <QRectF>
#include <QSize>
#include <QSizeF>
#include <QPoint>
#include <QPointF>
#include <QRegion>

#include <cstdio>

void unreadVariable_QRegion(const int x, const QRegion::RegionType type, const QPolygon &polygon, const QBitmap &bm, const QRegion &region, const Qt::FillRule fillRule)
{
// cppcheck-suppress unreadVariable
// cppcheck-suppress unusedVariable
QRegion a;
// cppcheck-suppress unreadVariable
QRegion b{};
Expand All @@ -53,7 +53,7 @@ void unreadVariable_QRegion(const int x, const QRegion::RegionType type, const Q

void unreadVariable_QPoint(const QPoint &s)
{
// cppcheck-suppress unreadVariable
// cppcheck-suppress unusedVariable
QPoint a;
// cppcheck-suppress unreadVariable
QPoint b{};
Expand All @@ -67,7 +67,7 @@ void unreadVariable_QPoint(const QPoint &s)

void unreadVariable_QPointF(const QPointF &s)
{
// cppcheck-suppress unreadVariable
// cppcheck-suppress unusedVariable
QPointF a;
// cppcheck-suppress unreadVariable
QPointF b{};
Expand All @@ -81,7 +81,7 @@ void unreadVariable_QPointF(const QPointF &s)

void unreadVariable_QSizeF(const QSize &s)
{
// cppcheck-suppress unreadVariable
// cppcheck-suppress unusedVariable
QSizeF a;
// cppcheck-suppress unreadVariable
QSizeF b{};
Expand All @@ -95,7 +95,7 @@ void unreadVariable_QSizeF(const QSize &s)

void unreadVariable_QSize(const QSize &s)
{
// cppcheck-suppress unreadVariable
// cppcheck-suppress unusedVariable
QSize a;
// cppcheck-suppress unreadVariable
QSize b{};
Expand All @@ -108,7 +108,7 @@ void unreadVariable_QSize(const QSize &s)
}

void unreadVariable_QRect(const QPoint &topLeft, const QSize &size, const QPoint &bottomRight, const int x) {
// cppcheck-suppress unreadVariable
// cppcheck-suppress unusedVariable
QRect a;
// cppcheck-suppress unreadVariable
QRect b{};
Expand All @@ -123,7 +123,7 @@ void unreadVariable_QRect(const QPoint &topLeft, const QSize &size, const QPoint
}

void unreadVariable_QRectF(const QPointF &topLeft, const QSizeF &size, const QPointF &bottomRight, const QRectF &rect, const qreal x) {
// cppcheck-suppress unreadVariable
// cppcheck-suppress unusedVariable
QRectF a;
// cppcheck-suppress unreadVariable
QRectF b{};
Expand Down
26 changes: 13 additions & 13 deletions test/cfg/wxwidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

void unreadVariable_wxPoint2DInt(const wxInt32 x, const wxPoint2DInt& pti, const wxPoint &pt)
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxPoint2DInt a;
// cppcheck-suppress unreadVariable
wxPoint2DInt b(x, x);
Expand All @@ -51,7 +51,7 @@ void unreadVariable_wxPoint2DInt(const wxInt32 x, const wxPoint2DInt& pti, const

void unreadVariable_wxPoint2DDouble(const wxDouble x, const wxPoint2DDouble& ptd, const wxPoint2DInt& pti, const wxPoint &pt)
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxPoint2DDouble a;
// cppcheck-suppress unreadVariable
wxPoint2DDouble b(x, x);
Expand All @@ -65,13 +65,13 @@ void unreadVariable_wxPoint2DDouble(const wxDouble x, const wxPoint2DDouble& ptd

void unusedVariable_wxAcceleratorEntry()
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxAcceleratorEntry a;
}

void unreadVariable_wxDateSpan(const int x)
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxDateSpan a;
// cppcheck-suppress unreadVariable
wxDateSpan b{x};
Expand All @@ -85,7 +85,7 @@ void unreadVariable_wxDateSpan(const int x)

void unreadVariable_wxTimeSpan(const long x, const wxLongLong y)
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxTimeSpan a;
// TODO cppcheck-suppress unreadVariable
wxTimeSpan b{};
Expand All @@ -107,7 +107,7 @@ void unreadVariable_wxFileType(const wxFileTypeInfo &info)

void unreadVariable_wxPosition(const int x)
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxPosition a;
// TODO cppcheck-suppress unreadVariable
wxPosition b{};
Expand All @@ -117,7 +117,7 @@ void unreadVariable_wxPosition(const int x)

void unreadVariable_wxRegEx(const wxString &expr, const int flags)
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxRegEx a;
// cppcheck-suppress unreadVariable
wxRegEx b{expr};
Expand All @@ -127,7 +127,7 @@ void unreadVariable_wxRegEx(const wxString &expr, const int flags)

void unreadVariable_wxRegion(const wxCoord x, const wxPoint &pt, const wxRect &rect, const wxRegion &region, const wxBitmap &bmp)
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxRegion a;
// TODO cppcheck-suppress unreadVariable
wxRegion b{};
Expand All @@ -145,7 +145,7 @@ void unreadVariable_wxRegion(const wxCoord x, const wxPoint &pt, const wxRect &r

void unreadVariable_wxVersionInfo(const wxString &name, const int major, const int minor, const int micro, const wxString &description, const wxString &copyright)
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxVersionInfo a;
// cppcheck-suppress unreadVariable
wxVersionInfo b(name);
Expand All @@ -163,7 +163,7 @@ void unreadVariable_wxVersionInfo(const wxString &name, const int major, const i

void unreadVariable_wxSize(const wxSize &s)
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxSize a;
// TODO cppcheck-suppress unreadVariable
wxSize b{};
Expand All @@ -177,7 +177,7 @@ void unreadVariable_wxSize(const wxSize &s)

void unreadVariable_wxPoint(const wxRealPoint &rp, const int x, const int y)
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxPoint a;
// TODO cppcheck-suppress unreadVariable
wxPoint b{};
Expand All @@ -195,7 +195,7 @@ void unreadVariable_wxPoint(const wxRealPoint &rp, const int x, const int y)

void unreadVariable_wxRealPoint(const wxPoint &pt, const double x, const double y)
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxRealPoint a;
// TODO cppcheck-suppress unreadVariable
wxRealPoint b{};
Expand All @@ -213,7 +213,7 @@ void unreadVariable_wxRealPoint(const wxPoint &pt, const double x, const double

void unreadVariable_wxRect(const int x, const wxPoint &pt, const wxSize &sz)
{
// TODO cppcheck-suppress unusedVariable
// cppcheck-suppress unusedVariable
wxRect a;
// TODO cppcheck-suppress unreadVariable
wxRect b{};
Expand Down

0 comments on commit 421bcfc

Please sign in to comment.