cpukit/*: 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:13:38 -05:00
committed by Gedare Bloom
parent fef5e18ada
commit 106363b29d
9 changed files with 39 additions and 16 deletions

View File

@@ -1076,6 +1076,7 @@ static void ctucanfd_handle_txtb_done(
ctucanfd_txb_free( internal, txb_order_idx ); ctucanfd_txb_free( internal, txb_order_idx );
break; break;
} }
RTEMS_FALL_THROUGH();
case TXT_ERR: case TXT_ERR:
#ifdef CTUCANFD_DEBUG #ifdef CTUCANFD_DEBUG
printk("CTUCANFD TXT_ERR\n"); printk("CTUCANFD TXT_ERR\n");

View File

@@ -1338,6 +1338,7 @@ int rtems_debugger_target_exception_to_signal( CPU_Exception_frame *frame )
return RTEMS_DEBUGGER_SIGNAL_TRAP; return RTEMS_DEBUGGER_SIGNAL_TRAP;
} }
RTEMS_FALL_THROUGH();
default: default:
return RTEMS_DEBUGGER_SIGNAL_ILL; return RTEMS_DEBUGGER_SIGNAL_ILL;
} }

View File

@@ -231,10 +231,13 @@ rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT kind)
switch (target->breakpoint_size) { switch (target->breakpoint_size) {
case 4: case 4:
loc[3] = swbreaks[i].contents[3]; loc[3] = swbreaks[i].contents[3];
RTEMS_FALL_THROUGH();
case 3: case 3:
loc[2] = swbreaks[i].contents[2]; loc[2] = swbreaks[i].contents[2];
RTEMS_FALL_THROUGH();
case 2: case 2:
loc[1] = swbreaks[i].contents[1]; loc[1] = swbreaks[i].contents[1];
RTEMS_FALL_THROUGH();
case 1: case 1:
loc[0] = swbreaks[i].contents[0]; loc[0] = swbreaks[i].contents[0];
break; break;
@@ -269,10 +272,13 @@ rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT kind)
switch (target->breakpoint_size) { switch (target->breakpoint_size) {
case 4: case 4:
contents[3] = loc[3]; contents[3] = loc[3];
RTEMS_FALL_THROUGH();
case 3: case 3:
contents[2] = loc[2]; contents[2] = loc[2];
RTEMS_FALL_THROUGH();
case 2: case 2:
contents[1] = loc[1]; contents[1] = loc[1];
RTEMS_FALL_THROUGH();
case 1: case 1:
contents[0] = loc[0]; contents[0] = loc[0];
break; break;
@@ -315,10 +321,13 @@ rtems_debugger_target_swbreak_insert(void)
switch (target->breakpoint_size) { switch (target->breakpoint_size) {
case 4: case 4:
loc[3] = target->breakpoint[3]; loc[3] = target->breakpoint[3];
RTEMS_FALL_THROUGH();
case 3: case 3:
loc[2] = target->breakpoint[2]; loc[2] = target->breakpoint[2];
RTEMS_FALL_THROUGH();
case 2: case 2:
loc[1] = target->breakpoint[1]; loc[1] = target->breakpoint[1];
RTEMS_FALL_THROUGH();
case 1: case 1:
loc[0] = target->breakpoint[0]; loc[0] = target->breakpoint[0];
break; break;
@@ -358,10 +367,13 @@ rtems_debugger_target_swbreak_remove(void)
switch (target->breakpoint_size) { switch (target->breakpoint_size) {
case 4: case 4:
loc[3] = contents[3]; loc[3] = contents[3];
RTEMS_FALL_THROUGH();
case 3: case 3:
loc[2] = contents[2]; loc[2] = contents[2];
RTEMS_FALL_THROUGH();
case 2: case 2:
loc[1] = contents[1]; loc[1] = contents[1];
RTEMS_FALL_THROUGH();
case 1: case 1:
loc[0] = contents[0]; loc[0] = contents[0];
break; break;

View File

@@ -633,6 +633,7 @@ rtems_rtl_elf_reloc_rel (rtems_rtl_obj* obj,
case R_TYPE(TLS_LE12): case R_TYPE(TLS_LE12):
case R_TYPE(TLS_IE12GP): case R_TYPE(TLS_IE12GP):
printf("TSL relocations not supported\n"); printf("TSL relocations not supported\n");
RTEMS_FALL_THROUGH();
default: default:
printf ("rtl: reloc unknown: sym = %" PRIu32 ", type = %" PRIu32 ", offset = %p", printf ("rtl: reloc unknown: sym = %" PRIu32 ", type = %" PRIu32 ", offset = %p",

View File

@@ -37,6 +37,7 @@
#include "config.h" #include "config.h"
#endif #endif
#include <rtems/score/basedefs.h>
#include <rtems/rfs/rtems-rfs-dir-hash.h> #include <rtems/rfs/rtems-rfs-dir-hash.h>
#ifdef __rtems__ #ifdef __rtems__
@@ -342,17 +343,17 @@ rtems_rfs_dir_hash (const void *key, size_t length)
/*-------------------------------- last block: affect all 32 bits of (c) */ /*-------------------------------- last block: affect all 32 bits of (c) */
switch(length) /* all the case statements fall through */ switch(length) /* all the case statements fall through */
{ {
case 12: c+=((uint32_t)k[11])<<24; case 12: c+=((uint32_t)k[11])<<24; RTEMS_FALL_THROUGH();
case 11: c+=((uint32_t)k[10])<<16; case 11: c+=((uint32_t)k[10])<<16; RTEMS_FALL_THROUGH();
case 10: c+=((uint32_t)k[9])<<8; case 10: c+=((uint32_t)k[9])<<8; RTEMS_FALL_THROUGH();
case 9 : c+=k[8]; case 9 : c+=k[8]; RTEMS_FALL_THROUGH();
case 8 : b+=((uint32_t)k[7])<<24; case 8 : b+=((uint32_t)k[7])<<24; RTEMS_FALL_THROUGH();
case 7 : b+=((uint32_t)k[6])<<16; case 7 : b+=((uint32_t)k[6])<<16; RTEMS_FALL_THROUGH();
case 6 : b+=((uint32_t)k[5])<<8; case 6 : b+=((uint32_t)k[5])<<8; RTEMS_FALL_THROUGH();
case 5 : b+=k[4]; case 5 : b+=k[4]; RTEMS_FALL_THROUGH();
case 4 : a+=((uint32_t)k[3])<<24; case 4 : a+=((uint32_t)k[3])<<24; RTEMS_FALL_THROUGH();
case 3 : a+=((uint32_t)k[2])<<16; case 3 : a+=((uint32_t)k[2])<<16; RTEMS_FALL_THROUGH();
case 2 : a+=((uint32_t)k[1])<<8; case 2 : a+=((uint32_t)k[1])<<8; RTEMS_FALL_THROUGH();
case 1 : a+=k[0]; case 1 : a+=k[0];
break; break;
case 0 : return c; case 0 : return c;

View File

@@ -238,20 +238,21 @@ task_usage(Thread_Control* thread, void* arg)
{ {
default: default:
data->sort_order = RTEMS_TOP_SORT_CURRENT; data->sort_order = RTEMS_TOP_SORT_CURRENT;
/* drop through */ RTEMS_FALL_THROUGH();
case RTEMS_TOP_SORT_CURRENT: case RTEMS_TOP_SORT_CURRENT:
if (CPU_usage_Equal_to(&current, &data->zero) || if (CPU_usage_Equal_to(&current, &data->zero) ||
CPU_usage_Less_than(&current, &data->current_usage[j])) CPU_usage_Less_than(&current, &data->current_usage[j]))
continue; continue;
RTEMS_FALL_THROUGH();
case RTEMS_TOP_SORT_TOTAL: case RTEMS_TOP_SORT_TOTAL:
if (CPU_usage_Equal_to(&usage, &data->zero) || if (CPU_usage_Equal_to(&usage, &data->zero) ||
CPU_usage_Less_than(&usage, &data->usage[j])) CPU_usage_Less_than(&usage, &data->usage[j]))
continue; continue;
/* Fall through */ RTEMS_FALL_THROUGH();
case RTEMS_TOP_SORT_REAL_PRI: case RTEMS_TOP_SORT_REAL_PRI:
if (thread->Real_priority.priority > data->tasks[j]->Real_priority.priority) if (thread->Real_priority.priority > data->tasks[j]->Real_priority.priority)
continue; continue;
/* Fall through */ RTEMS_FALL_THROUGH();
case RTEMS_TOP_SORT_CURRENT_PRI: case RTEMS_TOP_SORT_CURRENT_PRI:
if ( if (
_Thread_Get_priority( thread ) _Thread_Get_priority( thread )
@@ -259,7 +260,7 @@ task_usage(Thread_Control* thread, void* arg)
) { ) {
continue; continue;
} }
/* Fall through */ RTEMS_FALL_THROUGH();
case RTEMS_TOP_SORT_ID: case RTEMS_TOP_SORT_ID:
if (thread->Object.id < data->tasks[j]->Object.id) if (thread->Object.id < data->tasks[j]->Object.id)
continue; continue;

View File

@@ -529,6 +529,9 @@ copy(rtems_shell_cp_globals* cp_globals,
case S_IFSOCK: case S_IFSOCK:
warnx("%s is a socket (not copied).", warnx("%s is a socket (not copied).",
curr->fts_path); curr->fts_path);
#ifdef __rtems__
RTEMS_FALL_THROUGH();
#endif
case S_IFIFO: case S_IFIFO:
if (Rflag) { if (Rflag) {
if (copy_fifo(cp_globals, curr->fts_statp, !dne)) if (copy_fifo(cp_globals, curr->fts_statp, !dne))

View File

@@ -186,12 +186,15 @@ main_ln(rtems_shell_ln_globals* globals, int argc, char *argv[])
case 0: case 0:
usage(globals); usage(globals);
/* NOTREACHED */ /* NOTREACHED */
RTEMS_UNREACHABLE();
case 1: /* ln target */ case 1: /* ln target */
exit(linkit(globals, argv[0], ".", 1)); exit(linkit(globals, argv[0], ".", 1));
/* NOTREACHED */ /* NOTREACHED */
RTEMS_UNREACHABLE();
case 2: /* ln target source */ case 2: /* ln target source */
exit(linkit(globals, argv[0], argv[1], 0)); exit(linkit(globals, argv[0], argv[1], 0));
/* NOTREACHED */ /* NOTREACHED */
RTEMS_UNREACHABLE();
} }
/* ln target1 target2 directory */ /* ln target1 target2 directory */

View File

@@ -577,7 +577,7 @@ static int rtems_shell_line_editor(
} }
up = 1; up = 1;
/* drop through */ RTEMS_FALL_THROUGH();
case 14: /* Control-N */ case 14: /* Control-N */
{ {