foss-for-synopsys-dwc-arc-processors/openocd

Compile errors in arc_dbg.c

jurobystricky opened this issue · 2 comments

I get these warnings (treated as errors):

arc_dbg.c: In function 'arc_dbg_remove_breakpoint':
| arc_dbg.c:749:6: error: variable 'retval' set but not used [-Werror=unused-but-set-variable]
| int retval = ERROR_OK;
| ^
| arc_dbg.c: In function 'arc_dbg_add_watchpoint':
| arc_dbg.c:765:6: error: variable 'retval' set but not used [-Werror=unused-but-set-variable]
| int retval = ERROR_OK;
| ^
| arc_dbg.c: In function 'arc_dbg_remove_watchpoint':
| arc_dbg.c:780:6: error: variable 'retval' set but not used [-Werror=unused-but-set-variable]
| int retval = ERROR_OK;
| ^

It is very easy to fix, but not quite clear if the idea is to ignore some retval values, ie. the original code, for example:

   int arc_dbg_add_watchpoint(struct target *target,
struct watchpoint *watchpoint)
    .....
retval = arc_dbg_set_watchpoint(target, watchpoint);
return ERROR_OK;

I believe it should it become:

retval = arc_dbg_set_watchpoint(target, watchpoint);
return retval;

I think it is a mistake - retval shouldn't be ignored. I've pushed a fix in 90a4ff5. I didn't had this build problem, because my default compiler is GCC 4.4, which doesn't report this warning, unlike, say, GCC 4.8 and later.

Thanks!

That was fast, thanks.