Patch: Remove warning when USB_RESET_HOOK is not defined

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
Vegar
Posts: 1
Joined: Sun Aug 22, 2010 10:03 pm

Patch: Remove warning when USB_RESET_HOOK is not defined

Post by Vegar » Sun Aug 22, 2010 10:32 pm

When USB_RESET_HOOK is not defined, gcc warns about an unused parameter in usbHandleResetHook:
usbdrv/usbdrv.c: In function ‘usbHandleResetHook’:
usbdrv/usbdrv.c:550: warning: unused parameter ‘notResetState’


This prevents me from using -Werror in my makefile (-Werror makes gcc treat warnings as errors, which I find very convenient).

The following two patches add __attribute__((unused)) to the notResetState parameter when USB_RESET_HOOK is undefined. There are two patches because I couldn't decide which way looks cleanest (they both have the same result), but I'm leaning towards reset2.diff

http://vegar.beplacid.net/~vegar/files/reset.diff
http://vegar.beplacid.net/~vegar/files/reset2.diff

Apply with 'patch -p0 < reset.diff' in the directory that contains the usbdrv/ directory.

I'm posting it here because I'm not sure where patches should be posted, and perhaps others can use this too.

Post Reply