From 4d183637d00bff49b46cc1fc2d7fa771affb2a1b Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 4 May 2024 22:53:05 +0200 Subject: [PATCH] cleanup: remove unnecessary Q_UNUSED macros Also remove the UNUSED() macro, as there were no users left. The macro was silly anyway - there were many falso positives. Signed-off-by: Berthold Stoeger --- core/android.cpp | 12 ++++-------- core/downloadfromdcthread.cpp | 3 +-- core/ssrf.h | 3 --- desktop-widgets/tab-widgets/TabDiveInformation.cpp | 6 ++---- mobile-widgets/qmlmanager.cpp | 3 +-- 5 files changed, 8 insertions(+), 19 deletions(-) diff --git a/core/android.cpp b/core/android.cpp index 3a305dff6..6b4fecd13 100644 --- a/core/android.cpp +++ b/core/android.cpp @@ -156,12 +156,10 @@ int get_usb_fd(uint16_t idVendor, uint16_t idProduct) } JNIEXPORT void JNICALL -Java_org_subsurfacedivelog_mobile_SubsurfaceMobileActivity_setUsbDevice(JNIEnv *env, - jobject obj, +Java_org_subsurfacedivelog_mobile_SubsurfaceMobileActivity_setUsbDevice(JNIEnv *, + jobject, jobject javaUsbDevice) { - Q_UNUSED (obj) - Q_UNUSED (env) QAndroidJniObject usbDevice(javaUsbDevice); if (usbDevice.isValid()) { android_usb_serial_device_descriptor descriptor = getDescriptor(usbDevice); @@ -175,12 +173,10 @@ Java_org_subsurfacedivelog_mobile_SubsurfaceMobileActivity_setUsbDevice(JNIEnv * } JNIEXPORT void JNICALL -Java_org_subsurfacedivelog_mobile_SubsurfaceMobileActivity_restartDownload(JNIEnv *env, - jobject obj, +Java_org_subsurfacedivelog_mobile_SubsurfaceMobileActivity_restartDownload(JNIEnv *, + jobject, jobject javaUsbDevice) { - Q_UNUSED (obj) - Q_UNUSED (env) QAndroidJniObject usbDevice(javaUsbDevice); if (usbDevice.isValid()) { android_usb_serial_device_descriptor descriptor = getDescriptor(usbDevice); diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index 4072a0fb3..3e6929e15 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -233,9 +233,8 @@ QStringList DCDeviceData::getProductListFromVendor(const QString &vendor) return productList[vendor]; } -int DCDeviceData::getMatchingAddress(const QString &vendor, const QString &product) +int DCDeviceData::getMatchingAddress(const QString &, const QString &product) { - Q_UNUSED(vendor) return connectionListModel.indexOf(product); } diff --git a/core/ssrf.h b/core/ssrf.h index feed74a52..0397f572d 100644 --- a/core/ssrf.h +++ b/core/ssrf.h @@ -7,7 +7,4 @@ #pragma clang diagnostic ignored "-Wmissing-field-initializers" #endif -// Macro to be used for silencing unused parameters -#define UNUSED(x) (void)x - #endif // SSRF_H diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp index 5a7835358..19eac7a89 100644 --- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp +++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp @@ -259,9 +259,8 @@ void TabDiveInformation::updateUi(QString titleColor) } // From the index of the water type combo box, set the dive->salinity to an appropriate value -void TabDiveInformation::on_waterTypeCombo_activated(int index) +void TabDiveInformation::on_waterTypeCombo_activated(int) { - Q_UNUSED(index) int combobox_salinity = 0; int dc_salinity = parent.currentDive->salinity; switch(ui->waterTypeCombo->currentIndex()) { @@ -410,9 +409,8 @@ void TabDiveInformation::on_watertemp_editingFinished() divesEdited(Command::editWaterTemp(parseTemperatureToMkelvin(ui->watertemp->text()), false)); } -void TabDiveInformation::on_atmPressType_currentIndexChanged(int index) +void TabDiveInformation::on_atmPressType_currentIndexChanged(int) { - Q_UNUSED(index) updateTextBox(COMBO_CHANGED); } diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 2ee40c62d..7ca829ec2 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -2331,9 +2331,8 @@ void QMLManager::rememberOldStatus() setOldStatus((qPrefCloudStorage::cloud_status)qPrefCloudStorage::cloud_verification_status()); } -void QMLManager::divesChanged(const QVector &dives, DiveField field) +void QMLManager::divesChanged(const QVector &dives, DiveField) { - Q_UNUSED(field) for (struct dive *d: dives) { report_info("dive #%d changed, cache is %s", d->number, dive_cache_is_valid(d) ? "valid" : "invalidated"); // a brute force way to deal with that would of course be to call