Is there a gcc warning that we could enable to catch these sort of problems?
Certainly it's something that any lint tool worth it's salt would catch. foo() { int retval = ERROR_OK; { /* can't we make GCC complain here?? */ int retval = ERROR_FAIL; } return retval; } -- Øyvind Harboe US toll free 1-866-980-3434 / International +47 51 63 25 00 http://www.zylin.com/zy1000.html ARM7 ARM9 ARM11 XScale Cortex JTAG debugger and flash programmer
From aa2de47d3ce4d484c124f0449702f511aab49112 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?=C3=98yvind=20Harboe?= <oyvind.har...@zylin.com> Date: Mon, 14 Jun 2010 09:30:37 +0200 Subject: [PATCH] target: fix retval gaffe in mwX commands MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit failure to write to memory was not propagated. This is an interesting case of broken error handling: with exceptions we wouldn't have had this at all, and I also wonder if there is a GCC option to warn about these kinds of potential bugs. Signed-off-by: Øyvind Harboe <oyvind.har...@zylin.com> --- src/target/target.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/target/target.c b/src/target/target.c index 01d9441..435d7b6 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2378,7 +2378,7 @@ static int target_fill_mem(struct target *target, { current = chunk_size; } - int retval = fn(target, address + x * data_size, data_size, current, target_buf); + retval = fn(target, address + x * data_size, data_size, current, target_buf); if (retval != ERROR_OK) { break; -- 1.6.3.3
_______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development