From 9fa114c2bf426f9802286327bb70832587a976b7 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Sat, 27 Jan 2018 16:40:34 +1100 Subject: [PATCH] Avoid (eg.) "logical 'or' of equal expressions" warnings with GCC 7. --- src/Platform/Linux/System/TcpConnection.cpp | 6 ++++++ src/Platform/Linux/System/Timer.cpp | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/Platform/Linux/System/TcpConnection.cpp b/src/Platform/Linux/System/TcpConnection.cpp index 6831179c76..b243a2ffa4 100755 --- a/src/Platform/Linux/System/TcpConnection.cpp +++ b/src/Platform/Linux/System/TcpConnection.cpp @@ -81,7 +81,10 @@ size_t TcpConnection::read(uint8_t* data, size_t size) { std::string message; ssize_t transferred = ::recv(connection, (void *)data, size, 0); if (transferred == -1) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlogical-op" if (errno != EAGAIN && errno != EWOULDBLOCK) { +#pragma GCC diagnostic pop message = "recv failed, " + lastErrorMessage(); } else { epoll_event connectionEvent; @@ -177,7 +180,10 @@ std::size_t TcpConnection::write(const uint8_t* data, size_t size) { ssize_t transferred = ::send(connection, (void *)data, size, MSG_NOSIGNAL); if (transferred == -1) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlogical-op" if (errno != EAGAIN && errno != EWOULDBLOCK) { +#pragma GCC diagnostic pop message = "send failed, " + lastErrorMessage(); } else { epoll_event connectionEvent; diff --git a/src/Platform/Linux/System/Timer.cpp b/src/Platform/Linux/System/Timer.cpp index 37278401e0..b2daa346a7 100755 --- a/src/Platform/Linux/System/Timer.cpp +++ b/src/Platform/Linux/System/Timer.cpp @@ -102,7 +102,10 @@ void Timer::sleep(std::chrono::nanoseconds duration) { if (!timerContext->interrupted) { uint64_t value = 0; if(::read(timer, &value, sizeof value) == -1 ){ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlogical-op" if(errno == EAGAIN || errno == EWOULDBLOCK) { +#pragma GCC diagnostic pop timerContext->interrupted = true; dispatcher->pushContext(timerContext->context); } else {