From 92401d8ebb7f8db6b2236feeda8f273ac8371a33 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Wed, 18 Dec 2019 12:43:13 -0600 Subject: [PATCH] Fix unused return result hack to work on macOS/GCC 7.4+ As of GCC 7.4 (at least under macOS 10.10), the previous workaround of casting a must-use result to `(void)` to avoid warnings about unused code no longer works. This workaround is uglier but it quiets these warnings. --- src/topic_monitor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/topic_monitor.cpp b/src/topic_monitor.cpp index 7f5327735..57763ae7a 100644 --- a/src/topic_monitor.cpp +++ b/src/topic_monitor.cpp @@ -154,7 +154,8 @@ generation_list_t topic_monitor_t::await_gens(const generation_list_t &input_gen (void)select(fd + 1, &fds, nullptr, nullptr, nullptr /* timeout */); #endif uint8_t ignored[PIPE_BUF]; - (void)read(fd, ignored, sizeof ignored); + auto unused = read(fd, ignored, sizeof ignored); + if (unused) {} // We are finished reading. We must stop being the reader, and post on the condition // variable to wake up any other threads waiting for us to finish reading.