Skip to contentSkip to conversation

Remove wrong semicolon in macro definition

PATCH Applied Stefan Weil 2 participants 2 messages Sep 13, 2010 – Sep 14, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove wrong semicolon in macro definition

Macros normally should not end with a semicolon,
otherwise their usage results in two statements
where only one statement was expected.

---
 hw/serial.c             |    4 ++--
 tests/cris/check_swap.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
hw/serial.c +2 -2
index 49431b2..f09ce0a 100644
@@ -101,10 +101,10 @@
 
 #ifdef DEBUG_SERIAL
 #define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0);
+do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0)
 #else
 #define DPRINTF(fmt, ...) \
-do {} while(0);
+do {} while (0)
 #endif
 
 typedef struct SerialFIFO {
tests/cris/check_swap.c +1 -1
index 743cfc5..824a685 100644
@@ -41,7 +41,7 @@ do {                                                    \
         cris_tst_mov_cc(n, z);                          \
 	if (r != expected)                              \
 		err();                                  \
-} while(0);
+} while(0)
 
 void check_swap(void)
 {
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 3 lines · Stefan Weil

Macros normally should not end with a semicolon,
otherwise their usage results in two statements
where only one statement was expected.

Applied

Quoted 41 lines
---
 hw/serial.c             |    4 ++--
 tests/cris/check_swap.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
hw/serial.c +2 -2
index 49431b2..f09ce0a 100644
@@ -101,10 +101,10 @@
 
 #ifdef DEBUG_SERIAL
 #define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0);
+do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0)
 #else
 #define DPRINTF(fmt, ...) \
-do {} while(0);
+do {} while (0)
 #endif
 
 typedef struct SerialFIFO {
tests/cris/check_swap.c +1 -1
index 743cfc5..824a685 100644
@@ -41,7 +41,7 @@ do {                                                    \
         cris_tst_mov_cc(n, z);                          \
 	if (r != expected)                              \
 		err();                                  \
-} while(0);
+} while(0)
 
 void check_swap(void)
 {
Signature · 1 line
1.7.0.4