From 5b1158e64a6edb9665ce4b4b2d5b5bf0fc206eea Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Tue, 22 Apr 2025 20:45:45 -0400 Subject: [PATCH] misc: Properly annotate some intentional case fallthroughs Change-Id: Ie758f17fefac72aca1aa28a8ba1126b9334fe134 --- apps/plugins/lastfm_scrobbler.c | 1 + apps/plugins/lastfm_scrobbler_viewer.c | 2 +- apps/plugins/lua/ldebug.c | 5 +++-- apps/plugins/lua/llex.c | 2 +- apps/plugins/mpegplayer/stream_mgr.c | 3 ++- firmware/common/unicode.c | 2 +- firmware/kernel/thread.c | 4 ++-- firmware/target/mips/ingenic_jz47xx/ata-sd-jz4760.c | 2 +- lib/rbcodec/dsp/dsp_misc.c | 1 + 9 files changed, 13 insertions(+), 9 deletions(-) diff --git a/apps/plugins/lastfm_scrobbler.c b/apps/plugins/lastfm_scrobbler.c index 1cc01a1a23..906888c957 100644 --- a/apps/plugins/lastfm_scrobbler.c +++ b/apps/plugins/lastfm_scrobbler.c @@ -248,6 +248,7 @@ static int scrobbler_menu_action(int selection, bool has_log) return -1; } } + /* fallthrough */ case 10: /* Export & exit */ { res = configfile_save(CFG_FILE, config, gCfg_sz, CFG_VER); diff --git a/apps/plugins/lastfm_scrobbler_viewer.c b/apps/plugins/lastfm_scrobbler_viewer.c index d5de125c1c..e1a5251a0e 100644 --- a/apps/plugins/lastfm_scrobbler_viewer.c +++ b/apps/plugins/lastfm_scrobbler_viewer.c @@ -809,7 +809,7 @@ static int scrobbler_context_menu(struct printcell_data_t *pc_data) if (find_type == FIND_ALL) find_type = FIND_INCLUDE; - /* fall-through */ + /* fallthrough */ } case 3: /*Custom Filter / Settings */ { diff --git a/apps/plugins/lua/ldebug.c b/apps/plugins/lua/ldebug.c index 0b3c5721f3..d6bb60f55f 100644 --- a/apps/plugins/lua/ldebug.c +++ b/apps/plugins/lua/ldebug.c @@ -254,6 +254,7 @@ static int stripdebug (lua_State *L, Proto *f, const int level) { len += f->sizelineinfo; f->packedlineinfo = luaM_freearray(L, f->packedlineinfo, f->sizelineinfo, unsigned char); f->sizelineinfo = 0; + /* fallthrough */ case 2: len += f->sizelocvars * (sizeof(struct LocVar) + sizeof(dummy->tsv) + sizeof(struct LocVar *)); f->locvars = luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); @@ -262,6 +263,7 @@ static int stripdebug (lua_State *L, Proto *f, const int level) { f->sizeupvalues * (sizeof(dummy->tsv) + sizeof(TString *)); f->sizelocvars = 0; f->sizeupvalues = 0; + /* fallthrough */ case 1: default: break; @@ -510,7 +512,7 @@ static Instruction symbexec (const Proto *pt, int lastpc, int reg) { case OP_FORLOOP: case OP_FORPREP: checkreg(pt, a+3); - /* go through */ + /* fallthrough */ case OP_JMP: { int dest = pc+1+b; /* not full check and jump is forward and do not skip `lastpc'? */ @@ -733,4 +735,3 @@ void luaG_runerror (lua_State *L, const char *fmt, ...) { va_end(argp); luaG_errormsg(L); } - diff --git a/apps/plugins/lua/llex.c b/apps/plugins/lua/llex.c index 723d46c1ce..2d45feec8b 100644 --- a/apps/plugins/lua/llex.c +++ b/apps/plugins/lua/llex.c @@ -367,6 +367,7 @@ static int llex (LexState *ls, SemInfo *seminfo) { } else if (sep == -1) return '['; else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING); + break; /* to avoid warnings */ } case '=': { next(ls); @@ -460,4 +461,3 @@ void luaX_lookahead (LexState *ls) { lua_assert(ls->lookahead.token == TK_EOS); ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); } - diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c index 3cac8c0f57..01f2a2f9ec 100644 --- a/apps/plugins/mpegplayer/stream_mgr.c +++ b/apps/plugins/mpegplayer/stream_mgr.c @@ -693,6 +693,7 @@ static intptr_t send_video_msg(long id, intptr_t data) case VIDEO_PRINT_FRAME: if (data) break; + /* fallthrough */ case VIDEO_PRINT_THUMBNAIL: if (disk_buf_status() != STREAM_STOPPED) break; /* Prepare image if not playing */ @@ -1132,7 +1133,7 @@ int stream_init(void) rb->splash(HZ, "Parser init failed!"); } else - { + { return STREAM_OK; } diff --git a/firmware/common/unicode.c b/firmware/common/unicode.c index d2ec07df0a..444ea0f406 100644 --- a/firmware/common/unicode.c +++ b/firmware/common/unicode.c @@ -374,7 +374,7 @@ unsigned char* iso_decode_ex(const unsigned char *iso, unsigned char *utf8, int ucs = table[tmp]; break; } - + /* fallthrough */ case CP_TID_936: /* Simplified Chinese */ case CP_TID_949: /* Korean */ case CP_TID_950: /* Traditional Chinese */ diff --git a/firmware/kernel/thread.c b/firmware/kernel/thread.c index 25677c79f9..dde1a71011 100644 --- a/firmware/kernel/thread.c +++ b/firmware/kernel/thread.c @@ -889,7 +889,7 @@ unsigned int wakeup_thread_(struct thread_entry *thread UNLOCK_THREAD(thread); return THREAD_OK; /* timed out */ } - + /* fallthrough */ default: UNLOCK_THREAD(thread); return THREAD_NONE; @@ -1044,7 +1044,7 @@ void switch_thread(void) break; thread = NULL; - + /* Enter sleep mode to reduce power usage */ RTR_UNLOCK(corep); core_sleep(IF_COP(core)); diff --git a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4760.c b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4760.c index 3810852686..db09c740cf 100644 --- a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4760.c +++ b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4760.c @@ -788,7 +788,7 @@ static int jz_sd_exec_cmd(const int drive, struct sd_request *request) (unsigned char *) ((unsigned int) request->response + 5); request->block_len = 8; request->nob = 1; - + /* fallthrough */ case SD_READ_DAT_UNTIL_STOP: case SD_READ_SINGLE_BLOCK: case SD_READ_MULTIPLE_BLOCK: diff --git a/lib/rbcodec/dsp/dsp_misc.c b/lib/rbcodec/dsp/dsp_misc.c index 24ec857e3a..be9afbb34a 100644 --- a/lib/rbcodec/dsp/dsp_misc.c +++ b/lib/rbcodec/dsp/dsp_misc.c @@ -170,6 +170,7 @@ static intptr_t misc_handler_configure(struct dsp_proc_entry *this, dsp_pitch_update(dsp); #endif value = (intptr_t)NULL; /* Default gains */ + /* fallthrough */ case REPLAYGAIN_SET_GAINS: dsp_replaygain_set_gains((void *)value); break;