Update LUFA core to be compatible with the AVR-GCC -Wswitch-default warning switch.
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 9 Sep 2012 14:00:03 +0000 (14:00 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 9 Sep 2012 14:00:03 +0000 (14:00 +0000)
BuildTests/ModuleTest/makefile.test
LUFA/Drivers/USB/Class/Common/HIDParser.c
LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c
LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h
LUFA/Drivers/USB/Core/DeviceStandardReq.c
LUFA/Drivers/USB/Core/UC3/Host_UC3.c
LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h
LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h
LUFA/Platform/XMEGA/ClockManagement.h

index c87aeda..1ea9173 100644 (file)
@@ -45,6 +45,7 @@ CC_FLAGS += -Wmissing-declarations
 CC_FLAGS += -Wmissing-field-initializers
 CC_FLAGS += -Wmissing-format-attribute
 CC_FLAGS += -Woverlength-strings
+CC_FLAGS += -Wswitch-default
 
 # Only enable rendundant declaration warnings for AVR8 target (FIXME)
 ifeq ($(ARCH), AVR8)
@@ -56,7 +57,6 @@ C_FLAGS += -Wmissing-parameter-type
 C_FLAGS += -Wnested-externs
 
 # Potential additional warnings to enable in the future (FIXME)
-#CC_FLAGS += -Wswitch-default
 #CC_FLAGS += -Wc++-compat
 #CC_FLAGS += -Wcast-qual
 #CC_FLAGS += -Wconversion
index 4447e8a..4b4667b 100644 (file)
@@ -53,7 +53,7 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
        while (ReportSize)
        {
                uint8_t  HIDReportItem  = *ReportData;
-               uint32_t ReportItemData = 0;
+               uint32_t ReportItemData;
 
                ReportData++;
                ReportSize--;
@@ -66,16 +66,22 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
                                ReportSize     -= 4;
                                ReportData     += 4;
                                break;
+
                        case HID_RI_DATA_BITS_16:
                                ReportItemData  = (((uint16_t)ReportData[1] << 8) | (ReportData[0]));
                                ReportSize     -= 2;
                                ReportData     += 2;
                                break;
+
                        case HID_RI_DATA_BITS_8:
                                ReportItemData  = ReportData[0];
                                ReportSize     -= 1;
                                ReportData     += 1;
                                break;
+
+                       default:
+                               ReportItemData  = 0;
+                               break;
                }
 
                switch (HIDReportItem & (HID_RI_TYPE_MASK | HID_RI_TAG_MASK))
@@ -269,6 +275,9 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
                                }
 
                                break;
+                       
+                       default:
+                               break;
                }
 
                if ((HIDReportItem & HID_RI_TYPE_MASK) == HID_RI_TYPE_MAIN)
index a1e0fd3..37486f1 100644 (file)
@@ -180,6 +180,9 @@ void USB_Host_ProcessNextHostState(void)
 
                        EVENT_USB_Host_DeviceEnumerationComplete();
                        break;
+
+               default:
+                       break;
        }
 
        if ((ErrorCode != HOST_ENUMERROR_NoError) && (USB_HostState != HOST_STATE_Unattached))
index a702247..cea8628 100644 (file)
                                                OTGIEN |= (1 << SRPE);
                                                break;
                                        #endif
+                                       default:
+                                               break;
                                }
                        }
 
                                                OTGIEN &= ~(1 << SRPE);
                                                break;
                                        #endif
+                                       default:
+                                               break;
                                }
                        }
 
                                                OTGINT &= ~(1 << SRPI);
                                                break;
                                        #endif
+                                       default:
+                                               break;
                                }
                        }
 
                                        case USB_INT_SRPI:
                                                return (OTGIEN & (1 << SRPE));
                                        #endif
+                                       default:
+                                               return false;
                                }
-
-                               return false;
                        }
 
                        static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
                                        case USB_INT_SRPI:
                                                return (OTGINT & (1 << SRPI));
                                        #endif
+                                       default:
+                                               return false;
                                }
-
-                               return false;
                        }
 
                /* Includes: */
index f5e1cca..c2c9e7d 100644 (file)
@@ -109,6 +109,9 @@ void USB_Device_ProcessControlRequest(void)
                                  USB_Device_SetConfiguration();
 
                                break;
+
+                       default:
+                               break;
                }
        }
 
index 932381a..172239c 100644 (file)
@@ -180,6 +180,9 @@ void USB_Host_ProcessNextHostState(void)
 
                        EVENT_USB_Host_DeviceEnumerationComplete();
                        break;
+                       
+               default:
+                       break;
        }
 
        if ((ErrorCode != HOST_ENUMERROR_NoError) && (USB_HostState != HOST_STATE_Unattached))
index 871a0ca..bcefa36 100644 (file)
                                                AVR32_USBB.USBCON.vberre      = true;
                                                break;
                                        #endif
+                                       default:
+                                               break;
                                }
                        }
 
                                                AVR32_USBB.USBCON.vberre      = false;
                                                break;
                                        #endif
+                                       default:
+                                               break;
                                }
                        }
 
                                                (void)AVR32_USBB.USBSTACLR;
                                                break;
                                        #endif
+                                       default:
+                                               break;
                                }
                        }
 
                                        case USB_INT_VBERRI:
                                                return AVR32_USBB.USBCON.vberre;
                                        #endif
+                                       default:
+                                               return false;
                                }
-
-                               return false;
                        }
 
                        static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
                                        case USB_INT_VBERRI:
                                                return AVR32_USBB.USBSTA.vberri;
                                        #endif
+                                       default:
+                                               return false;
                                }
-
-                               return false;
                        }
 
                /* Includes: */
index 6a07626..e917c8e 100644 (file)
                                {
                                        case USB_INT_BUSEVENTI:
                                                USB.INTCTRLA |= USB_BUSEVIE_bm;
-                                               return;
+                                               break;
                                        case USB_INT_SOFI:
                                                USB.INTCTRLA |= USB_SOFIE_bm;
-                                               return;
+                                               break;
+                                       default:
+                                               break;
                                }
                        }
 
                                {
                                        case USB_INT_BUSEVENTI:
                                                USB.INTCTRLA &= ~USB_BUSEVIE_bm;
-                                               return;
+                                               break;
                                        case USB_INT_SOFI:
                                                USB.INTCTRLA &= ~USB_SOFIE_bm;
-                                               return;
+                                               break;
+                                       default:
+                                               break;
                                }
                        }
 
                                {
                                        case USB_INT_BUSEVENTI_Suspend:
                                                USB.INTFLAGSACLR = USB_SUSPENDIF_bm;
-                                               return;
+                                               break;
                                        case USB_INT_BUSEVENTI_Resume:
                                                USB.INTFLAGSACLR = USB_RESUMEIF_bm;
-                                               return;
+                                               break;
                                        case USB_INT_BUSEVENTI_Reset:
                                                USB.INTFLAGSACLR = USB_RSTIF_bm;
-                                               return;
+                                               break;
                                        case USB_INT_SOFI:
                                                USB.INTFLAGSACLR = USB_SOFIF_bm;
-                                               return;
+                                               break;
+                                       default:
+                                               break;
                                }
                        }
 
                                                return ((USB.INTCTRLA & USB_BUSEVIE_bm) ? true : false);
                                        case USB_INT_SOFI:
                                                return ((USB.INTCTRLA & USB_SOFIE_bm) ? true : false);
+                                       default:
+                                               return false;
                                }
-
-                               return false;
                        }
 
                        static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
                                                return ((USB.INTFLAGSACLR & USB_RSTIF_bm) ? true : false);
                                        case USB_INT_SOFI:
                                                return ((USB.INTFLAGSACLR & USB_SOFIF_bm) ? true : false);
+                                       default:
+                                               return false;
                                }
-
-                               return false;
                        }
 
                /* Includes: */
index c824c89..971068f 100644 (file)
                                                OSC.CTRL |= OSC_RC32KEN_bm;
                                                while (!(OSC.STATUS & OSC_RC32KRDY_bm));
                                                return true;
+                                       default:
+                                               return false;
                                }
-
-                               return false;
                        }
 
                        /** Stops the given internal oscillator of the XMEGA microcontroller.
                                        case CLOCK_SRC_INT_RC32KHZ:
                                                OSC.CTRL &= ~OSC_RC32KEN_bm;
                                                return true;
+                                       default:
+                                               return false;
                                }
-
-                               return false;
                        }
 
                        /** Starts the PLL of the XMEGA microcontroller, with the given options. This routine blocks until the PLL is ready for use.