Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: [ARM] gcc 4.6

Re: [ARM] gcc 4.6

From: Amaury Pouly <amaury.pouly_at_gmail.com>
Date: Mon, 20 Sep 2010 00:30:24 +0200

>
> firmware/libc/sprintf.c: In function ‘snprintf’:
> firmware/libc/sprintf.c:60:11: warning: variable ‘ok’ set but not used
> [-Wunused-but-set-variable]
> firmware/libc/sprintf.c: In function ‘vsnprintf’:
> firmware/libc/sprintf.c:80:11: warning: variable ‘ok’ set but not used
> [-Wunused-but-set-variable]
>
 firmware/common/format.c: In function ‘fdprintf’:
> firmware/common/format.c:247:11: warning: variable ‘ok’ set but not used
> [-Wunused-but-set-variable]
>
These ok arise because of code of the form:
[...]
bool ok = format(push_fn, &state_struct, ...)
[...]
return state_struct.bytes

That is, the functions returns the number of written bytes and but store
intermediate status in ok.
Strictly speaking, if ok is false, the function should return a negative
number. However, always returning the number of written bytes seems ok to me
and in this case, we should just ignore the return value of the format.
Given that anyway, nobody ever check the return value of {f,fd}printf
functions.

> firmware/usbstack/usb_core.c: In function
> ‘request_handler_device_get_descriptor’:
> firmware/usbstack/usb_core.c:554:11: warning: variable ‘handled’ set but
> not used [-Wunused-but-set-variable]
>
Currently the code does a pretty bad thing: it doesn't always stall on
unhandled request which explains that handled is set (but not in a
consistent way) but never used in a few functions. I already knew this
"problem" and perhaps it's the one time to fix it.
Received on 2010-09-20


Page was last modified "Jan 10 2012" The Rockbox Crew
aaa