From d8af276be32af24f2797ba121d958cfd7156c1d4 Mon Sep 17 00:00:00 2001 From: Dan White Date: Sun, 1 Feb 2015 13:27:55 -0600 Subject: [PATCH] Workaround unused-but-set-variable warning. The UART status register must be read to clear the flags and enable operation. Previously, it was read into a dummy variable which triggered the warning. Attempts to suppress the warning didn't work for some reason, but the statement "UART0_SR;" is sufficient to emit assembly to read the register. I don't trust this to always work, so there is a comment with the purpose of the line. --- msp4th/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/msp4th/main.c b/msp4th/main.c index e14e849..c389cbd 100644 --- a/msp4th/main.c +++ b/msp4th/main.c @@ -89,7 +89,6 @@ static void __inline__ eint(void){ static __inline__ void init_uart(void) { - int16_t tmp; // chip setup for UART0 use PAPER = 0x0030; PAOUT = 0x0000; @@ -99,7 +98,9 @@ static __inline__ void init_uart(void) UART0_CR = UARTEn; // a read clears the register -- ready for TX/RX - tmp = UART0_SR; + // NOTE: make sure the ASM actually reads this register + // and isn't "optimized" out. So far, no problems... + UART0_SR; } -- 2.25.1