Replace Q_UNUSED with [[maybe_unused]] attribute

PR #19471.
This commit is contained in:
Victor Chernyakin
2023-08-17 21:09:40 -07:00
committed by GitHub
parent f3f4610ba4
commit 34d30ed031
20 changed files with 31 additions and 75 deletions

View File

@@ -2541,9 +2541,8 @@ void SessionImpl::handleTorrentSaveResumeDataRequested(const TorrentImpl *torren
++m_numResumeData;
}
void SessionImpl::handleTorrentSaveResumeDataFailed(const TorrentImpl *torrent)
void SessionImpl::handleTorrentSaveResumeDataFailed([[maybe_unused]] const TorrentImpl *torrent)
{
Q_UNUSED(torrent);
--m_numResumeData;
}

View File

@@ -1866,10 +1866,8 @@ void TorrentImpl::handleMoveStorageJobFinished(const Path &path, const MoveStora
}
}
void TorrentImpl::handleTorrentCheckedAlert(const lt::torrent_checked_alert *p)
void TorrentImpl::handleTorrentCheckedAlert([[maybe_unused]] const lt::torrent_checked_alert *p)
{
Q_UNUSED(p);
if (!hasMetadata())
{
// The torrent is checked due to metadata received, but we should not process
@@ -1911,10 +1909,8 @@ void TorrentImpl::handleTorrentCheckedAlert(const lt::torrent_checked_alert *p)
});
}
void TorrentImpl::handleTorrentFinishedAlert(const lt::torrent_finished_alert *p)
void TorrentImpl::handleTorrentFinishedAlert([[maybe_unused]] const lt::torrent_finished_alert *p)
{
Q_UNUSED(p);
m_hasMissingFiles = false;
if (m_hasFinishedStatus)
return;
@@ -1943,14 +1939,12 @@ void TorrentImpl::handleTorrentFinishedAlert(const lt::torrent_finished_alert *p
});
}
void TorrentImpl::handleTorrentPausedAlert(const lt::torrent_paused_alert *p)
void TorrentImpl::handleTorrentPausedAlert([[maybe_unused]] const lt::torrent_paused_alert *p)
{
Q_UNUSED(p);
}
void TorrentImpl::handleTorrentResumedAlert(const lt::torrent_resumed_alert *p)
void TorrentImpl::handleTorrentResumedAlert([[maybe_unused]] const lt::torrent_resumed_alert *p)
{
Q_UNUSED(p);
}
void TorrentImpl::handleSaveResumeDataAlert(const lt::save_resume_data_alert *p)
@@ -2165,9 +2159,8 @@ void TorrentImpl::handleFilePrioAlert(const lt::file_prio_alert *)
}
#endif
void TorrentImpl::handleMetadataReceivedAlert(const lt::metadata_received_alert *p)
void TorrentImpl::handleMetadataReceivedAlert([[maybe_unused]] const lt::metadata_received_alert *p)
{
Q_UNUSED(p);
qDebug("Metadata received for torrent %s.", qUtf8Printable(name()));
#ifdef QBT_USES_LIBTORRENT2

View File

@@ -462,13 +462,10 @@ bool GeoIPDatabase::readDataFieldDescriptor(quint32 &offset, DataFieldDescriptor
return true;
}
void GeoIPDatabase::fromBigEndian(uchar *buf, const quint32 len) const
void GeoIPDatabase::fromBigEndian([[maybe_unused]] uchar *buf, [[maybe_unused]] const quint32 len) const
{
#if (Q_BYTE_ORDER == Q_LITTLE_ENDIAN)
std::reverse(buf, buf + len);
#else
Q_UNUSED(buf);
Q_UNUSED(len);
#endif
}

View File

@@ -612,8 +612,7 @@ void AutoDownloader::setProcessingEnabled(const bool enabled)
}
}
void AutoDownloader::timerEvent(QTimerEvent *event)
void AutoDownloader::timerEvent([[maybe_unused]] QTimerEvent *event)
{
Q_UNUSED(event);
store();
}

View File

@@ -560,8 +560,7 @@ void Feed::cleanup()
Utils::Fs::removeFile(m_iconPath);
}
void Feed::timerEvent(QTimerEvent *event)
void Feed::timerEvent([[maybe_unused]] QTimerEvent *event)
{
Q_UNUSED(event);
store();
}

View File

@@ -111,7 +111,7 @@ namespace
}
}
void Utils::Misc::shutdownComputer(const ShutdownDialogAction &action)
void Utils::Misc::shutdownComputer([[maybe_unused]] const ShutdownDialogAction &action)
{
#if defined(Q_OS_WIN)
HANDLE hToken; // handle to process token
@@ -247,9 +247,6 @@ void Utils::Misc::shutdownComputer(const ShutdownDialogAction &action)
QDBusConnection::systemBus());
halIface.call(u"Shutdown"_s);
}
#else
Q_UNUSED(action);
#endif
}