Page 1 of 1

gcc 7.1 has land

Posted: Fri May 05, 2017 10:26 am
by alex31
Hello,

gcc 7.1 is still a hot cake, but, thanks to freddie chopin, we can have a taste of it right now :
bleeding edge toolchain

Now, by default, gcc need programmer to inform the compiler that switch/case fallthrough are intentional, by a way or another
gcc7 changes

There is also some changes when using C++ where register keyword is now obsoleted, at least when using C++17 standard.

gcc7 won't be on launchpad before end of 2017, so, there is still some time left to made ChibiOS compatible with it.

Alexandre

Re: gcc 7.1 has land

Posted: Fri May 05, 2017 11:09 am
by Giovanni
hi,

You could give it a try, I don't think ChibiOS requires changes because of it.

Giovanni

Re: gcc 7.1 has land

Posted: Fri May 05, 2017 2:19 pm
by alex31
You could give it a try, I don't think ChibiOS requires changes because of it.


C projects compile out of the box with warnings due to fallthrough, and C++ projets compile too, unless when using C++17 standard.

Included a quickly done patch that permits to C projects to compile without warning, and C++17 projects to compile without errors.

Alexandre

Re: gcc 7.1 has land

Posted: Wed Dec 20, 2017 4:44 am
by twarge
Now that's it's on launchpad, lots of us will be seeing the fallthrough warnings. There are just a handful of them and they are easily suppressed using __attribute__((fallthrough));

Re: gcc 7.1 has land

Posted: Wed Dec 20, 2017 8:19 am
by Giovanni
The attribute cannot be used in portable code but there are other methods.

Giovanni

Re: gcc 7.1 has land

Posted: Fri Dec 22, 2017 4:44 am
by lungj
It seems like the bleeding-edge GCC 7.2 has some issues with the pre-processor and fall-through markers. Here is a patch for the [font=Courier New]wakeup[/font] function in [font=Courier New]chschd.c[/font] that makes it GCC 7.2-friendly:

Code: Select all

  case CH_STATE_SUSPENDED:
    *tp->u.wttrp = NULL;
    break;
#if CH_CFG_USE_SEMAPHORES == TRUE
  case CH_STATE_WTSEM:
    chSemFastSignalI(tp->u.wtsemp);
#endif
    /* Falls through. */
#if (CH_CFG_USE_CONDVARS == TRUE) && (CH_CFG_USE_CONDVARS_TIMEOUT == TRUE)
  case CH_STATE_WTCOND:
#endif
    /* Falls through. */
  case CH_STATE_QUEUED:


The falls-through comments seem to need to live in an odd place: outside of the [font=Courier New]#if[/font]-[font=Courier New]#endif[/font] block.

Re: gcc 7.1 has land

Posted: Fri Dec 22, 2017 11:28 am
by Giovanni
Moved outside, thanks.

Edit: Just tested, it still gives the warning, this is best fixed in GCC side but apparently they don't want to fix it: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77817

Giovanni

Re: gcc 7.1 has land

Posted: Fri Dec 22, 2017 12:06 pm
by Giovanni
I committed a workaround, swapping two case statements hides the GCC bug (which is still there of course).

GCC 7 q4 shows interesting improvements in all benchmarks and, apparently, there are no real problems.

Giovanni

Re: gcc 7.1 has land

Posted: Thu Feb 08, 2018 8:06 pm
by apmorton
Hi,

I am running into more of these fallthrough warnings on GCC 7.2.

I think it may be best to use the attributes to fix these for good.
In ChibiOS 17.1 this doesn't exist, but it looks like on trunk you have a file "ccportab.h" which could easily hide this in a compiler agnostic way.

Code: Select all

#define CC_FALLTHROUGH    __attribute__ ((fallthrough))


You can then replace any comments that mention fallthrough with

Code: Select all

CC_FALLTHROUGH;
(or put them there in addition if you prefer).

In the meanwhile, I am able to suppress the warnings using

Code: Select all

-Wimplicit-fallthrough=1

which although not ideal at least doesn't entirely disable the warning.

Details on the warning levels here: https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

Re: gcc 7.1 has land

Posted: Thu Feb 08, 2018 9:36 pm
by apmorton
quick proof of concept patch for stable_17.6.x branch. I defined CC_FALLTHROUGH in ch.h for lack of a better place to put it

Code: Select all

diff --git a/demos/AVR/RT-ARDUINOLEONARDO/usbcfg.c b/demos/AVR/RT-ARDUINOLEONARDO/usbcfg.c
index 3cb7b767e..cd45b0196 100644
--- a/demos/AVR/RT-ARDUINOLEONARDO/usbcfg.c
+++ b/demos/AVR/RT-ARDUINOLEONARDO/usbcfg.c
@@ -301,9 +301,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/demos/AVR/RT-PRO_MICRO/usbcfg.c b/demos/AVR/RT-PRO_MICRO/usbcfg.c
index 851c576c4..16d2e3036 100644
--- a/demos/AVR/RT-PRO_MICRO/usbcfg.c
+++ b/demos/AVR/RT-PRO_MICRO/usbcfg.c
@@ -300,9 +300,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/demos/AVR/RT-TEENSY2-USB/usbcfg.c b/demos/AVR/RT-TEENSY2-USB/usbcfg.c
index 979161ae5..783e7a6c9 100644
--- a/demos/AVR/RT-TEENSY2-USB/usbcfg.c
+++ b/demos/AVR/RT-TEENSY2-USB/usbcfg.c
@@ -266,9 +266,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/demos/STM32/RT-STM32F103_INEMO_DISCOVERY/usbcfg.c b/demos/STM32/RT-STM32F103_INEMO_DISCOVERY/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/demos/STM32/RT-STM32F103_INEMO_DISCOVERY/usbcfg.c
+++ b/demos/STM32/RT-STM32F103_INEMO_DISCOVERY/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/demos/STM32/RT-STM32F103-MAPLEMINI/usbcfg.c b/demos/STM32/RT-STM32F103-MAPLEMINI/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/demos/STM32/RT-STM32F103-MAPLEMINI/usbcfg.c
+++ b/demos/STM32/RT-STM32F103-MAPLEMINI/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/demos/STM32/RT-STM32F103-STM3210E_EVAL-FATFS-USB/usbcfg.c b/demos/STM32/RT-STM32F103-STM3210E_EVAL-FATFS-USB/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/demos/STM32/RT-STM32F103-STM3210E_EVAL-FATFS-USB/usbcfg.c
+++ b/demos/STM32/RT-STM32F103-STM3210E_EVAL-FATFS-USB/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/demos/STM32/RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB/usbcfg.c b/demos/STM32/RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/demos/STM32/RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB/usbcfg.c
+++ b/demos/STM32/RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c b/demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c
index 5121b03aa..41d688da2 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c
+++ b/demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.c b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.c
index bb05f43c8..e6cd5a863 100644
--- a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.c
+++ b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/os/hal/ports/AVR/hal_spi_lld.c b/os/hal/ports/AVR/hal_spi_lld.c
index a9bb13228..4bb08d9b8 100644
--- a/os/hal/ports/AVR/hal_spi_lld.c
+++ b/os/hal/ports/AVR/hal_spi_lld.c
@@ -136,7 +136,8 @@ void spi_lld_start(SPIDriver *spip) {
       case SPI_LSB_FIRST:
         SPCR |= (1 << DORD);
         break;
-      case SPI_MSB_FIRST: /* fallthrough */
+      case SPI_MSB_FIRST:
+        CC_FALLTHROUGH;
       default:
         SPCR &= ~(1 << DORD);
         break;
@@ -153,7 +154,8 @@ void spi_lld_start(SPIDriver *spip) {
       case SPI_MODE_3:
         SPCR |= ((1 << CPOL) | (1 << CPHA));
         break;
-      case SPI_MODE_0: /* fallthrough */
+      case SPI_MODE_0:
+        CC_FALLTHROUGH;
       default: break;
       }
 
@@ -180,7 +182,8 @@ void spi_lld_start(SPIDriver *spip) {
       case SPI_SCK_FOSC_128:
         SPCR |= ((1 << SPR1) | (1 << SPR0));
         break;
-      case SPI_SCK_FOSC_4: /* fallthrough */
+      case SPI_SCK_FOSC_4:
+        CC_FALLTHROUGH;
       default: break;
       }
 
diff --git a/os/hal/ports/STM32/LLD/TIMv1/hal_pwm_lld.c b/os/hal/ports/STM32/LLD/TIMv1/hal_pwm_lld.c
index 279170e16..13facc4f4 100644
--- a/os/hal/ports/STM32/LLD/TIMv1/hal_pwm_lld.c
+++ b/os/hal/ports/STM32/LLD/TIMv1/hal_pwm_lld.c
@@ -519,40 +519,40 @@ void pwm_lld_start(PWMDriver *pwmp) {
   switch (pwmp->config->channels[0].mode & PWM_OUTPUT_MASK) {
   case PWM_OUTPUT_ACTIVE_LOW:
     ccer |= STM32_TIM_CCER_CC1P;
-    /* Falls through.*/
+    CC_FALLTHROUGH;
   case PWM_OUTPUT_ACTIVE_HIGH:
     ccer |= STM32_TIM_CCER_CC1E;
-    /* Falls through.*/
+    CC_FALLTHROUGH;
   default:
     ;
   }
   switch (pwmp->config->channels[1].mode & PWM_OUTPUT_MASK) {
   case PWM_OUTPUT_ACTIVE_LOW:
     ccer |= STM32_TIM_CCER_CC2P;
-    /* Falls through.*/
+    CC_FALLTHROUGH;
   case PWM_OUTPUT_ACTIVE_HIGH:
     ccer |= STM32_TIM_CCER_CC2E;
-    /* Falls through.*/
+    CC_FALLTHROUGH;
   default:
     ;
   }
   switch (pwmp->config->channels[2].mode & PWM_OUTPUT_MASK) {
   case PWM_OUTPUT_ACTIVE_LOW:
     ccer |= STM32_TIM_CCER_CC3P;
-    /* Falls through.*/
+    CC_FALLTHROUGH;
   case PWM_OUTPUT_ACTIVE_HIGH:
     ccer |= STM32_TIM_CCER_CC3E;
-    /* Falls through.*/
+    CC_FALLTHROUGH;
   default:
     ;
   }
   switch (pwmp->config->channels[3].mode & PWM_OUTPUT_MASK) {
   case PWM_OUTPUT_ACTIVE_LOW:
     ccer |= STM32_TIM_CCER_CC4P;
-    /* Falls through.*/
+    CC_FALLTHROUGH;
   case PWM_OUTPUT_ACTIVE_HIGH:
     ccer |= STM32_TIM_CCER_CC4E;
-    /* Falls through.*/
+    CC_FALLTHROUGH;
   default:
     ;
   }
@@ -569,30 +569,30 @@ void pwm_lld_start(PWMDriver *pwmp) {
     switch (pwmp->config->channels[0].mode & PWM_COMPLEMENTARY_OUTPUT_MASK) {
     case PWM_COMPLEMENTARY_OUTPUT_ACTIVE_LOW:
       ccer |= STM32_TIM_CCER_CC1NP;
-      /* Falls through.*/
+      CC_FALLTHROUGH;
     case PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH:
       ccer |= STM32_TIM_CCER_CC1NE;
-      /* Falls through.*/
+      CC_FALLTHROUGH;
     default:
       ;
     }
     switch (pwmp->config->channels[1].mode & PWM_COMPLEMENTARY_OUTPUT_MASK) {
     case PWM_COMPLEMENTARY_OUTPUT_ACTIVE_LOW:
       ccer |= STM32_TIM_CCER_CC2NP;
-      /* Falls through.*/
+      CC_FALLTHROUGH;
     case PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH:
       ccer |= STM32_TIM_CCER_CC2NE;
-      /* Falls through.*/
+      CC_FALLTHROUGH;
     default:
       ;
     }
     switch (pwmp->config->channels[2].mode & PWM_COMPLEMENTARY_OUTPUT_MASK) {
     case PWM_COMPLEMENTARY_OUTPUT_ACTIVE_LOW:
       ccer |= STM32_TIM_CCER_CC3NP;
-      /* Falls through.*/
+      CC_FALLTHROUGH;
     case PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH:
       ccer |= STM32_TIM_CCER_CC3NE;
-      /* Falls through.*/
+      CC_FALLTHROUGH;
     default:
       ;
     }
diff --git a/os/hal/src/hal_usb.c b/os/hal/src/hal_usb.c
index 314473f89..a9ab95ca0 100644
--- a/os/hal/src/hal_usb.c
+++ b/os/hal/src/hal_usb.c
@@ -892,7 +892,7 @@ void _usb_ep0in(USBDriver *usbp, usbep_t ep) {
       usbp->ep0state = USB_EP0_IN_WAITING_TX0;
       return;
     }
-    /* Falls into, it is intentional.*/
+    CC_FALLTHROUGH;
   case USB_EP0_IN_WAITING_TX0:
     /* Transmit phase over, receiving the zero sized status packet.*/
     usbp->ep0state = USB_EP0_OUT_WAITING_STS;
@@ -916,7 +916,7 @@ void _usb_ep0in(USBDriver *usbp, usbep_t ep) {
   case USB_EP0_OUT_RX:
     /* All the above are invalid states in the IN phase.*/
     osalDbgAssert(false, "EP0 state machine error");
-    /* Falling through is intentional.*/
+    CC_FALLTHROUGH;
   case USB_EP0_ERROR:
     /* Error response, the state machine goes into an error state, the low
        level layer will have to reset it to USB_EP0_WAITING_SETUP after
@@ -975,7 +975,7 @@ void _usb_ep0out(USBDriver *usbp, usbep_t ep) {
   case USB_EP0_IN_SENDING_STS:
     /* All the above are invalid states in the IN phase.*/
     osalDbgAssert(false, "EP0 state machine error");
-    /* Falling through is intentional.*/
+    CC_FALLTHROUGH;
   case USB_EP0_ERROR:
     /* Error response, the state machine goes into an error state, the low
        level layer will have to reset it to USB_EP0_WAITING_SETUP after
diff --git a/os/rt/include/ch.h b/os/rt/include/ch.h
index 430612792..8b14b2283 100644
--- a/os/rt/include/ch.h
+++ b/os/rt/include/ch.h
@@ -66,6 +66,18 @@
 #define CH_KERNEL_PATCH         3
 /** @} */
 
+#if defined(__GNUC__) && __GNUC__ >= 7
+/**
+ * @brief   Annotate an explicit case statement fallthrough
+ */
+#define CC_FALLTHROUGH      __attribute__((fallthrough))
+#else
+/**
+ * @brief   Annotate an explicit case statement fallthrough
+ */
+#define CC_FALLTHROUGH
+#endif
+
 /* Core headers.*/
 #include "chtypes.h"
 #include "chconf.h"
diff --git a/os/rt/src/chschd.c b/os/rt/src/chschd.c
index 844c7c52b..813b60d42 100644
--- a/os/rt/src/chschd.c
+++ b/os/rt/src/chschd.c
@@ -332,11 +332,11 @@ static void wakeup(void *p) {
 #if CH_CFG_USE_SEMAPHORES == TRUE
   case CH_STATE_WTSEM:
     chSemFastSignalI(tp->u.wtsemp);
+    CC_FALLTHROUGH;
 #endif
-    /* Falls through.*/
   case CH_STATE_QUEUED:
-    /* Falls through.*/
 #if (CH_CFG_USE_CONDVARS == TRUE) && (CH_CFG_USE_CONDVARS_TIMEOUT == TRUE)
+    CC_FALLTHROUGH;
   case CH_STATE_WTCOND:
 #endif
     /* States requiring dequeuing.*/
diff --git a/testex/STM32/STM32F3xx/I2C-LSM303DLHC/usbcfg.c b/testex/STM32/STM32F3xx/I2C-LSM303DLHC/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/testex/STM32/STM32F3xx/I2C-LSM303DLHC/usbcfg.c
+++ b/testex/STM32/STM32F3xx/I2C-LSM303DLHC/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testex/STM32/STM32F3xx/SPI-L3GD20/usbcfg.c b/testex/STM32/STM32F3xx/SPI-L3GD20/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/testex/STM32/STM32F3xx/SPI-L3GD20/usbcfg.c
+++ b/testex/STM32/STM32F3xx/SPI-L3GD20/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testex/STM32/STM32F4xx/I2C-LSM303DLHC/usbcfg.c b/testex/STM32/STM32F4xx/I2C-LSM303DLHC/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/testex/STM32/STM32F4xx/I2C-LSM303DLHC/usbcfg.c
+++ b/testex/STM32/STM32F4xx/I2C-LSM303DLHC/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testex/STM32/STM32F4xx/SPI-L3GD20/usbcfg.c b/testex/STM32/STM32F4xx/SPI-L3GD20/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/testex/STM32/STM32F4xx/SPI-L3GD20/usbcfg.c
+++ b/testex/STM32/STM32F4xx/SPI-L3GD20/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testex/STM32/STM32F4xx/SPI-LIS3DSH/usbcfg.c b/testex/STM32/STM32F4xx/SPI-LIS3DSH/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/testex/STM32/STM32F4xx/SPI-LIS3DSH/usbcfg.c
+++ b/testex/STM32/STM32F4xx/SPI-LIS3DSH/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testex/STM32/STM32F4xx/SPI-LIS302DL/usbcfg.c b/testex/STM32/STM32F4xx/SPI-LIS302DL/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/testex/STM32/STM32F4xx/SPI-LIS302DL/usbcfg.c
+++ b/testex/STM32/STM32F4xx/SPI-LIS302DL/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testhal/STM32/STM32F0xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F0xx/USB_CDC/usbcfg.c
index 558334fb5..f5fed7f45 100644
--- a/testhal/STM32/STM32F0xx/USB_CDC/usbcfg.c
+++ b/testhal/STM32/STM32F0xx/USB_CDC/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testhal/STM32/STM32F1xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F1xx/USB_CDC/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/testhal/STM32/STM32F1xx/USB_CDC/usbcfg.c
+++ b/testhal/STM32/STM32F1xx/USB_CDC/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testhal/STM32/STM32F1xx/USB_CDC_F107/usbcfg.c b/testhal/STM32/STM32F1xx/USB_CDC_F107/usbcfg.c
index db05bbd8a..af01809e2 100755
--- a/testhal/STM32/STM32F1xx/USB_CDC_F107/usbcfg.c
+++ b/testhal/STM32/STM32F1xx/USB_CDC_F107/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testhal/STM32/STM32F2xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F2xx/USB_CDC/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/testhal/STM32/STM32F2xx/USB_CDC/usbcfg.c
+++ b/testhal/STM32/STM32F2xx/USB_CDC/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testhal/STM32/STM32F3xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F3xx/USB_CDC/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/testhal/STM32/STM32F3xx/USB_CDC/usbcfg.c
+++ b/testhal/STM32/STM32F3xx/USB_CDC/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testhal/STM32/STM32F3xx/USB_CDC_IAD/usbcfg.c b/testhal/STM32/STM32F3xx/USB_CDC_IAD/usbcfg.c
index 9559e1f43..4aa1b5b16 100644
--- a/testhal/STM32/STM32F3xx/USB_CDC_IAD/usbcfg.c
+++ b/testhal/STM32/STM32F3xx/USB_CDC_IAD/usbcfg.c
@@ -398,9 +398,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c
+++ b/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c b/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c
index d1249b305..6882bd509 100644
--- a/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c
+++ b/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c
@@ -398,9 +398,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testhal/STM32/STM32F7xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F7xx/USB_CDC/usbcfg.c
index bb05f43c8..e6cd5a863 100644
--- a/testhal/STM32/STM32F7xx/USB_CDC/usbcfg.c
+++ b/testhal/STM32/STM32F7xx/USB_CDC/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testhal/STM32/STM32F37x/USB_CDC/usbcfg.c b/testhal/STM32/STM32F37x/USB_CDC/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/testhal/STM32/STM32F37x/USB_CDC/usbcfg.c
+++ b/testhal/STM32/STM32F37x/USB_CDC/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();
 
diff --git a/testhal/STM32/STM32L4xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32L4xx/USB_CDC/usbcfg.c
index db05bbd8a..af01809e2 100644
--- a/testhal/STM32/STM32L4xx/USB_CDC/usbcfg.c
+++ b/testhal/STM32/STM32L4xx/USB_CDC/usbcfg.c
@@ -284,9 +284,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
     chSysUnlockFromISR();
     return;
   case USB_EVENT_RESET:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_UNCONFIGURED:
-    /* Falls into.*/
+    CC_FALLTHROUGH;
   case USB_EVENT_SUSPEND:
     chSysLockFromISR();