mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Hide "this statement may fall through" warnings
This commit is contained in:
parent
35b01eb379
commit
eea50a044c
15
Global.h
15
Global.h
@ -86,6 +86,21 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
|
|||||||
# error "iOS system isn't yet supported."
|
# error "iOS system isn't yet supported."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Each compiler uses own way to supress fall through warning. Try to find it.
|
||||||
|
#ifdef __has_cpp_attribute
|
||||||
|
# if __has_cpp_attribute(fallthrough)
|
||||||
|
# define FALLTHROUGH [[fallthrough]];
|
||||||
|
# elif __has_cpp_attribute(gnu::fallthrough)
|
||||||
|
# define FALLTHROUGH [[gnu::fallthrough]];
|
||||||
|
# elif __has_cpp_attribute(clang::fallthrough)
|
||||||
|
# define FALLTHROUGH [[clang::fallthrough]];
|
||||||
|
# else
|
||||||
|
# define FALLTHROUGH
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define FALLTHROUGH
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------- */
|
||||||
/* Commonly used C++, Boost headers */
|
/* Commonly used C++, Boost headers */
|
||||||
/* ---------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------- */
|
||||||
|
@ -2090,6 +2090,7 @@ void CGameState::updateRumor()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
rumor.type = RumorState::TYPE_RAND;
|
rumor.type = RumorState::TYPE_RAND;
|
||||||
|
FALLTHROUGH
|
||||||
|
|
||||||
case RumorState::TYPE_RAND:
|
case RumorState::TYPE_RAND:
|
||||||
do
|
do
|
||||||
|
@ -527,6 +527,7 @@ CGPathNode::ENodeAction CPathfinder::getDestAction() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// don't break - next case shared for both land and sail layers
|
/// don't break - next case shared for both land and sail layers
|
||||||
|
FALLTHROUGH
|
||||||
|
|
||||||
case ELayer::SAIL:
|
case ELayer::SAIL:
|
||||||
if(isDestVisitableObj())
|
if(isDestVisitableObj())
|
||||||
|
@ -462,18 +462,22 @@ BattleInfo * BattleInfo::setupBattle(int3 tile, ETerrainType terrain, BFieldType
|
|||||||
{
|
{
|
||||||
bonusSubtype = 0;
|
bonusSubtype = 0;
|
||||||
}
|
}
|
||||||
|
FALLTHROUGH
|
||||||
case BFieldType::FIERY_FIELDS:
|
case BFieldType::FIERY_FIELDS:
|
||||||
{
|
{
|
||||||
if(bonusSubtype == -1) bonusSubtype = 1;
|
if(bonusSubtype == -1) bonusSubtype = 1;
|
||||||
}
|
}
|
||||||
|
FALLTHROUGH
|
||||||
case BFieldType::ROCKLANDS:
|
case BFieldType::ROCKLANDS:
|
||||||
{
|
{
|
||||||
if(bonusSubtype == -1) bonusSubtype = 8;
|
if(bonusSubtype == -1) bonusSubtype = 8;
|
||||||
}
|
}
|
||||||
|
FALLTHROUGH
|
||||||
case BFieldType::MAGIC_CLOUDS:
|
case BFieldType::MAGIC_CLOUDS:
|
||||||
{
|
{
|
||||||
if(bonusSubtype == -1) bonusSubtype = 2;
|
if(bonusSubtype == -1) bonusSubtype = 2;
|
||||||
}
|
}
|
||||||
|
FALLTHROUGH
|
||||||
case BFieldType::LUCID_POOLS:
|
case BFieldType::LUCID_POOLS:
|
||||||
{
|
{
|
||||||
if(bonusSubtype == -1) bonusSubtype = 4;
|
if(bonusSubtype == -1) bonusSubtype = 4;
|
||||||
|
@ -754,7 +754,7 @@ void CGTownInstance::initObj(CRandomGenerator & rand)
|
|||||||
break;
|
break;
|
||||||
case ETownType::DUNGEON:
|
case ETownType::DUNGEON:
|
||||||
bonusingBuildings.push_back (new COPWBonus(BuildingID::MANA_VORTEX, this));
|
bonusingBuildings.push_back (new COPWBonus(BuildingID::MANA_VORTEX, this));
|
||||||
//fallthrough
|
FALLTHROUGH
|
||||||
case ETownType::TOWER: case ETownType::INFERNO: case ETownType::STRONGHOLD:
|
case ETownType::TOWER: case ETownType::INFERNO: case ETownType::STRONGHOLD:
|
||||||
bonusingBuildings.push_back (new CTownBonus(BuildingID::SPECIAL_4, this));
|
bonusingBuildings.push_back (new CTownBonus(BuildingID::SPECIAL_4, this));
|
||||||
break;
|
break;
|
||||||
|
@ -4130,6 +4130,7 @@ bool CGameHandler::makeBattleAction(BattleAction &ba)
|
|||||||
|
|
||||||
//don't break - we share code with next case
|
//don't break - we share code with next case
|
||||||
}
|
}
|
||||||
|
FALLTHROUGH
|
||||||
case EActionType::WAIT:
|
case EActionType::WAIT:
|
||||||
{
|
{
|
||||||
auto wrapper = wrapAction(ba);
|
auto wrapper = wrapAction(ba);
|
||||||
|
Loading…
Reference in New Issue
Block a user