[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 40/52] net: Drop unusual use of do { } while (0);
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 40/52] net: Drop unusual use of do { } while (0); |
Date: |
Fri, 12 Jan 2018 12:31:04 +0100 |
From: Eric Blake <address@hidden>
For a couple of macros in pcnet.c, we have to provide a new scope
to avoid compiler warnings about declarations in the middle of a
switch statement that aren't in a sub-scope. But use of
'do { ... } while (0);' merely to provide that new scope is arcane
overkill, compared to just using '{ ... }'.
Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/net/pcnet.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
index 39d5d93..606b05c 100644
--- a/hw/net/pcnet.c
+++ b/hw/net/pcnet.c
@@ -456,32 +456,32 @@ static inline void pcnet_rmd_store(PCNetState *s, struct
pcnet_RMD *rmd,
#define CHECK_RMD(ADDR,RES) do { \
switch (BCR_SWSTYLE(s)) { \
case 0x00: \
- do { \
+ { \
uint16_t rda[4]; \
s->phys_mem_read(s->dma_opaque, (ADDR), \
(void *)&rda[0], sizeof(rda), 0); \
(RES) |= (rda[2] & 0xf000)!=0xf000; \
(RES) |= (rda[3] & 0xf000)!=0x0000; \
- } while (0); \
+ } \
break; \
case 0x01: \
case 0x02: \
- do { \
+ { \
uint32_t rda[4]; \
s->phys_mem_read(s->dma_opaque, (ADDR), \
(void *)&rda[0], sizeof(rda), 0); \
(RES) |= (rda[1] & 0x0000f000L)!=0x0000f000L; \
(RES) |= (rda[2] & 0x0000f000L)!=0x00000000L; \
- } while (0); \
+ } \
break; \
case 0x03: \
- do { \
+ { \
uint32_t rda[4]; \
s->phys_mem_read(s->dma_opaque, (ADDR), \
(void *)&rda[0], sizeof(rda), 0); \
(RES) |= (rda[0] & 0x0000f000L)!=0x00000000L; \
(RES) |= (rda[1] & 0x0000f000L)!=0x0000f000L; \
- } while (0); \
+ } \
break; \
} \
} while (0)
@@ -489,22 +489,22 @@ static inline void pcnet_rmd_store(PCNetState *s, struct
pcnet_RMD *rmd,
#define CHECK_TMD(ADDR,RES) do { \
switch (BCR_SWSTYLE(s)) { \
case 0x00: \
- do { \
+ { \
uint16_t xda[4]; \
s->phys_mem_read(s->dma_opaque, (ADDR), \
(void *)&xda[0], sizeof(xda), 0); \
(RES) |= (xda[2] & 0xf000)!=0xf000; \
- } while (0); \
+ } \
break; \
case 0x01: \
case 0x02: \
case 0x03: \
- do { \
+ { \
uint32_t xda[4]; \
s->phys_mem_read(s->dma_opaque, (ADDR), \
(void *)&xda[0], sizeof(xda), 0); \
(RES) |= (xda[1] & 0x0000f000L)!=0x0000f000L; \
- } while (0); \
+ } \
break; \
} \
} while (0)
--
1.8.3.1
- [Qemu-devel] [PULL 30/52] tests/boot-serial-test: Add support for the raspi2 machine, (continued)
- [Qemu-devel] [PULL 30/52] tests/boot-serial-test: Add support for the raspi2 machine, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 37/52] icount: fixed saving/restoring of icount warp timers, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 43/52] chardev: Clean up previous patch indentation, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 38/52] cpus: unify qemu_*_wait_io_event, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 39/52] irq: fix memory leak, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 41/52] mips: Tweak location of ';' in macros, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 42/52] chardev: Use goto/label instead of do/break/while(0), Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 44/52] tests: Avoid 'do/while(false); ' in vhost-user-bridge, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 46/52] checkpatch: Enforce proper do/while (0) style, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 45/52] maint: Fix macros with broken 'do/while(0); ' usage, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 40/52] net: Drop unusual use of do { } while (0);,
Paolo Bonzini <=
- [Qemu-devel] [PULL 48/52] find_ram_offset: Align ram_addr_t allocation on long boundaries, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 49/52] block/iscsi: fix initialization of iTask in iscsi_co_get_block_status, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 50/52] cpu: flush TB cache when loading VMState, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 52/52] scripts/analyse-locks-simpletrace.py: script to analyse lock times, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 51/52] util/qemu-thread-*: add qemu_lock, locked and unlock trace events, Paolo Bonzini, 2018/01/12
- [Qemu-devel] [PULL 47/52] find_ram_offset: Add comments and tracing, Paolo Bonzini, 2018/01/12