From 7d45117571a9dffbe7eb6c66849f6b0f21c44a5f Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 23 Jan 2023 11:38:55 +0100 Subject: [PATCH] Cast away [[nodiscard]] values in runtime support checks Test calls in Q{SystemSemaphore,SharedMemory}*::runtimeSupportCheck() are commented to be sure to fail, so the return is irrelevant. Suppresses warnings from CodeChecker. Change-Id: I2ac6ccb8d96a169229dcf24a744015fb9d414c74 Reviewed-by: Marc Mutz --- src/corelib/ipc/qsharedmemory_posix.cpp | 2 +- src/corelib/ipc/qsharedmemory_systemv.cpp | 2 +- src/corelib/ipc/qsystemsemaphore_systemv.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/ipc/qsharedmemory_posix.cpp b/src/corelib/ipc/qsharedmemory_posix.cpp index c2c0bff07bf..313b34a5946 100644 --- a/src/corelib/ipc/qsharedmemory_posix.cpp +++ b/src/corelib/ipc/qsharedmemory_posix.cpp @@ -27,7 +27,7 @@ using namespace QtIpcCommon; bool QSharedMemoryPosix::runtimeSupportCheck() { static const bool result = []() { - shm_open("", 0, 0); // this WILL fail + (void)shm_open("", 0, 0); // this WILL fail return errno != ENOSYS; }(); return result; diff --git a/src/corelib/ipc/qsharedmemory_systemv.cpp b/src/corelib/ipc/qsharedmemory_systemv.cpp index 385ffdd5975..18bcc708de0 100644 --- a/src/corelib/ipc/qsharedmemory_systemv.cpp +++ b/src/corelib/ipc/qsharedmemory_systemv.cpp @@ -36,7 +36,7 @@ bool QSharedMemorySystemV::runtimeSupportCheck() return false; #endif static const bool result = []() { - shmget(IPC_PRIVATE, ~size_t(0), 0); // this will fail + (void)shmget(IPC_PRIVATE, ~size_t(0), 0); // this will fail return errno != ENOSYS; }(); return result; diff --git a/src/corelib/ipc/qsystemsemaphore_systemv.cpp b/src/corelib/ipc/qsystemsemaphore_systemv.cpp index 3d73a622623..cdfa6adfd48 100644 --- a/src/corelib/ipc/qsystemsemaphore_systemv.cpp +++ b/src/corelib/ipc/qsystemsemaphore_systemv.cpp @@ -40,7 +40,7 @@ bool QSystemSemaphoreSystemV::runtimeSupportCheck() return false; #endif static const bool result = []() { - semget(IPC_PRIVATE, -1, 0); // this will fail + (void)semget(IPC_PRIVATE, -1, 0); // this will fail return errno != ENOSYS; }(); return result;