Skip to content

Commit 82da5c7

Browse files
earlephilhowerdevyte
authored andcommitted
Fix minor warning w/Ubuntu18.04 in host test build (esp8266#5829)
GCC reports the following warning about ignoring the return value of write() (to the console/UART in this instance). common/MockUART.cpp: In function ‘void uart_do_write_char(int, char)’: common/MockUART.cpp:67:8: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] write(uart_nr + 1, &c, 1); ~~~~~^~~~~~~~~~~~~~~~~~~~ Add a simple warning printout to STDERR which may not be the same as the UART stream and could succeed.
1 parent 418857a commit 82da5c7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/host/common/MockUART.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ static void
6464
uart_do_write_char(const int uart_nr, char c)
6565
{
6666
if (uart_nr >= UART0 && uart_nr <= UART1)
67-
write(uart_nr + 1, &c, 1);
67+
if (1 != write(uart_nr + 1, &c, 1))
68+
fprintf(stderr, "Unable to write character to emulated UART stream: %d\n", c);
6869
}
6970

7071
// write a new byte into the RX FIFO buffer

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy