diff options
author | Jonathan White <support@dmapps.us> | 2021-06-09 05:55:53 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2021-06-10 23:48:18 +0300 |
commit | 9e2399adf4f797d3e76e794b6815de79f26c2bb6 (patch) | |
tree | 2ebcdfeb9009abdd141fec5477d14bd602d0e3f1 | |
parent | c661fa331fa5686a7f3c595233953cc2d5870c24 (diff) |
Resolve compiler warnings for unused return values
* Fixes #1932 - See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425#c29
Adding a negation before the function call allows the (void) syntax to work properly.
-rw-r--r-- | src/gui/Application.cpp | 4 | ||||
-rw-r--r-- | tests/TestKeys.cpp | 2 | ||||
-rw-r--r-- | tests/gui/TestGui.cpp | 13 | ||||
-rw-r--r-- | tests/gui/TestGui.h | 2 |
4 files changed, 7 insertions, 14 deletions
diff --git a/src/gui/Application.cpp b/src/gui/Application.cpp index 973e29032..273b662ec 100644 --- a/src/gui/Application.cpp +++ b/src/gui/Application.cpp @@ -235,7 +235,7 @@ void Application::handleUnixSignal(int sig) case SIGINT: case SIGTERM: { char buf = 0; - Q_UNUSED(::write(unixSignalSocket[0], &buf, sizeof(buf))); + Q_UNUSED(!::write(unixSignalSocket[0], &buf, sizeof(buf))); return; } case SIGHUP: @@ -247,7 +247,7 @@ void Application::quitBySignal() { m_unixSignalNotifier->setEnabled(false); char buf; - Q_UNUSED(::read(unixSignalSocket[1], &buf, sizeof(buf))); + Q_UNUSED(!::read(unixSignalSocket[1], &buf, sizeof(buf))); emit quitSignalReceived(); } #endif diff --git a/tests/TestKeys.cpp b/tests/TestKeys.cpp index cbbaae398..9fa75f795 100644 --- a/tests/TestKeys.cpp +++ b/tests/TestKeys.cpp @@ -235,7 +235,7 @@ void TestKeys::benchmarkTransformKey() QBENCHMARK { - Q_UNUSED(compositeKey->transform(kdf, result)); + Q_UNUSED(!compositeKey->transform(kdf, result)); }; } diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index 65ca319bc..0de8be359 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -853,7 +853,7 @@ void TestGui::testTotp() void TestGui::testSearch() { // Add canned entries for consistent testing - Q_UNUSED(addCannedEntries()); + addCannedEntries(); auto* toolBar = m_mainWindow->findChild<QToolBar*>("toolBar"); @@ -1007,7 +1007,7 @@ void TestGui::testSearch() void TestGui::testDeleteEntry() { // Add canned entries for consistent testing - Q_UNUSED(addCannedEntries()); + addCannedEntries(); auto* groupView = m_dbWidget->findChild<GroupView*>("groupView"); auto* entryView = m_dbWidget->findChild<EntryView*>("entryView"); @@ -1673,10 +1673,8 @@ void TestGui::testAutoType() entryView->selectionModel()->clearSelection(); } -int TestGui::addCannedEntries() +void TestGui::addCannedEntries() { - int entries_added = 0; - // Find buttons auto* toolBar = m_mainWindow->findChild<QToolBar*>("toolBar"); QWidget* entryNewWidget = toolBar->widgetForAction(m_mainWindow->findChild<QAction*>("actionEntryNew")); @@ -1689,22 +1687,17 @@ int TestGui::addCannedEntries() QTest::keyClicks(titleEdit, "test"); auto* editEntryWidgetButtonBox = editEntryWidget->findChild<QDialogButtonBox*>("buttonBox"); QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton); - ++entries_added; // Add entry "something 2" QTest::mouseClick(entryNewWidget, Qt::LeftButton); QTest::keyClicks(titleEdit, "something 2"); QTest::keyClicks(passwordEdit, "something 2"); QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton); - ++entries_added; // Add entry "something 3" QTest::mouseClick(entryNewWidget, Qt::LeftButton); QTest::keyClicks(titleEdit, "something 3"); QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton); - ++entries_added; - - return entries_added; } void TestGui::checkDatabase(QString dbFileName) diff --git a/tests/gui/TestGui.h b/tests/gui/TestGui.h index 5bfc04265..b41e22227 100644 --- a/tests/gui/TestGui.h +++ b/tests/gui/TestGui.h @@ -72,7 +72,7 @@ private slots: void testTrayRestoreHide(); private: - int addCannedEntries(); + void addCannedEntries(); void checkDatabase(QString dbFileName = ""); void triggerAction(const QString& name); void dragAndDropGroup(const QModelIndex& sourceIndex, |