1
0
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:
Ivan Romanov 2018-02-09 15:02:44 +05:00
parent 35b01eb379
commit eea50a044c
6 changed files with 23 additions and 1 deletions

View File

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

View File

@ -2090,6 +2090,7 @@ void CGameState::updateRumor()
}
else
rumor.type = RumorState::TYPE_RAND;
FALLTHROUGH
case RumorState::TYPE_RAND:
do

View File

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

View File

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

View File

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

View File

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