From 97f31a68795e1d492f98a9942cce5228cbe64cf8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 17 Jun 2024 06:34:03 +0200 Subject: [PATCH] tst_QProcess: silence -Wunused-result We can't do anything about a failed write at these code locations. In particular, we can't QVERIFY() their success, so suppress the warning with the idiomatic cast to void. Amends 13a1995e9dc987d1560b38d16b76442261b4aa8d, bd32c7d7055b436b8c33486a5b5ce1c29db77fd4 and c5221f6be00c16187e0abf008b33c230fea56c29. Pick-to: 6.8 6.7 Change-Id: Ia7ef57f01eeb8608079a12724c0b4f03a59081c9 Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 5f357329798..316c388bc86 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -1715,7 +1715,7 @@ void tst_QProcess::raiseInChildProcessModifier() sa.sa_flags = SA_RESETHAND; sa.sa_handler = [](int) { static const char msg[] = "SIGUSR1 handler was run"; - write(STDERR_FILENO, msg, strlen(msg)); + (void)write(STDERR_FILENO, msg, strlen(msg)); raise(SIGUSR1); // re-raise }; sigaction(SIGUSR1, &sa, nullptr); @@ -1897,8 +1897,8 @@ void tst_QProcess::unixProcessParametersAndChildModifier() process.setChildProcessModifier([=, &vforkControl] { const char *pgidmsg = "PGID mismatch. "; if (getpgrp() != oldpgid) - write(pipes[1], pgidmsg, strlen(pgidmsg)); - write(pipes[1], message, strlen(message)); + (void)write(pipes[1], pgidmsg, strlen(pgidmsg)); + (void)write(pipes[1], message, strlen(message)); vforkControl.storeRelaxed(1); }); auto flags = QProcess::UnixProcessFlag::CloseFileDescriptors |