Misc: Use [[fallthrough]] attribute instead of comment to mark intentional fallthroughs

This commit is contained in:
Peter Keresztes Schmidt
2020-07-18 22:43:24 +02:00
committed by Ovahlord
parent cbb0fe41de
commit a06e5d7d40
14 changed files with 21 additions and 21 deletions

View File

@@ -185,7 +185,7 @@ void AppenderConsole::_write(LogMessage const* message)
index = 0;
break;
case LOG_LEVEL_ERROR:
/* fallthrough */
[[fallthrough]];
default:
index = 1;
break;

View File

@@ -521,8 +521,8 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo, uint8 attempts /*= 5*/)
mysql_close(m_Mysql);
m_Mysql = nullptr;
}
[[fallthrough]];
}
/* fallthrough */
case CR_CONN_HOST_ERROR:
{
TC_LOG_INFO("sql.sql", "Attempting to reconnect to the MySQL server...");

View File

@@ -306,7 +306,7 @@ UpdateResult UpdateFetcher::Update(bool const redundancyChecks,
{
case MODE_APPLY:
speed = Apply(availableQuery.first);
/* fallthrough */
[[fallthrough]];
case MODE_REHASH:
UpdateEntry(file, speed);
break;

View File

@@ -1196,7 +1196,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invoker cast action, but event does not provide any invoker!", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
return false;
}
/* fallthrough */
[[fallthrough]];
case SMART_ACTION_SELF_CAST:
case SMART_ACTION_ADD_AURA:
if (!IsSpellValid(e, e.action.cast.spell))

View File

@@ -204,7 +204,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
case AV_QUEST_A_BOSS1:
case AV_QUEST_H_BOSS1:
m_Team_QuestStatus[team][4] += 9; //you can turn in 10 or 1 item..
/* fallthrough */
[[fallthrough]];
case AV_QUEST_A_BOSS2:
case AV_QUEST_H_BOSS2:
m_Team_QuestStatus[team][4]++;

View File

@@ -747,11 +747,11 @@ bool BattlegroundSA::CanInteractWithObject(uint32 objectId)
case BG_SA_TITAN_RELIC:
if (GateStatus[BG_SA_ANCIENT_GATE] != BG_SA_GATE_DESTROYED || GateStatus[BG_SA_YELLOW_GATE] != BG_SA_GATE_DESTROYED)
return false;
/* fallthrough */
[[fallthrough]];
case BG_SA_CENTRAL_FLAG:
if (GateStatus[BG_SA_RED_GATE] != BG_SA_GATE_DESTROYED && GateStatus[BG_SA_PURPLE_GATE] != BG_SA_GATE_DESTROYED)
return false;
/* fallthrough */
[[fallthrough]];
case BG_SA_LEFT_FLAG:
case BG_SA_RIGHT_FLAG:
if (GateStatus[BG_SA_GREEN_GATE] != BG_SA_GATE_DESTROYED && GateStatus[BG_SA_BLUE_GATE] != BG_SA_GATE_DESTROYED)

View File

@@ -2018,7 +2018,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const
TC_LOG_ERROR("sql.sql", "%s has invalid state mask (%u), skipped.", cond->ToString(true).c_str(), cond->ConditionValue2);
return false;
}
/* fallthrough */
[[fallthrough]];
case CONDITION_QUESTREWARDED:
case CONDITION_QUESTTAKEN:
case CONDITION_QUEST_NONE:

View File

@@ -40,11 +40,11 @@ void LfgGroupData::SetState(LfgState state)
case LFG_STATE_NONE:
m_Dungeon = 0;
m_KicksLeft = LFG_GROUP_MAX_KICKS;
/* fallthrough */
[[fallthrough]];
case LFG_STATE_FINISHED_DUNGEON:
case LFG_STATE_DUNGEON:
m_OldState = state;
/* fallthrough */
[[fallthrough]];
default:
m_State = state;
}

View File

@@ -40,10 +40,10 @@ void LfgPlayerData::SetState(LfgState state)
m_Roles = 0;
m_SelectedDungeons.clear();
m_Comment.clear();
/* fallthrough */
[[fallthrough]];
case LFG_STATE_DUNGEON:
m_OldState = state;
/* fallthrough */
[[fallthrough]];
default:
m_State = state;
}

View File

@@ -440,7 +440,7 @@ void GameObject::Update(uint32 diff)
break;
}
}
/* fallthrough */
[[fallthrough]];
case GO_READY:
{
if (m_respawnCompatibilityMode)

View File

@@ -293,7 +293,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
case REACT_PASSIVE: //passive
pet->AttackStop();
pet->ClearInPetCombat();
/* fallthrough */
[[fallthrough]];
case REACT_DEFENSIVE: //recovery
case REACT_AGGRESSIVE: //activete
case REACT_ASSIST:

View File

@@ -2337,7 +2337,7 @@ void UnitAura::FillTargetMap(std::unordered_map<Unit*, uint8>& targets, Unit* ca
case SPELL_EFFECT_APPLY_AREA_AURA_PET:
if (!condList || sConditionMgr->IsObjectMeetToConditions(GetUnitOwner(), ref, *condList))
units.push_back(GetUnitOwner());
/* fallthrough */
[[fallthrough]];
case SPELL_EFFECT_APPLY_AREA_AURA_OWNER:
{
if (Unit* owner = GetUnitOwner()->GetCharmerOrOwner())

View File

@@ -3324,7 +3324,7 @@ void Spell::cancel(Spell* interruptingSpell /* = nullptr */)
{
case SPELL_STATE_PREPARING:
CancelGlobalCooldown();
/* fallthrough */
[[fallthrough]];
case SPELL_STATE_DELAYED:
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
@@ -6908,7 +6908,7 @@ SpellCastResult Spell::CheckItems(uint32* param1 /*= nullptr*/, uint32* param2 /
return SPELL_FAILED_DONT_REPORT;
}
}
/* fallthrough */
[[fallthrough]];
case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
{
Item* targetItem = m_targets.GetItemTarget();
@@ -8248,7 +8248,7 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target)
case TARGET_CHECK_RAID_CLASS:
if (_referer->getClass() != unitTarget->getClass())
return false;
/* fallthrough */
[[fallthrough]];
case TARGET_CHECK_RAID:
if (unitTarget->IsTotem())
return false;

View File

@@ -184,7 +184,7 @@ uint32 SpellImplicitTargetInfo::GetExplicitTargetMask(bool& srcSet, bool& dstSet
targetMask = TARGET_FLAG_UNIT_PASSENGER;
break;
case TARGET_CHECK_RAID_CLASS:
/* fallthrough */
[[fallthrough]];
default:
targetMask = TARGET_FLAG_UNIT;
break;
@@ -2401,7 +2401,7 @@ void SpellInfo::_LoadSpellSpecific()
/// @workaround For non-stacking tracking spells (We need generic solution)
if (Id == 30645) // Gas Cloud Tracking
return SPELL_SPECIFIC_NORMAL;
/* fallthrough */
[[fallthrough]];
case SPELL_AURA_TRACK_RESOURCES:
case SPELL_AURA_TRACK_STEALTHED:
return SPELL_SPECIFIC_TRACKER;
@@ -2794,7 +2794,7 @@ void SpellInfo::_LoadImmunityInfo()
immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
/* fallthrough */
[[fallthrough]];
case 61869: // Overload
case 63481:
case 61887: // Lightning Tendrils