Document intentional fallthroughs + fix harmless unintended ones

Change-Id: I1ca5b1027ec30cbf61093bab35b980196ed14e6b
This commit is contained in:
Aidan MacDonald 2021-07-24 15:39:01 +01:00
parent ef41cc6623
commit 005c414e5f
24 changed files with 36 additions and 2 deletions

View File

@ -1726,6 +1726,7 @@ static bool dbg_disk_info(void)
#ifdef HAVE_DIRCACHE #ifdef HAVE_DIRCACHE
static int dircache_callback(int btn, struct gui_synclist *lists) static int dircache_callback(int btn, struct gui_synclist *lists)
{ {
(void)lists;
struct dircache_info info; struct dircache_info info;
dircache_get_info(&info); dircache_get_info(&info);
@ -1737,6 +1738,7 @@ static int dircache_callback(int btn, struct gui_synclist *lists)
splash(HZ/2, "Rebuilding cache"); splash(HZ/2, "Rebuilding cache");
dircache_suspend(); dircache_suspend();
*(int *)lists->data = dircache_resume(); *(int *)lists->data = dircache_resume();
/* Fallthrough */
case ACTION_UNKNOWN: case ACTION_UNKNOWN:
btn = ACTION_NONE; btn = ACTION_NONE;
break; break;
@ -1776,7 +1778,6 @@ static int dircache_callback(int btn, struct gui_synclist *lists)
btn = ACTION_REDRAW; btn = ACTION_REDRAW;
return btn; return btn;
(void)lists;
} }
static bool dbg_dircache_info(void) static bool dbg_dircache_info(void)

View File

@ -748,6 +748,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
return true; return true;
} }
*actionptr = ACTION_TREE_PGLEFT; *actionptr = ACTION_TREE_PGLEFT;
/* fallthrough */
case ACTION_TREE_PGLEFT: case ACTION_TREE_PGLEFT:
if(pgleft_allow_cancel && (lists->offset_position[0] == 0)) if(pgleft_allow_cancel && (lists->offset_position[0] == 0))
{ {

View File

@ -270,6 +270,7 @@ char* sb_create_from_settings(enum screen_type screen)
{ {
case STATUSBAR_TOP: case STATUSBAR_TOP:
y = STATUSBAR_HEIGHT; y = STATUSBAR_HEIGHT;
/* Fallthrough */
case STATUSBAR_BOTTOM: case STATUSBAR_BOTTOM:
height = screens[screen].lcdheight - STATUSBAR_HEIGHT; height = screens[screen].lcdheight - STATUSBAR_HEIGHT;
break; break;

View File

@ -223,6 +223,7 @@ bool ffwd_rew(int button)
{ {
case ACTION_WPS_SEEKFWD: case ACTION_WPS_SEEKFWD:
direction = 1; direction = 1;
/* Fallthrough */
case ACTION_WPS_SEEKBACK: case ACTION_WPS_SEEKBACK:
if (skin_get_global_state()->ff_rewind) if (skin_get_global_state()->ff_rewind)
{ {

View File

@ -1441,10 +1441,13 @@ static int clipboard_paste(void)
{ {
case OPRC_CANCELLED: case OPRC_CANCELLED:
splash_cancelled(); splash_cancelled();
/* Fallthrough */
case OPRC_SUCCESS: case OPRC_SUCCESS:
onplay_result = ONPLAY_RELOAD_DIR; onplay_result = ONPLAY_RELOAD_DIR;
/* Fallthrough */
case OPRC_NOOP: case OPRC_NOOP:
clipboard_clear_selection(&clipboard); clipboard_clear_selection(&clipboard);
/* Fallthrough */
case OPRC_NOOVERWRT: case OPRC_NOOVERWRT:
break; break;
default: default:

View File

@ -76,7 +76,7 @@ enum {
#endif #endif
#define ANGLE_STEP 2 #define ANGLE_STEP 2
#define ANGLE_STEP_REP 4 #define ANGLE_STEP_REP 6
#define BUBBLES_QUIT1 PLA_EXIT #define BUBBLES_QUIT1 PLA_EXIT
#define BUBBLES_QUIT2 PLA_CANCEL #define BUBBLES_QUIT2 PLA_CANCEL
@ -2367,12 +2367,14 @@ static int bubbles_handlebuttons(struct game_context* bb, bool animblock,
switch(button){ switch(button){
case BUBBLES_LEFT_REP: case BUBBLES_LEFT_REP:
if(bb->angle > MIN_ANGLE) bb->angle -= ANGLE_STEP_REP; if(bb->angle > MIN_ANGLE) bb->angle -= ANGLE_STEP_REP;
break;
case BUBBLES_LEFT: /* change angle to the left */ case BUBBLES_LEFT: /* change angle to the left */
if(bb->angle > MIN_ANGLE) bb->angle -= ANGLE_STEP; if(bb->angle > MIN_ANGLE) bb->angle -= ANGLE_STEP;
break; break;
case BUBBLES_RIGHT_REP: case BUBBLES_RIGHT_REP:
if(bb->angle < MAX_ANGLE) bb->angle += ANGLE_STEP_REP; if(bb->angle < MAX_ANGLE) bb->angle += ANGLE_STEP_REP;
break;
case BUBBLES_RIGHT: /* change angle to the right */ case BUBBLES_RIGHT: /* change angle to the right */
if(bb->angle < MAX_ANGLE) bb->angle += ANGLE_STEP; if(bb->angle < MAX_ANGLE) bb->angle += ANGLE_STEP;
break; break;

View File

@ -755,6 +755,7 @@ double strtod(const char *nptr, char **endptr)
case '.': case '.':
case '\'': case '\'':
end=1; end=1;
/* fallthrough */
default: default:
nptr++; nptr++;
} }
@ -1687,6 +1688,7 @@ static void typingProcess(void){
clearInput(); clearInput();
*typingbufPointer = '0'; *typingbufPointer = '0';
typingbufPointer++; typingbufPointer++;
/* Fallthrough */
case cal_typing: case cal_typing:
calStatus = cal_dotted; calStatus = cal_dotted;
*typingbufPointer = '.'; *typingbufPointer = '.';

View File

@ -780,6 +780,7 @@ static bool cb_start_viewer(const char* filename){
break; break;
case COMMAND_QUIT: case COMMAND_QUIT:
exit_app = true; exit_app = true;
/* fallthrough */
case COMMAND_RETURN: case COMMAND_RETURN:
exit_viewer = true; exit_viewer = true;
break; break;

View File

@ -121,6 +121,7 @@ void T_MoveCeiling (ceiling_t* ceiling)
// crushers reverse direction at the top // crushers reverse direction at the top
case silentCrushAndRaise: case silentCrushAndRaise:
S_StartSound((mobj_t *)&ceiling->sector->soundorg,sfx_pstop); S_StartSound((mobj_t *)&ceiling->sector->soundorg,sfx_pstop);
/* fallthrough */
case genSilentCrusher: case genSilentCrusher:
case genCrusher: case genCrusher:
case fastCrushAndRaise: case fastCrushAndRaise:
@ -177,8 +178,10 @@ void T_MoveCeiling (ceiling_t* ceiling)
// except generalized ones, reset speed, start back up // except generalized ones, reset speed, start back up
case silentCrushAndRaise: case silentCrushAndRaise:
S_StartSound((mobj_t *)&ceiling->sector->soundorg,sfx_pstop); S_StartSound((mobj_t *)&ceiling->sector->soundorg,sfx_pstop);
/* fallthrough */
case crushAndRaise: case crushAndRaise:
ceiling->speed = CEILSPEED; ceiling->speed = CEILSPEED;
/* fallthrough */
case fastCrushAndRaise: case fastCrushAndRaise:
ceiling->direction = 1; ceiling->direction = 1;
break; break;

View File

@ -503,6 +503,7 @@ int EV_DoFloor
case raiseFloorCrush: case raiseFloorCrush:
floor->crush = true; floor->crush = true;
/* fallthrough */
case raiseFloor: case raiseFloor:
floor->direction = 1; floor->direction = 1;
floor->sector = sec; floor->sector = sec;

View File

@ -524,6 +524,7 @@ plugin_start (const void *parameter)
case BUTTON_NONE: case BUTTON_NONE:
is_idle = true; is_idle = true;
/* fallthrough */
default: default:
if (rb->default_event_handler (btn) == SYS_USB_CONNECTED) if (rb->default_event_handler (btn) == SYS_USB_CONNECTED)
{ {

View File

@ -600,6 +600,7 @@ static int scroll_bmp(struct image_info *info)
if (entries > 1 && info->width <= LCD_WIDTH if (entries > 1 && info->width <= LCD_WIDTH
&& info->height <= LCD_HEIGHT) && info->height <= LCD_HEIGHT)
return change_filename(DIR_PREV); return change_filename(DIR_PREV);
/* fallthrough */
case IMGVIEW_LEFT | BUTTON_REPEAT: case IMGVIEW_LEFT | BUTTON_REPEAT:
pan_view_left(info); pan_view_left(info);
break; break;
@ -608,6 +609,7 @@ static int scroll_bmp(struct image_info *info)
if (entries > 1 && info->width <= LCD_WIDTH if (entries > 1 && info->width <= LCD_WIDTH
&& info->height <= LCD_HEIGHT) && info->height <= LCD_HEIGHT)
return change_filename(DIR_NEXT); return change_filename(DIR_NEXT);
/* fallthrough */
case IMGVIEW_RIGHT | BUTTON_REPEAT: case IMGVIEW_RIGHT | BUTTON_REPEAT:
pan_view_right(info); pan_view_right(info);
break; break;

View File

@ -227,6 +227,7 @@ static int lrc_set_time(const char *title, const char *unit, long *pval,
case PLA_UP_REPEAT: case PLA_UP_REPEAT:
case PLA_DOWN_REPEAT: case PLA_DOWN_REPEAT:
mult *= 10; mult *= 10;
/* fallthrough */
case PLA_DOWN: case PLA_DOWN:
case PLA_UP: case PLA_UP:
if (button == PLA_DOWN_REPEAT || button == PLA_DOWN) if (button == PLA_DOWN_REPEAT || button == PLA_DOWN)

View File

@ -1663,11 +1663,13 @@ enum plugin_status plugin_start(const void* file)
break; break;
case METRONOME_LEFT: case METRONOME_LEFT:
bpm_step_counter = 0; bpm_step_counter = 0;
/* fallthrough */
case METRONOME_LEFT_REP: case METRONOME_LEFT_REP:
change_bpm(-1); change_bpm(-1);
break; break;
case METRONOME_RIGHT: case METRONOME_RIGHT:
bpm_step_counter = 0; bpm_step_counter = 0;
/* fallthrough */
case METRONOME_RIGHT_REP: case METRONOME_RIGHT_REP:
change_bpm(1); change_bpm(1);
break; break;

View File

@ -307,6 +307,7 @@ static int sequence_ext (mpeg2dec_t * mpeg2dec)
return 1; return 1;
case 2: /* 4:2:0 */ case 2: /* 4:2:0 */
sequence->chroma_height >>= 1; sequence->chroma_height >>= 1;
/* fallthrough */
case 4: /* 4:2:2 */ case 4: /* 4:2:2 */
sequence->chroma_width >>= 1; sequence->chroma_width >>= 1;
} }

View File

@ -366,6 +366,7 @@ static int edit_list(void)
{ {
case 0: case 0:
save_list(); save_list();
/* fallthrough */
case 1: case 1:
exit = true; exit = true;
ret = -2; ret = -2;

View File

@ -150,6 +150,7 @@ static bool load_cellfile(const char *file, char *pgrid){
switch(c) { switch(c) {
case '!': case '!':
comment = true; comment = true;
break;
case '.': case '.':
if (!comment) if (!comment)
x++; x++;

View File

@ -1907,6 +1907,7 @@ static void draw_text( int x, int y )
rb->lcd_set_foreground( rp_colors[ drawcolor ] ); rb->lcd_set_foreground( rp_colors[ drawcolor ] );
buffer_putsxyofs( save_buffer, COLS, ROWS, x, y, 0, buffer_putsxyofs( save_buffer, COLS, ROWS, x, y, 0,
buffer->text.text ); buffer->text.text );
/* fallthrough */
case TEXT_MENU_CANCEL: case TEXT_MENU_CANCEL:
default: default:
restore_screen(); restore_screen();

View File

@ -4824,6 +4824,7 @@ static void tagcache_thread(void)
case Q_START_SCAN: case Q_START_SCAN:
check_done = false; check_done = false;
/* fallthrough */
case SYS_TIMEOUT: case SYS_TIMEOUT:
if (check_done || !tc_stat.ready) if (check_done || !tc_stat.ready)
break ; break ;

View File

@ -181,6 +181,7 @@ int get_hid_usb_action(void)
{ {
case ACTION_USB_HID_MODE_SWITCH_NEXT: case ACTION_USB_HID_MODE_SWITCH_NEXT:
step = 1; step = 1;
/* fallthrough */
case ACTION_USB_HID_MODE_SWITCH_PREV: case ACTION_USB_HID_MODE_SWITCH_PREV:
/* Switch key mappings in a cyclic way */ /* Switch key mappings in a cyclic way */
usb_keypad_mode = clamp_value_wrap(usb_keypad_mode + step, usb_keypad_mode = clamp_value_wrap(usb_keypad_mode + step,

View File

@ -647,6 +647,7 @@ int open_stream_internal(const char *path, unsigned int callflags,
{ {
case WALK_RC_FOUND_ROOT: case WALK_RC_FOUND_ROOT:
IF_MV( rc = rootrc; ) IF_MV( rc = rootrc; )
/* fallthrough */
case WALK_RC_NOT_FOUND: case WALK_RC_NOT_FOUND:
case WALK_RC_FOUND: case WALK_RC_FOUND:
/* FF_PROBE leaves nothing for caller to clean up */ /* FF_PROBE leaves nothing for caller to clean up */

View File

@ -753,6 +753,7 @@ static int format_double_radix(double f,
if (prec_rem) { if (prec_rem) {
prec_rem--; prec_rem--;
} }
/* fallthrough */
case 1: /* %e, %E */ case 1: /* %e, %E */
explen = 2; explen = 2;
break; break;

View File

@ -498,6 +498,7 @@ void a52_downmix (sample_t * samples, int acmod, int output,
case CONVERT (A52_2F1R, A52_MONO): case CONVERT (A52_2F1R, A52_MONO):
if (slev == 0) if (slev == 0)
goto mix_2to1; goto mix_2to1;
/* fallthrough */
case CONVERT (A52_3F, A52_MONO): case CONVERT (A52_3F, A52_MONO):
mix_3to1: mix_3to1:
mix3to1 (samples); mix3to1 (samples);
@ -506,9 +507,11 @@ void a52_downmix (sample_t * samples, int acmod, int output,
case CONVERT (A52_3F1R, A52_MONO): case CONVERT (A52_3F1R, A52_MONO):
if (slev == 0) if (slev == 0)
goto mix_3to1; goto mix_3to1;
/* fallthrough */
case CONVERT (A52_2F2R, A52_MONO): case CONVERT (A52_2F2R, A52_MONO):
if (slev == 0) if (slev == 0)
goto mix_2to1; goto mix_2to1;
/* fallthrough */
mix4to1 (samples); mix4to1 (samples);
break; break;

View File

@ -334,6 +334,7 @@ static intptr_t crossfeed_configure(struct dsp_proc_entry *this,
case DSP_PROC_INIT: case DSP_PROC_INIT:
if (value == 0) if (value == 0)
this->data = (intptr_t)&crossfeed_state; this->data = (intptr_t)&crossfeed_state;
/* Fallthrough */
case DSP_SET_OUT_FREQUENCY: case DSP_SET_OUT_FREQUENCY:
update_process_fn(this, dsp); update_process_fn(this, dsp);