From b8b93e0dd88cc906beed2adbe52c970411cc1230 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 31 Oct 2020 13:22:13 +0200 Subject: [PATCH] - fixed most of implicit fallthrough compilation warnings src/common/console/c_console.cpp:1032:4: warning: this statement may fall through [-Wimplicit-fallthrough=] src/common/console/c_console.cpp:958:4: warning: this statement may fall through [-Wimplicit-fallthrough=] src/common/scripting/backend/codegen.cpp:2969:4: warning: this statement may fall through [-Wimplicit-fallthrough=] src/common/scripting/frontend/zcc_compile.cpp:2656:4: warning: this statement may fall through [-Wimplicit-fallthrough=] src/common/scripting/frontend/zcc_compile.cpp:521:5: warning: this statement may fall through [-Wimplicit-fallthrough=] src/common/scripting/jit/jit_math.cpp:966:19: warning: this statement may fall through [-Wimplicit-fallthrough=] src/d_main.cpp:1538:3: warning: this statement may fall through [-Wimplicit-fallthrough=] src/d_main.cpp:1549:3: warning: this statement may fall through [-Wimplicit-fallthrough=] src/d_main.cpp:3820:3: warning: this statement may fall through [-Wimplicit-fallthrough=] src/gameconfigfile.cpp:544:25: warning: this statement may fall through [-Wimplicit-fallthrough=] src/gamedata/p_xlat.cpp:193:11: warning: this statement may fall through [-Wimplicit-fallthrough=] src/gamedata/p_xlat.cpp:200:11: warning: this statement may fall through [-Wimplicit-fallthrough=] src/gamedata/p_xlat.cpp:210:11: warning: this statement may fall through [-Wimplicit-fallthrough=] src/g_game.cpp:1145:20: warning: this statement may fall through [-Wimplicit-fallthrough=] src/maploader/maploader.cpp:2142:3: warning: this statement may fall through [-Wimplicit-fallthrough=] src/menu/doommenu.cpp:159:28: warning: this statement may fall through [-Wimplicit-fallthrough=] src/m_cheat.cpp:109:3: warning: this statement may fall through [-Wimplicit-fallthrough=] src/playsim/mapthinkers/a_ceiling.cpp:254:24: warning: this statement may fall through [-Wimplicit-fallthrough=] src/playsim/mapthinkers/a_floor.cpp:322:18: warning: this statement may fall through [-Wimplicit-fallthrough=] src/playsim/mapthinkers/a_floor.cpp:330:18: warning: this statement may fall through [-Wimplicit-fallthrough=] src/playsim/mapthinkers/a_floor.cpp:344:10: warning: this statement may fall through [-Wimplicit-fallthrough=] src/playsim/mapthinkers/a_plats.cpp:129:47: warning: this statement may fall through [-Wimplicit-fallthrough=] src/playsim/mapthinkers/a_plats.cpp:284:8: warning: this statement may fall through [-Wimplicit-fallthrough=] src/playsim/p_acs.cpp:6302:18: warning: this statement may fall through [-Wimplicit-fallthrough=] src/playsim/p_acs.cpp:8111:16: warning: this statement may fall through [-Wimplicit-fallthrough=] src/playsim/p_spec.cpp:344:6: warning: this statement may fall through [-Wimplicit-fallthrough=] src/scripting/decorate/thingdef_parse.cpp:1343:9: warning: this statement may fall through [-Wimplicit-fallthrough=] src/scripting/zscript/zcc_compile_doom.cpp:298:12: warning: this statement may fall through [-Wimplicit-fallthrough=] src/wi_stuff.cpp:463:14: warning: this statement may fall through [-Wimplicit-fallthrough=] --- src/common/console/c_console.cpp | 2 ++ src/common/scripting/backend/codegen.cpp | 1 + src/common/scripting/frontend/zcc_compile.cpp | 2 ++ src/common/scripting/jit/jit_math.cpp | 2 +- src/d_main.cpp | 3 +++ src/g_game.cpp | 1 + src/gameconfigfile.cpp | 1 + src/gamedata/p_xlat.cpp | 3 +++ src/m_cheat.cpp | 1 + src/maploader/maploader.cpp | 1 + src/menu/doommenu.cpp | 1 + src/playsim/mapthinkers/a_ceiling.cpp | 1 + src/playsim/mapthinkers/a_floor.cpp | 3 +++ src/playsim/mapthinkers/a_plats.cpp | 2 ++ src/playsim/p_acs.cpp | 3 ++- src/playsim/p_spec.cpp | 1 + src/scripting/decorate/thingdef_parse.cpp | 1 + src/scripting/zscript/zcc_compile_doom.cpp | 1 + src/wi_stuff.cpp | 1 + 19 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/common/console/c_console.cpp b/src/common/console/c_console.cpp index 0b4a74a53..365d92889 100644 --- a/src/common/console/c_console.cpp +++ b/src/common/console/c_console.cpp @@ -968,6 +968,7 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer) break; } // Intentional fall-through for command(s) added with Ctrl-D + [[fallthrough]]; case '\r': { @@ -1033,6 +1034,7 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer) { break; } + [[fallthrough]]; case GK_ESCAPE: // Close console and clear command line. But if we're in the // fullscreen console mode, there's nothing to fall back on diff --git a/src/common/scripting/backend/codegen.cpp b/src/common/scripting/backend/codegen.cpp index cb9642a64..11db32019 100644 --- a/src/common/scripting/backend/codegen.cpp +++ b/src/common/scripting/backend/codegen.cpp @@ -2967,6 +2967,7 @@ FxExpression *FxMulDiv::Resolve(FCompileContext& ctx) case '/': // For division, the vector must be the first operand. if (right->IsVector()) goto error; + [[fallthrough]]; case '*': if (left->IsVector() && right->IsNumeric()) diff --git a/src/common/scripting/frontend/zcc_compile.cpp b/src/common/scripting/frontend/zcc_compile.cpp index 47696089e..1acd9899a 100644 --- a/src/common/scripting/frontend/zcc_compile.cpp +++ b/src/common/scripting/frontend/zcc_compile.cpp @@ -523,6 +523,7 @@ ZCCCompiler::ZCCCompiler(ZCC_AST &ast, DObject *_outer, PSymbolTable &_symbols, ProcessStruct(static_cast(node), tnode, nullptr); break; } + goto common; common: case AST_ConstantDef: @@ -2655,6 +2656,7 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast, bool substitute) } } // fall through if this isn't an array access node. + [[fallthrough]]; default: Error(fcall, "Invalid function identifier"); diff --git a/src/common/scripting/jit/jit_math.cpp b/src/common/scripting/jit/jit_math.cpp index 0b142563d..d2fb45c7d 100644 --- a/src/common/scripting/jit/jit_math.cpp +++ b/src/common/scripting/jit/jit_math.cpp @@ -963,7 +963,7 @@ void JitCompiler::EmitFLOP() FuncPtr func = nullptr; switch (C) { - default: I_Error("Unknown OP_FLOP subfunction"); + default: I_Error("Unknown OP_FLOP subfunction"); break; case FLOP_ABS: func = fabs; break; case FLOP_EXP: func = g_exp; break; case FLOP_LOG: func = g_log; break; diff --git a/src/d_main.cpp b/src/d_main.cpp index cd84fc746..d43215c3c 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1543,6 +1543,7 @@ void D_DoAdvanceDemo (void) break; } // fall through to case 1 if no advisory notice + [[fallthrough]]; case 1: Advisory = NULL; @@ -1564,6 +1565,7 @@ void D_DoAdvanceDemo (void) break; } } + [[fallthrough]]; default: case 0: @@ -3822,6 +3824,7 @@ void I_UpdateWindowTitle() titlestr.Format("%s - %s", level.LevelName.GetChars(), GameStartupInfo.Name.GetChars()); break; } + [[fallthrough]]; case 2: titlestr = GameStartupInfo.Name; break; diff --git a/src/g_game.cpp b/src/g_game.cpp index fbe8fb55f..0a1751f3c 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1143,6 +1143,7 @@ void G_Ticker () G_CheckDemoStatus(); G_RecordDemo(newdemoname); G_BeginRecording(newdemomap); + [[fallthrough]]; case ga_newgame2: // Silence GCC (see above) case ga_newgame: G_DoNewGame (); diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 625fca77b..59811fcdb 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -542,6 +542,7 @@ void FGameConfigFile::DoGlobalSetup () case 1: newvalue.Int = 0; var->SetGenericRep(newvalue, CVAR_Int); + [[fallthrough]]; case 3: case 4: vid_scale_linear = true; diff --git a/src/gamedata/p_xlat.cpp b/src/gamedata/p_xlat.cpp index 2ab3ebf12..682d40104 100644 --- a/src/gamedata/p_xlat.cpp +++ b/src/gamedata/p_xlat.cpp @@ -191,6 +191,7 @@ void FLevelLocals::TranslateLineDef (line_t *ld, maplinedef_t *mld, int lineinde { case WalkMany: flags |= ML_REPEAT_SPECIAL; + [[fallthrough]]; case WalkOnce: ld->activation = SPAC_Cross; break; @@ -198,6 +199,7 @@ void FLevelLocals::TranslateLineDef (line_t *ld, maplinedef_t *mld, int lineinde case SwitchMany: case PushMany: flags |= ML_REPEAT_SPECIAL; + [[fallthrough]]; case SwitchOnce: case PushOnce: if (passthrough) @@ -208,6 +210,7 @@ void FLevelLocals::TranslateLineDef (line_t *ld, maplinedef_t *mld, int lineinde case GunMany: flags |= ML_REPEAT_SPECIAL; + [[fallthrough]]; case GunOnce: ld->activation = SPAC_Impact; break; diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index 6fd1ef6a6..5964d1c28 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -114,6 +114,7 @@ void cht_DoCheat (player_t *player, int cheat) player->health = deh.GodHealth; } // fall through to CHT_GOD + [[fallthrough]]; case CHT_GOD: player->cheats ^= CF_GODMODE; if (player->cheats & CF_GODMODE) diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index 779e901a6..1b712a449 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -2141,6 +2141,7 @@ void MapLoader::ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec break; } // Fallthrough for Hexen maps is intentional + [[fallthrough]]; default: // normal cases diff --git a/src/menu/doommenu.cpp b/src/menu/doommenu.cpp index ec50a8089..28e349cf1 100644 --- a/src/menu/doommenu.cpp +++ b/src/menu/doommenu.cpp @@ -157,6 +157,7 @@ bool M_SetSpecialMenu(FName& menu, int param) // sent either from skill menu or confirmation screen. Skill gets only set if sent from skill menu // Now we can finally start the game. Ugh... NewGameStartupInfo.Skill = param; + [[fallthrough]]; case NAME_StartgameConfirmed: G_DeferedInitNew (&NewGameStartupInfo); diff --git a/src/playsim/mapthinkers/a_ceiling.cpp b/src/playsim/mapthinkers/a_ceiling.cpp index b9c168ed9..1afdf4509 100644 --- a/src/playsim/mapthinkers/a_ceiling.cpp +++ b/src/playsim/mapthinkers/a_ceiling.cpp @@ -252,6 +252,7 @@ bool FLevelLocals::CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t case DCeiling::ceilCrushAndRaise: case DCeiling::ceilCrushRaiseAndStay: ceiling->m_TopHeight = sec->ceilingplane.fD(); + [[fallthrough]]; case DCeiling::ceilLowerAndCrush: targheight = FindHighestFloorPoint (sec, &spot); targheight += height; diff --git a/src/playsim/mapthinkers/a_floor.cpp b/src/playsim/mapthinkers/a_floor.cpp index 9bb937e7a..a94c98012 100644 --- a/src/playsim/mapthinkers/a_floor.cpp +++ b/src/playsim/mapthinkers/a_floor.cpp @@ -320,6 +320,7 @@ bool FLevelLocals::CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t * case DFloor::floorLowerInstant: floor->m_Speed = height; + [[fallthrough]]; case DFloor::floorLowerByValue: floor->m_Direction = -1; newheight = sec->CenterFloor() - height; @@ -328,6 +329,7 @@ bool FLevelLocals::CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t * case DFloor::floorRaiseInstant: floor->m_Speed = height; + [[fallthrough]]; case DFloor::floorRaiseByValue: floor->m_Direction = 1; newheight = sec->CenterFloor() + height; @@ -342,6 +344,7 @@ bool FLevelLocals::CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t * case DFloor::floorRaiseAndCrushDoom: height = 8; + [[fallthrough]]; case DFloor::floorRaiseToLowestCeiling: floor->m_Direction = 1; newheight = FindLowestCeilingSurrounding(sec, &spot) - height; diff --git a/src/playsim/mapthinkers/a_plats.cpp b/src/playsim/mapthinkers/a_plats.cpp index 8decb188f..c688295e4 100644 --- a/src/playsim/mapthinkers/a_plats.cpp +++ b/src/playsim/mapthinkers/a_plats.cpp @@ -127,6 +127,7 @@ void DPlat::Tick () // better use a flag to avoid problems elsewhere. For example, // keeping the thinker would make tagwait wait indefinitely. m_Sector->planes[sector_t::floor].Flags |= PLANEF_BLOCKED; + [[fallthrough]]; case platRaiseAndStay: case platDownByValue: case platDownWaitUpStay: @@ -282,6 +283,7 @@ bool FLevelLocals::EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, doub { case DPlat::platToggle: rtn = true; + [[fallthrough]]; case DPlat::platPerpetualRaise: ActivateInStasisPlat (tag); break; diff --git a/src/playsim/p_acs.cpp b/src/playsim/p_acs.cpp index bf90b5c9d..e04de2b99 100644 --- a/src/playsim/p_acs.cpp +++ b/src/playsim/p_acs.cpp @@ -6299,7 +6299,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) int tid1 = 0, tid2 = 0; switch (argCount) { - case 4: tid2 = args[3]; + case 4: tid2 = args[3]; [[fallthrough]]; case 3: tid1 = args[2]; } @@ -8109,6 +8109,7 @@ int DLevelScript::RunScript() case PCD_SETRESULTVALUE: resultValue = STACK(1); + [[fallthrough]]; case PCD_DROP: //fall through. sp--; break; diff --git a/src/playsim/p_spec.cpp b/src/playsim/p_spec.cpp index 0f4b48fc9..2a156373d 100644 --- a/src/playsim/p_spec.cpp +++ b/src/playsim/p_spec.cpp @@ -345,6 +345,7 @@ bool P_TestActivateLine (line_t *line, AActor *mo, int side, int activationType, { break; } + [[fallthrough]]; case Teleport: case Teleport_NoFog: case Teleport_Line: diff --git a/src/scripting/decorate/thingdef_parse.cpp b/src/scripting/decorate/thingdef_parse.cpp index 37087102d..0f0a5d828 100644 --- a/src/scripting/decorate/thingdef_parse.cpp +++ b/src/scripting/decorate/thingdef_parse.cpp @@ -1345,6 +1345,7 @@ void ParseDecorate (FScanner &sc, PNamespace *ns) ParseDamageDefinition(sc); break; } + [[fallthrough]]; default: sc.RestorePos(pos); ParseOldDecoration(sc, DEF_Decoration, ns); diff --git a/src/scripting/zscript/zcc_compile_doom.cpp b/src/scripting/zscript/zcc_compile_doom.cpp index 8353d11f9..d428627a2 100644 --- a/src/scripting/zscript/zcc_compile_doom.cpp +++ b/src/scripting/zscript/zcc_compile_doom.cpp @@ -296,6 +296,7 @@ void ZCCDoomCompiler::DispatchProperty(FPropertyInfo *prop, ZCC_PropertyStmt *pr case 'C': // this parser accepts colors only in string form. pref.i = 1; + [[fallthrough]]; case 'S': case 'T': // a filtered string (ZScript only parses filtered strings so there's nothing to do here.) conv.s = GetStringConst(ex, ctx); diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index 0fcc05b7c..58f8a349a 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -461,6 +461,7 @@ bool DInterBackground::LoadBackground(bool isenterpic) an.LevelName = sc.String; sc.MustGetString(); caseval = sc.MustMatchString(WI_Cmd); + [[fallthrough]]; default: switch (caseval)