Message ID | 1369390765-32117-1-git-send-email-sw@weilnetz.de |
---|---|
State | Accepted |
Headers | show |
Am 24.05.2013 12:19, schrieb Stefan Weil: > Fix these warnings from cppcheck: > > hw/display/cirrus_vga.c:2603: > hw/sd/sd.c:348: > hw/timer/exynos4210_mct.c:1033: > target-arm/translate.c:9886: > target-s390x/mem_helper.c:518: > target-unicore32/translate.c:1936: > style: Consecutive return, break, continue, goto or throw statements are unnecessary. > > Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Andreas Färber <afaerber@suse.de> Also removes a tab while at it. :) Thanks, Andreas
On Fri, May 24, 2013 at 12:19:25PM +0200, Stefan Weil wrote: > Fix these warnings from cppcheck: > > hw/display/cirrus_vga.c:2603: > hw/sd/sd.c:348: > hw/timer/exynos4210_mct.c:1033: > target-arm/translate.c:9886: > target-s390x/mem_helper.c:518: > target-unicore32/translate.c:1936: > style: Consecutive return, break, continue, goto or throw statements are unnecessary. I'm not sure what cppcheck does, but I spotted an unnecessary break statement in the watchdog code a few days ago: http://git.qemu.org/?p=qemu.git;a=blob;f=hw/watchdog/watchdog.c;h=cb4e1f9e479f934532fcd4d07528feccba812b79;hb=HEAD#l131 (line 131) So it's obviously not finding them all :-( Rich.
Am 24.05.2013 14:33, schrieb Richard W.M. Jones: > On Fri, May 24, 2013 at 12:19:25PM +0200, Stefan Weil wrote: >> Fix these warnings from cppcheck: >> >> hw/display/cirrus_vga.c:2603: >> hw/sd/sd.c:348: >> hw/timer/exynos4210_mct.c:1033: >> target-arm/translate.c:9886: >> target-s390x/mem_helper.c:518: >> target-unicore32/translate.c:1936: >> style: Consecutive return, break, continue, goto or throw statements are unnecessary. > I'm not sure what cppcheck does, but I spotted an unnecessary break > statement in the watchdog code a few days ago: > > http://git.qemu.org/?p=qemu.git;a=blob;f=hw/watchdog/watchdog.c;h=cb4e1f9e479f934532fcd4d07528feccba812b79;hb=HEAD#l131 > (line 131) > > So it's obviously not finding them all :-( > > Rich. Yes, cppcheck knows functions with attribute noreturn, but does not check for statements after such functions. That's a missing feature (or a bug). Stefan
24.05.2013 14:19, Stefan Weil wrote:
> Fix these warnings from cppcheck:
Thanks, applied to the trivial patches tree.
/mjt
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c index 64bfe2b..a5dbc39 100644 --- a/hw/display/cirrus_vga.c +++ b/hw/display/cirrus_vga.c @@ -2600,7 +2600,6 @@ static void cirrus_vga_ioport_write(void *opaque, hwaddr addr, uint64_t val, #endif cirrus_vga_write_sr(c, val); break; - break; case 0x3c6: cirrus_write_hidden_dac(c, val); break; diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index 87ce75b..38dcc1a 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -1030,7 +1030,6 @@ static uint64_t exynos4210_mct_read(void *opaque, hwaddr offset, case G_INT_ENB: value = s->g_timer.reg.int_enb; break; - break; case G_WSTAT: value = s->g_timer.reg.wstat; break; diff --git a/target-arm/translate.c b/target-arm/translate.c index a1b7b8c..053d2f2 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -9883,7 +9883,6 @@ static inline void gen_intermediate_code_internal(CPUARMState *env, invalidate this TB. */ dc->pc += 2; goto done_generating; - break; } } } diff --git a/target-s390x/mem_helper.c b/target-s390x/mem_helper.c index 02bc432..1422ae9 100644 --- a/target-s390x/mem_helper.c +++ b/target-s390x/mem_helper.c @@ -515,7 +515,6 @@ uint32_t HELPER(ex)(CPUS390XState *env, uint32_t cc, uint64_t v1, break; default: goto abort; - break; } } else if ((insn & 0xff00) == 0x0a00) { /* supervisor call */ diff --git a/target-unicore32/translate.c b/target-unicore32/translate.c index 151e35e..3dc7856 100644 --- a/target-unicore32/translate.c +++ b/target-unicore32/translate.c @@ -1933,7 +1933,6 @@ static inline void gen_intermediate_code_internal(CPUUniCore32State *env, invalidate this TB. */ dc->pc += 2; /* FIXME */ goto done_generating; - break; } } }
Fix these warnings from cppcheck: hw/display/cirrus_vga.c:2603: hw/sd/sd.c:348: hw/timer/exynos4210_mct.c:1033: target-arm/translate.c:9886: target-s390x/mem_helper.c:518: target-unicore32/translate.c:1936: style: Consecutive return, break, continue, goto or throw statements are unnecessary. Signed-off-by: Stefan Weil <sw@weilnetz.de> --- hw/display/cirrus_vga.c | 1 - hw/timer/exynos4210_mct.c | 1 - target-arm/translate.c | 1 - target-s390x/mem_helper.c | 1 - target-unicore32/translate.c | 1 - 5 files changed, 5 deletions(-)