- 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=]
This commit is contained in:
alexey.lysiuk 2020-10-31 13:22:13 +02:00
parent 112640e6c0
commit b8b93e0dd8
19 changed files with 29 additions and 2 deletions

View file

@ -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

View file

@ -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())

View file

@ -523,6 +523,7 @@ ZCCCompiler::ZCCCompiler(ZCC_AST &ast, DObject *_outer, PSymbolTable &_symbols,
ProcessStruct(static_cast<ZCC_Struct*>(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");

View file

@ -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;

View file

@ -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;

View file

@ -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 ();

View file

@ -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;

View file

@ -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;

View file

@ -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)

View file

@ -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

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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:

View file

@ -1345,6 +1345,7 @@ void ParseDecorate (FScanner &sc, PNamespace *ns)
ParseDamageDefinition(sc);
break;
}
[[fallthrough]];
default:
sc.RestorePos(pos);
ParseOldDecoration(sc, DEF_Decoration, ns);

View file

@ -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);

View file

@ -461,6 +461,7 @@ bool DInterBackground::LoadBackground(bool isenterpic)
an.LevelName = sc.String;
sc.MustGetString();
caseval = sc.MustMatchString(WI_Cmd);
[[fallthrough]];
default:
switch (caseval)