bsps/*: Correct implicit fallthrough warnings

Use RTEMS_FALL_THROUGH() to annotate case statements which
intentionally do not have a break statement.
This commit is contained in:
Joel Sherrill
2025-09-18 12:14:09 -05:00
committed by Gedare Bloom
parent 106363b29d
commit e45ebbc5c1
9 changed files with 42 additions and 0 deletions

View File

@@ -45,6 +45,9 @@
#include <bsp/hwlib.h> #include <bsp/hwlib.h>
#include <bsp/alt_clock_manager.h> #include <bsp/alt_clock_manager.h>
#include <bsp/alt_mpu_registers.h> #include <bsp/alt_mpu_registers.h>
#ifdef __rtems__
#include <rtems/score/basedefs.h>
#endif /* __rtems__ */
#define UINT12_MAX (4096) #define UINT12_MAX (4096)
@@ -4693,6 +4696,9 @@ ALT_STATUS_CODE alt_clk_freq_get(ALT_CLK_t clk, alt_freq_t* freq)
case ALT_CLK_NAND: case ALT_CLK_NAND:
denom = 4; denom = 4;
// the absence of a break statement here is not a mistake // the absence of a break statement here is not a mistake
#ifdef __rtems__
RTEMS_FALL_THROUGH();
#endif /* __rtems__ */
case ALT_CLK_NAND_X: case ALT_CLK_NAND_X:
temp = ALT_CLKMGR_PERPLL_SRC_NAND_GET(alt_read_word(ALT_CLKMGR_PERPLL_SRC_ADDR)); temp = ALT_CLKMGR_PERPLL_SRC_NAND_GET(alt_read_word(ALT_CLKMGR_PERPLL_SRC_ADDR));
if (temp == ALT_CLKMGR_PERPLL_SRC_NAND_E_F2S_PERIPH_REF_CLK) if (temp == ALT_CLKMGR_PERPLL_SRC_NAND_E_F2S_PERIPH_REF_CLK)

View File

@@ -46,6 +46,9 @@
#define _INSIDE_MONLIB #define _INSIDE_MONLIB
#include <umon/monlib.h> #include <umon/monlib.h>
#ifdef __rtems__
#include <rtems/score/basedefs.h>
#endif /* __rtems__ */
static int (*_tfsseek)(int,int,int); static int (*_tfsseek)(int,int,int);
static int (*_tfsgetline)(int,char *,int); static int (*_tfsgetline)(int,char *,int);
static int (*_tfsipmod)(char *,char *,int,int); static int (*_tfsipmod)(char *,char *,int,int);
@@ -386,6 +389,9 @@ monUnlock(void)
break; break;
case 2: case 2:
ignorelock--; ignorelock--;
#ifdef __rtems__
RTEMS_FALL_THROUGH();
#endif
default: default:
_monunlock(); _monunlock();
break; break;

View File

@@ -1023,7 +1023,9 @@ handle_exception (int exceptionVector)
break; break;
case '2': case '2':
reg = 1; reg = 1;
RTEMS_FALL_THROUGH();
case '3': case '3':
RTEMS_FALL_THROUGH();
case '4': case '4':
default: default:
reg = 3; reg = 3;

View File

@@ -137,6 +137,7 @@ _IBMPC_scankey(char *outChar)
case 0x2a: case 0x2a:
if (extended) if (extended)
return false; return false;
RTEMS_FALL_THROUGH();
case 0x36: case 0x36:
shift_pressed = 1; shift_pressed = 1;
return false; return false;
@@ -144,6 +145,7 @@ _IBMPC_scankey(char *outChar)
case 0xaa: case 0xaa:
if (extended) if (extended)
return false; return false;
RTEMS_FALL_THROUGH();
case 0xb6: case 0xb6:
shift_pressed = 0; shift_pressed = 0;
return false; return false;

View File

@@ -134,6 +134,7 @@ printk("config data is %p\n", BSP_pci_configuration.pci_config_data);
case 0x20: case 0x20:
return (rval = GT_64260_B); return (rval = GT_64260_B);
} }
RTEMS_FALL_THROUGH();
default: default:
if ( assertion ) { if ( assertion ) {

View File

@@ -176,18 +176,25 @@ static void mpc5200_mscan_interrupt_handler(rtems_irq_hdl_param handle)
switch (m->txdlr) { switch (m->txdlr) {
case 8: case 8:
m->txdsr7 = tx_mess_ptr->mess_data[7]; m->txdsr7 = tx_mess_ptr->mess_data[7];
RTEMS_FALL_THROUGH();
case 7: case 7:
m->txdsr6 = tx_mess_ptr->mess_data[6]; m->txdsr6 = tx_mess_ptr->mess_data[6];
RTEMS_FALL_THROUGH();
case 6: case 6:
m->txdsr5 = tx_mess_ptr->mess_data[5]; m->txdsr5 = tx_mess_ptr->mess_data[5];
RTEMS_FALL_THROUGH();
case 5: case 5:
m->txdsr4 = tx_mess_ptr->mess_data[4]; m->txdsr4 = tx_mess_ptr->mess_data[4];
RTEMS_FALL_THROUGH();
case 4: case 4:
m->txdsr3 = tx_mess_ptr->mess_data[3]; m->txdsr3 = tx_mess_ptr->mess_data[3];
RTEMS_FALL_THROUGH();
case 3: case 3:
m->txdsr2 = tx_mess_ptr->mess_data[2]; m->txdsr2 = tx_mess_ptr->mess_data[2];
RTEMS_FALL_THROUGH();
case 2: case 2:
m->txdsr1 = tx_mess_ptr->mess_data[1]; m->txdsr1 = tx_mess_ptr->mess_data[1];
RTEMS_FALL_THROUGH();
case 1: case 1:
m->txdsr0 = tx_mess_ptr->mess_data[0]; m->txdsr0 = tx_mess_ptr->mess_data[0];
break; break;
@@ -278,20 +285,28 @@ static void mpc5200_mscan_interrupt_handler(rtems_irq_hdl_param handle)
switch (rx_mess_ptr->mess_len) { switch (rx_mess_ptr->mess_len) {
case 8: case 8:
rx_mess_ptr->mess_data[7] = m->rxdsr7; rx_mess_ptr->mess_data[7] = m->rxdsr7;
RTEMS_FALL_THROUGH();
case 7: case 7:
rx_mess_ptr->mess_data[6] = m->rxdsr6; rx_mess_ptr->mess_data[6] = m->rxdsr6;
RTEMS_FALL_THROUGH();
case 6: case 6:
rx_mess_ptr->mess_data[5] = m->rxdsr5; rx_mess_ptr->mess_data[5] = m->rxdsr5;
RTEMS_FALL_THROUGH();
case 5: case 5:
rx_mess_ptr->mess_data[4] = m->rxdsr4; rx_mess_ptr->mess_data[4] = m->rxdsr4;
RTEMS_FALL_THROUGH();
case 4: case 4:
rx_mess_ptr->mess_data[3] = m->rxdsr3; rx_mess_ptr->mess_data[3] = m->rxdsr3;
RTEMS_FALL_THROUGH();
case 3: case 3:
rx_mess_ptr->mess_data[2] = m->rxdsr2; rx_mess_ptr->mess_data[2] = m->rxdsr2;
RTEMS_FALL_THROUGH();
case 2: case 2:
rx_mess_ptr->mess_data[1] = m->rxdsr1; rx_mess_ptr->mess_data[1] = m->rxdsr1;
RTEMS_FALL_THROUGH();
case 1: case 1:
rx_mess_ptr->mess_data[0] = m->rxdsr0; rx_mess_ptr->mess_data[0] = m->rxdsr0;
RTEMS_FALL_THROUGH();
case 0: case 0:
default: default:
break; break;
@@ -1161,6 +1176,7 @@ rtems_device_driver mscan_control(rtems_device_major_number major,
break; break;
} }
RTEMS_FALL_THROUGH();
/* set tx buffer ID */ /* set tx buffer ID */
case MSCAN_SET_TX_ID: case MSCAN_SET_TX_ID:

View File

@@ -169,6 +169,7 @@ ppc_cpu_id_t get_ppc_cpu_type(void)
case PPC_7455: case PPC_7455:
case PPC_7457: case PPC_7457:
current_ppc_features.has_8_bats = 1; current_ppc_features.has_8_bats = 1;
RTEMS_FALL_THROUGH();
case PPC_7400: case PPC_7400:
/* NOTE: PSIM PVR doesn't tell us anything (its /* NOTE: PSIM PVR doesn't tell us anything (its
* contents are not set based on what model * contents are not set based on what model
@@ -181,12 +182,14 @@ ppc_cpu_id_t get_ppc_cpu_type(void)
*/ */
case PPC_PSIM: case PPC_PSIM:
current_ppc_features.has_altivec = 1; current_ppc_features.has_altivec = 1;
RTEMS_FALL_THROUGH();
case PPC_604: case PPC_604:
case PPC_604e: case PPC_604e:
case PPC_604r: case PPC_604r:
case PPC_750: case PPC_750:
case PPC_750_IBM: case PPC_750_IBM:
current_ppc_features.has_hw_ptbl_lkup = 1; current_ppc_features.has_hw_ptbl_lkup = 1;
RTEMS_FALL_THROUGH();
case PPC_8260: case PPC_8260:
case PPC_8245: case PPC_8245:
case PPC_601: case PPC_601:
@@ -195,6 +198,7 @@ ppc_cpu_id_t get_ppc_cpu_type(void)
case PPC_603ev: case PPC_603ev:
case PPC_603le: case PPC_603le:
current_ppc_features.is_60x = 1; current_ppc_features.is_60x = 1;
RTEMS_FALL_THROUGH();
default: default:
break; break;
} }

View File

@@ -623,6 +623,7 @@ unsigned long tm = TSI_TM_SCT_IDX;
case 3: tm = TSI_TM_BLT_IDX; break; case 3: tm = TSI_TM_BLT_IDX; break;
default: break; default: break;
} }
RTEMS_FALL_THROUGH();
case VME_AM_STD_SUP_DATA: case VME_AM_STD_SUP_DATA:
case VME_AM_STD_USR_DATA: case VME_AM_STD_USR_DATA:
@@ -645,6 +646,7 @@ unsigned long tm = TSI_TM_SCT_IDX;
case 3: tm = TSI_TM_BLT_IDX; break; case 3: tm = TSI_TM_BLT_IDX; break;
default: break; default: break;
} }
RTEMS_FALL_THROUGH();
case VME_AM_EXT_SUP_DATA: case VME_AM_EXT_SUP_DATA:
case VME_AM_EXT_USR_DATA: case VME_AM_EXT_USR_DATA:

View File

@@ -281,6 +281,9 @@ static rtems_isr SLINK_interrupt_handler(void *v)
cfg->rword = wrd; cfg->rword = wrd;
break; break;
} }
#ifdef __rtems__
RTEMS_FALL_THROUGH();
#endif
default: /* Unsolicited request */ default: /* Unsolicited request */
SLINK_enqueue(wrd); SLINK_enqueue(wrd);
break; break;