From a06e5d7d40c436c429d6a06b3eb684b0133d5b71 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Sat, 18 Jul 2020 22:43:24 +0200 Subject: [PATCH] Misc: Use [[fallthrough]] attribute instead of comment to mark intentional fallthroughs --- src/common/Logging/AppenderConsole.cpp | 2 +- src/server/database/Database/MySQLConnection.cpp | 2 +- src/server/database/Updater/UpdateFetcher.cpp | 2 +- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 2 +- src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp | 2 +- src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp | 4 ++-- src/server/game/Conditions/ConditionMgr.cpp | 2 +- src/server/game/DungeonFinding/LFGGroupData.cpp | 4 ++-- src/server/game/DungeonFinding/LFGPlayerData.cpp | 4 ++-- src/server/game/Entities/GameObject/GameObject.cpp | 2 +- src/server/game/Handlers/PetHandler.cpp | 2 +- src/server/game/Spells/Auras/SpellAuras.cpp | 2 +- src/server/game/Spells/Spell.cpp | 6 +++--- src/server/game/Spells/SpellInfo.cpp | 6 +++--- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/common/Logging/AppenderConsole.cpp b/src/common/Logging/AppenderConsole.cpp index bffb76438e4..ae5660e96e8 100644 --- a/src/common/Logging/AppenderConsole.cpp +++ b/src/common/Logging/AppenderConsole.cpp @@ -185,7 +185,7 @@ void AppenderConsole::_write(LogMessage const* message) index = 0; break; case LOG_LEVEL_ERROR: - /* fallthrough */ + [[fallthrough]]; default: index = 1; break; diff --git a/src/server/database/Database/MySQLConnection.cpp b/src/server/database/Database/MySQLConnection.cpp index 67c7b4b97a4..0b5503338c4 100644 --- a/src/server/database/Database/MySQLConnection.cpp +++ b/src/server/database/Database/MySQLConnection.cpp @@ -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..."); diff --git a/src/server/database/Updater/UpdateFetcher.cpp b/src/server/database/Updater/UpdateFetcher.cpp index 8a35ae7d571..6e9ecfc1463 100644 --- a/src/server/database/Updater/UpdateFetcher.cpp +++ b/src/server/database/Updater/UpdateFetcher.cpp @@ -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; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index ab271f04045..3308b892b80 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -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)) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index e80e7169228..b7acb88b9d2 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -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]++; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 414ed20147d..441ac41c383 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -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) diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index ed6d30f7812..a5ba5f0955f 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -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: diff --git a/src/server/game/DungeonFinding/LFGGroupData.cpp b/src/server/game/DungeonFinding/LFGGroupData.cpp index b1386a43c80..181ce3e081a 100644 --- a/src/server/game/DungeonFinding/LFGGroupData.cpp +++ b/src/server/game/DungeonFinding/LFGGroupData.cpp @@ -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; } diff --git a/src/server/game/DungeonFinding/LFGPlayerData.cpp b/src/server/game/DungeonFinding/LFGPlayerData.cpp index f4a85760a85..fa838dc78a9 100644 --- a/src/server/game/DungeonFinding/LFGPlayerData.cpp +++ b/src/server/game/DungeonFinding/LFGPlayerData.cpp @@ -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; } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 963df83fd9b..edb88919ee0 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -440,7 +440,7 @@ void GameObject::Update(uint32 diff) break; } } - /* fallthrough */ + [[fallthrough]]; case GO_READY: { if (m_respawnCompatibilityMode) diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 71eb077a5b5..dca2f8a3f56 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -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: diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 1b484a89e39..09b8cd782d7 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -2337,7 +2337,7 @@ void UnitAura::FillTargetMap(std::unordered_map& 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()) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 261420fab24..38b686faabc 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -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; diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 883f9908c2f..9b867fee0d7 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -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