From be1274d5179ecccaaee3d181df1b13ddd8ee088e Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 15 Jun 2026 22:20:39 -0700 Subject: [PATCH] Avoid some -Wcomma warnings --- src/common/time.cpp | 16 ++++++++++++---- tests/archive/archivetest.cpp | 3 ++- tests/controls/gridtest.cpp | 2 +- tests/test.cpp | 12 ++++++------ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/common/time.cpp b/src/common/time.cpp index a91f31e810..b12cde9559 100644 --- a/src/common/time.cpp +++ b/src/common/time.cpp @@ -157,16 +157,24 @@ int wxGetTimeZone() // We must initialize the time zone information before using it. It's not a // problem if we do it twice due to a race condition, as it's idempotent // anyhow, so don't bother with any locks here. - static bool s_tzSet = (_tzset(), true); - wxUnusedVar(s_tzSet); + static bool s_tzSet; + if (!s_tzSet) + { + _tzset(); + s_tzSet = true; + } long t; _get_timezone(&t); return t; #else // Use some kind of time zone variable. // In any case we must initialize the time zone before using it. - static bool s_tzSet = (tzset(), true); - wxUnusedVar(s_tzSet); + static bool s_tzSet; + if (!s_tzSet) + { + tzset(); + s_tzSet = true; + } #if defined(WX_TIMEZONE) // If WX_TIMEZONE was defined by configure, use it. return WX_TIMEZONE; diff --git a/tests/archive/archivetest.cpp b/tests/archive/archivetest.cpp index d984aa8743..067774a886 100644 --- a/tests/archive/archivetest.cpp +++ b/tests/archive/archivetest.cpp @@ -771,7 +771,8 @@ void ArchiveTestCase::ExtractArchive(wxInputStream& in) if ((m_options & PipeIn) == 0) OnArchiveExtracted(*arc, expectedTotal); - while (entry = EntryPtr(arc->GetNextEntry()), entry.get() != nullptr) { + while ((entry = EntryPtr(arc->GetNextEntry())).get()) + { wxString name = entry->GetName(wxPATH_UNIX); // provide some context for the error message so that we know which diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index 5adc90d27d..e28c6f55cf 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -2199,7 +2199,7 @@ TEST_CASE_METHOD(GridTestCase, int row, col, rows, cols; // Check main cell. - row = multi.row, + row = multi.row; col = multi.col; wxGrid::CellSpan span = m_grid->GetCellSize(row, col, &rows, &cols); diff --git a/tests/test.cpp b/tests/test.cpp index 398dfbb2c7..3c00bc184a 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -463,13 +463,13 @@ static bool DoCheckConnection() wxSocketClient sock; sock.SetTimeout(10); // 10 secs - bool online = sock.Connect(addr) && - (sock.Write(HTTP_GET, strlen(HTTP_GET)), sock.WaitForRead(1)); - - return online; -#else - return false; + if (sock.Connect(addr)) + { + sock.Write(HTTP_GET, strlen(HTTP_GET)); + return sock.WaitForRead(1); + } #endif + return false; } extern bool IsNetworkAvailable()