Fix compiler warnings (-Wlogical-op)

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
This commit is contained in:
Ferry Huberts 2023-08-15 20:51:44 +02:00
parent 78f2232012
commit f6f2d27b85
2 changed files with 27 additions and 3 deletions

View File

@ -160,7 +160,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
#add_compiler_flags(5.1 "-Wsuggest-final-types")
add_compiler_flags(6.1 "-Wduplicated-cond")
#add_compiler_flags(6.1 "-Wlogical-op")
add_compiler_flags(6.1 "-Wlogical-op")
add_compiler_flags(6.1 "-Wnull-dereference")
add_compiler_flags(7.1 "-Wduplicated-branches")

View File

@ -115,7 +115,19 @@ v_io_size Connection::write(const void *buff, v_buff_size count, async::Action&
if(result < 0) {
auto e = errno;
if(e == EAGAIN || e == EWOULDBLOCK){
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlogical-op"
#endif
bool retry = ((e == EAGAIN) || (e == EWOULDBLOCK));
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
if(retry){
if(m_mode == data::stream::ASYNCHRONOUS) {
action = oatpp::async::Action::createIOWaitAction(m_handle, oatpp::async::Action::IOEventType::IO_EVENT_WRITE);
}
@ -173,7 +185,19 @@ v_io_size Connection::read(void *buff, v_buff_size count, async::Action& action)
if(result < 0) {
auto e = errno;
if(e == EAGAIN || e == EWOULDBLOCK){
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlogical-op"
#endif
bool retry = ((e == EAGAIN) || (e == EWOULDBLOCK));
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
if(retry){
if(m_mode == data::stream::ASYNCHRONOUS) {
action = oatpp::async::Action::createIOWaitAction(m_handle, oatpp::async::Action::IOEventType::IO_EVENT_READ);
}