diff --git a/src/conio/x_events.c b/src/conio/x_events.c index 71d69ae57bb635d55849a387adc86ebd6d9533ce..75e11644ea407e53bede9e980f8321100acf39e1 100644 --- a/src/conio/x_events.c +++ b/src/conio/x_events.c @@ -1665,17 +1665,17 @@ handle_bios_key(uint32_t *bios_key, bool *bios_key_parsing, bool *zero_first) if (ch == 0) x11.XBell(dpy, 100); else { - write(key_pipe[1], &ch, 1); + IGNORE_RESULT(write(key_pipe[1], &ch, 1)); if (ch == 0xe0) - write(key_pipe[1], &ch, 1); + IGNORE_RESULT(write(key_pipe[1], &ch, 1)); } } else { // Codepage character ch = *bios_key; - write(key_pipe[1], &ch, 1); + IGNORE_RESULT(write(key_pipe[1], &ch, 1)); if (ch == 0xe0) - write(key_pipe[1], &ch, 1); + IGNORE_RESULT(write(key_pipe[1], &ch, 1)); } } *bios_key = 0; @@ -1701,11 +1701,7 @@ x11_event(XEvent *ev) case ClientMessage: if (ev->xclient.format == 32 && ev->xclient.data.l[0] == A(WM_DELETE_WINDOW) && A(WM_DELETE_WINDOW) != None) { uint16_t key=CIO_KEY_QUIT; - // Bow to GCC - if (write(key_pipe[1], &key, 2) == EXIT_FAILURE) - return; - else - return; + IGNORE_RESULT(write(key_pipe[1], &key, 2)); } else if(ev->xclient.format == 32 && ev->xclient.data.l[0] == A(_NET_WM_PING) && A(_NET_WM_PING) != None) { ev->xclient.window = root; @@ -2078,14 +2074,10 @@ x11_event(XEvent *ev) else ch = cpchar_from_unicode_cpoint(getcodepage(), wbuf[i], 0); if (ch) { - // Bow to GCC if (ch == 0xe0) // Double-up 0xe0 - if (write(key_pipe[1], &ch, 1) == -1) - return; - if (write(key_pipe[1], &ch, 1) == EXIT_SUCCESS) - return; - else - return; + IGNORE_RESULT(write(key_pipe[1], &ch, 1)); + IGNORE_RESULT(write(key_pipe[1], &ch, 1)); + return; } } break; @@ -2296,13 +2288,9 @@ x11_event(XEvent *ev) uint16_t key=scan; if (key < 128) key = cpchar_from_unicode_cpoint(getcodepage(), key, key); - // Bow to GCC if (key == 0xe0) key = CIO_KEY_LITERAL_E0; - if (write(key_pipe[1], &key, (scan & 0xff) ? 1 : 2) != EXIT_SUCCESS) - return; - else - return; + IGNORE_RESULT(write(key_pipe[1], &key, (scan & 0xff) ? 1 : 2)); } break; } diff --git a/src/syncterm/telnets.c b/src/syncterm/telnets.c index 0e0f4e89c472581cb5722e688d581fa18aaab087..8e74b307060d871752781e1d8dd3aa267c844f5a 100644 --- a/src/syncterm/telnets.c +++ b/src/syncterm/telnets.c @@ -41,7 +41,7 @@ telnets_input_thread(void *args) if (!socket_readable(telnets_sock, 100)) continue; pthread_mutex_lock(&telnets_mutex); - cryptFlushData(telnets_session); + IGNORE_RESULT(cryptFlushData(telnets_session)); status = cryptPopData(telnets_session, conn_api.rd_buf, conn_api.rd_buf_size, &rd); pthread_mutex_unlock(&telnets_mutex); // Handle case where there was socket activity without readable data (ie: rekey) @@ -101,7 +101,7 @@ telnets_output_thread(void *args) } if (sent) { pthread_mutex_lock(&telnets_mutex); - cryptFlushData(telnets_session); + IGNORE_RESULT(cryptFlushData(telnets_session)); pthread_mutex_unlock(&telnets_mutex); } } diff --git a/src/xpdev/genwrap.h b/src/xpdev/genwrap.h index d8dd96cfe951aa41165fe70a5f1c0f4770f8fa0b..57ba788198a6f69a5993c7909b0cd2b356c1f374 100644 --- a/src/xpdev/genwrap.h +++ b/src/xpdev/genwrap.h @@ -48,6 +48,18 @@ #endif #endif +#if defined(REALLY_GCC) + #define IGNORE_RESULT(x) do { \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wunused-result\"") \ + (void)x; \ + _Pragma("GCC diagnostic pop") \ + } while(0) + +#else + #define IGNORE_RESULT(x) ((void)(x)) +#endif + #if !defined(_WIN32) /* Simple Win32 function equivalents */ #define GetCurrentProcessId() getpid()