From 43018a48c4d7665d08f8e795829c438cf6115a63 Mon Sep 17 00:00:00 2001 From: daid303 Date: Mon, 12 Nov 2012 15:35:28 +0100 Subject: [PATCH] Fix for a few -Wextra warnings. --- Marlin/Marlin_main.cpp | 2 +- Marlin/Sd2Card.cpp | 18 +++++++++--------- Marlin/cardreader.cpp | 12 ++++++++---- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index bbd11298e2..1874ab562a 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1753,7 +1753,7 @@ void kill() SERIAL_ERRORLNPGM(MSG_ERR_KILLED); LCD_ALERTMESSAGEPGM(MSG_KILLED); suicide(); - while(1); // Wait for reset + while(1) { /* Intentionally left empty */ } // Wait for reset } void Stop() diff --git a/Marlin/Sd2Card.cpp b/Marlin/Sd2Card.cpp index eb38df6b72..72f5661d86 100644 --- a/Marlin/Sd2Card.cpp +++ b/Marlin/Sd2Card.cpp @@ -42,28 +42,28 @@ static void spiInit(uint8_t spiRate) { /** SPI receive a byte */ static uint8_t spiRec() { SPDR = 0XFF; - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ } return SPDR; } //------------------------------------------------------------------------------ /** SPI read data - only one call so force inline */ static inline __attribute__((always_inline)) - void spiRead(uint8_t* buf, uint16_t nbyte) { +void spiRead(uint8_t* buf, uint16_t nbyte) { if (nbyte-- == 0) return; SPDR = 0XFF; for (uint16_t i = 0; i < nbyte; i++) { - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ } buf[i] = SPDR; SPDR = 0XFF; } - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ } buf[nbyte] = SPDR; } //------------------------------------------------------------------------------ /** SPI send a byte */ static void spiSend(uint8_t b) { SPDR = b; - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ } } //------------------------------------------------------------------------------ /** SPI send block - only one call so force inline */ @@ -71,12 +71,12 @@ static inline __attribute__((always_inline)) void spiSendBlock(uint8_t token, const uint8_t* buf) { SPDR = token; for (uint16_t i = 0; i < 512; i += 2) { - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ } SPDR = buf[i]; - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ } SPDR = buf[i + 1]; } - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ } } //------------------------------------------------------------------------------ #else // SOFTWARE_SPI @@ -174,7 +174,7 @@ uint8_t Sd2Card::cardCommand(uint8_t cmd, uint32_t arg) { if (cmd == CMD12) spiRec(); // wait for response - for (uint8_t i = 0; ((status_ = spiRec()) & 0X80) && i != 0XFF; i++); + for (uint8_t i = 0; ((status_ = spiRec()) & 0X80) && i != 0XFF; i++) { /* Intentionally left empty */ } return status_; } //------------------------------------------------------------------------------ diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp index 47a3fd0509..bcabe8588f 100644 --- a/Marlin/cardreader.cpp +++ b/Marlin/cardreader.cpp @@ -245,8 +245,10 @@ void CardReader::openFile(char* name,bool read) SERIAL_PROTOCOLLNPGM("."); return; } - else - ;//SERIAL_ECHOLN("dive ok"); + else + { + //SERIAL_ECHOLN("dive ok"); + } curDir=&myDir; dirname_start=dirname_end+1; @@ -339,8 +341,10 @@ void CardReader::removeFile(char* name) SERIAL_PROTOCOLLNPGM("."); return; } - else - ;//SERIAL_ECHOLN("dive ok"); + else + { + //SERIAL_ECHOLN("dive ok"); + } curDir=&myDir; dirname_start=dirname_end+1;