From e7b7e004f417d40e46ad505b67ab8b3869b9ea75 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sat, 28 Sep 2013 01:45:19 +0200 Subject: [PATCH] Silence a false positive warning. --- serial.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/serial.c b/serial.c index 15c675e..4bce2bf 100644 --- a/serial.c +++ b/serial.c @@ -105,6 +105,8 @@ void serial_init() /// receive interrupt /// /// we have received a character, stuff it in the rx buffer if we can, or drop it if we can't +// Using the pragma inside the function is incompatible with Arduinos' gcc. +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" #ifdef USART_RX_vect ISR(USART_RX_vect) #else @@ -117,9 +119,12 @@ ISR(USART0_RX_vect) if (buf_canwrite(rx)) buf_push(rx, UDR0); else { + // Not reading the character makes the interrupt logic to swamp us with + // retries, so better read it and throw it away. + // #pragma GCC diagnostic ignored "-Wunused-but-set-variable" uint8_t trash; + // #pragma GCC diagnostic pop - // not reading the character makes the interrupt logic to swamp us with retries, so better read it and throw it away trash = UDR0; } @@ -137,6 +142,7 @@ ISR(USART0_RX_vect) MEMORY_BARRIER(); SREG = sreg_save; } +#pragma GCC diagnostic pop /// transmit buffer ready interrupt ///