]> xenbits.xensource.com Git - seabios.git/commitdiff
hw/usb-xhci.c: Code refactoring to not override initializers in `speed_from_xhci...
authorPaul Menzel <paulepanter@users.sourceforge.net>
Thu, 3 Oct 2013 09:55:48 +0000 (11:55 +0200)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 26 Oct 2013 14:15:04 +0000 (10:15 -0400)
Using Debian clang version 3.4-1 (trunk) (based on LLVM 3.4) to build
SeaBIOS, the switch `-Winitializer-overrides` results in the following
warnings.

        $ CC=clang make
        […]
          Compile checking out/src/hw/usb-xhci.o
        clang: warning: argument unused during compilation: '-mpreferred-stack-boundary=2'
        clang: warning: argument unused during compilation: '-minline-all-stringops'
        clang: warning: argument unused during compilation: '-fno-delete-null-pointer-checks'
        src/hw/usb-xhci.c:281:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
            [ 1 ] = USB_FULLSPEED,
                    ^~~~~~~~~~~~~
        src/hw/usb.h:68:24: note: expanded from macro 'USB_FULLSPEED'
                               ^
        src/hw/usb-xhci.c:280:20: note: previous initialization is here
            [ 0 ... 15 ] = -1,
                           ^~
        src/hw/usb-xhci.c:282:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
            [ 2 ] = USB_LOWSPEED,
                    ^~~~~~~~~~~~
        src/hw/usb.h:69:24: note: expanded from macro 'USB_LOWSPEED'
                               ^
        src/hw/usb-xhci.c:280:20: note: previous initialization is here
            [ 0 ... 15 ] = -1,
                           ^~
        src/hw/usb-xhci.c:283:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
            [ 3 ] = USB_HIGHSPEED,
                    ^~~~~~~~~~~~~
        src/hw/usb.h:70:24: note: expanded from macro 'USB_HIGHSPEED'
                               ^
        src/hw/usb-xhci.c:280:20: note: previous initialization is here
            [ 0 ... 15 ] = -1,
                           ^~
        src/hw/usb-xhci.c:284:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
            [ 4 ] = USB_SUPERSPEED,
                    ^~~~~~~~~~~~~~
        src/hw/usb.h:71:24: note: expanded from macro 'USB_SUPERSPEED'
                               ^
        src/hw/usb-xhci.c:280:20: note: previous initialization is here
            [ 0 ... 15 ] = -1,
                           ^~

Refactor the code a little to get rid of the warnings.

Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
src/hw/usb-xhci.c

index 83eddc947b04317e06df132103af6ef454773d52..66ce3c47353efc8f49d41e83ed06c052e4239755 100644 (file)
@@ -277,11 +277,12 @@ static const char *speed_name[16] = {
 };
 
 static const int speed_from_xhci[16] = {
-    [ 0 ... 15 ] = -1,
+    [ 0 ] = -1,
     [ 1 ] = USB_FULLSPEED,
     [ 2 ] = USB_LOWSPEED,
     [ 3 ] = USB_HIGHSPEED,
     [ 4 ] = USB_SUPERSPEED,
+    [ 5 ... 15 ] = -1,
 };
 
 static const int speed_to_xhci[] = {