mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Merge pull request #411 from drizt/fallthrough
Hide "this statement may fall through" warnings
This commit is contained in:
commit
e11e69750a
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."
|
||||
#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 */
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
|
@ -2090,6 +2090,7 @@ void CGameState::updateRumor()
|
||||
}
|
||||
else
|
||||
rumor.type = RumorState::TYPE_RAND;
|
||||
FALLTHROUGH
|
||||
|
||||
case RumorState::TYPE_RAND:
|
||||
do
|
||||
|
@ -527,6 +527,7 @@ CGPathNode::ENodeAction CPathfinder::getDestAction() const
|
||||
}
|
||||
|
||||
/// don't break - next case shared for both land and sail layers
|
||||
FALLTHROUGH
|
||||
|
||||
case ELayer::SAIL:
|
||||
if(isDestVisitableObj())
|
||||
|
@ -462,18 +462,22 @@ BattleInfo * BattleInfo::setupBattle(int3 tile, ETerrainType terrain, BFieldType
|
||||
{
|
||||
bonusSubtype = 0;
|
||||
}
|
||||
FALLTHROUGH
|
||||
case BFieldType::FIERY_FIELDS:
|
||||
{
|
||||
if(bonusSubtype == -1) bonusSubtype = 1;
|
||||
}
|
||||
FALLTHROUGH
|
||||
case BFieldType::ROCKLANDS:
|
||||
{
|
||||
if(bonusSubtype == -1) bonusSubtype = 8;
|
||||
}
|
||||
FALLTHROUGH
|
||||
case BFieldType::MAGIC_CLOUDS:
|
||||
{
|
||||
if(bonusSubtype == -1) bonusSubtype = 2;
|
||||
}
|
||||
FALLTHROUGH
|
||||
case BFieldType::LUCID_POOLS:
|
||||
{
|
||||
if(bonusSubtype == -1) bonusSubtype = 4;
|
||||
|
@ -754,7 +754,7 @@ void CGTownInstance::initObj(CRandomGenerator & rand)
|
||||
break;
|
||||
case ETownType::DUNGEON:
|
||||
bonusingBuildings.push_back (new COPWBonus(BuildingID::MANA_VORTEX, this));
|
||||
//fallthrough
|
||||
FALLTHROUGH
|
||||
case ETownType::TOWER: case ETownType::INFERNO: case ETownType::STRONGHOLD:
|
||||
bonusingBuildings.push_back (new CTownBonus(BuildingID::SPECIAL_4, this));
|
||||
break;
|
||||
|
@ -4130,6 +4130,7 @@ bool CGameHandler::makeBattleAction(BattleAction &ba)
|
||||
|
||||
//don't break - we share code with next case
|
||||
}
|
||||
FALLTHROUGH
|
||||
case EActionType::WAIT:
|
||||
{
|
||||
auto wrapper = wrapAction(ba);
|
||||
|
Loading…
Reference in New Issue
Block a user