From 9fb8b4af8158d8b560ca8f4010469b0fbaf10520 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 1 Jun 2022 11:09:54 -0700 Subject: Fix GCC 12 warning about use of uninitialized value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit False positive, it couldn't be. `ok` could only become true if var.toInt() was called, which means some value was assigned to `value`. But anyway, we can simplify this because QVariant::toInt() returns 0 when it sets ok to false. classviewutils.cpp:78:50: warning: ‘value’ may be used uninitialized [-Wmaybe-uninitialized] 78 | return SymbolInformation(name, type, iconType); | ^ Change-Id: Iba16e8ea451b444ab213fffd16f4918c45228f2c Reviewed-by: Christian Stenger --- src/plugins/classview/classviewutils.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/plugins/classview/classviewutils.cpp') diff --git a/src/plugins/classview/classviewutils.cpp b/src/plugins/classview/classviewutils.cpp index cebea9a6f2..a8d1249d76 100644 --- a/src/plugins/classview/classviewutils.cpp +++ b/src/plugins/classview/classviewutils.cpp @@ -65,15 +65,7 @@ SymbolInformation symbolInformationFromItem(const QStandardItem *item) const QString &name = item->data(Constants::SymbolNameRole).toString(); const QString &type = item->data(Constants::SymbolTypeRole).toString(); - int iconType = 0; - - QVariant var = item->data(Constants::IconTypeRole); - bool ok = false; - int value; - if (var.isValid()) - value = var.toInt(&ok); - if (ok) - iconType = value; + int iconType = item->data(Constants::IconTypeRole).toInt(); return SymbolInformation(name, type, iconType); } -- cgit v1.2.1