Eliminate complier warning and remove superfluous call to empty()

Appears when complied with -O3 optimization level

Compile: UARTSerial.cpp
../drivers/UARTSerial.cpp: In member function 'void mbed::UARTSerial::tx_irq()':
../drivers/UARTSerial.cpp:314:31: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized]
         SerialBase::_base_putc(data);
pull/6611/head
Paul Thompson 2018-04-16 07:23:47 -07:00
parent a463b075db
commit d6c5f16fd3
1 changed files with 2 additions and 3 deletions

View File

@ -305,12 +305,11 @@ void UARTSerial::rx_irq(void)
void UARTSerial::tx_irq(void) void UARTSerial::tx_irq(void)
{ {
bool was_full = _txbuf.full(); bool was_full = _txbuf.full();
char data;
/* Write to the peripheral if there is something to write /* Write to the peripheral if there is something to write
* and if the peripheral is available to write. */ * and if the peripheral is available to write. */
while (!_txbuf.empty() && SerialBase::writeable()) { while (SerialBase::writeable() && _txbuf.pop(data)) {
char data;
_txbuf.pop(data);
SerialBase::_base_putc(data); SerialBase::_base_putc(data);
} }