mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Renamed UNUSED -> MAYBE_UNUSED macro to match c++17 attribute name
This commit is contained in:
parent
3219e322ae
commit
fb6b3c31e8
17
Global.h
17
Global.h
@ -80,13 +80,13 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
|
||||
# endif
|
||||
#else
|
||||
# error "VCMI supports only Windows, OSX, Linux and Android targets"
|
||||
#endif
|
||||
|
||||
// Each compiler uses own way to supress fall through warning. Try to find it.
|
||||
// TODO: replace with c++17 [[fallthrough]]
|
||||
#ifdef __has_cpp_attribute
|
||||
# if __has_cpp_attribute(fallthrough)
|
||||
# define FALLTHROUGH [[fallthrough]];
|
||||
#endif
|
||||
|
||||
// Each compiler uses own way to supress fall through warning. Try to find it.
|
||||
// TODO: replace with c++17 [[fallthrough]]
|
||||
#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)
|
||||
@ -263,7 +263,8 @@ template<typename T, size_t N> char (&_ArrayCountObj(const T (&)[N]))[N];
|
||||
#define ARRAY_COUNT(arr) (sizeof(_ArrayCountObj(arr)))
|
||||
|
||||
// should be used for variables that becomes unused in release builds (e.g. only used for assert checks)
|
||||
#define UNUSED(VAR) ((void)VAR)
|
||||
// TODO: replace with c++17 [[maybe_unused]]
|
||||
#define MAYBE_UNUSED(VAR) ((void)VAR)
|
||||
|
||||
// old iOS SDKs compatibility
|
||||
#ifdef VCMI_IOS
|
||||
|
@ -78,7 +78,7 @@ void CHeroSwitcher::clickLeft(tribool down, bool previousState)
|
||||
#if 0
|
||||
owner->update(hero, true);
|
||||
#else
|
||||
UNUSED(owner);
|
||||
MAYBE_UNUSED(owner);
|
||||
const CGHeroInstance * buf = hero;
|
||||
GH.popInts(1);
|
||||
GH.pushIntT<CHeroWindow>(buf);
|
||||
|
@ -507,7 +507,7 @@ void CCreatureSet::joinStack(SlotID slot, CStackInstance * stack)
|
||||
const CCreature *c = getCreature(slot);
|
||||
assert(c == stack->type);
|
||||
assert(c);
|
||||
UNUSED(c);
|
||||
MAYBE_UNUSED(c);
|
||||
|
||||
//TODO move stuff
|
||||
changeStackCount(slot, stack->count);
|
||||
|
@ -1768,7 +1768,7 @@ void CGameState::initTowns()
|
||||
for(auto building : vti->builtBuildings)
|
||||
{
|
||||
assert(vti->town->buildings.at(building) != nullptr);
|
||||
UNUSED(building);
|
||||
MAYBE_UNUSED(building);
|
||||
}
|
||||
|
||||
//town events
|
||||
|
@ -307,7 +307,7 @@ std::vector<BattleHex> CStack::meleeAttackHexes(const battle::Unit * attacker, c
|
||||
res.push_back(otherDefenderPos);
|
||||
}
|
||||
}
|
||||
UNUSED(mask);
|
||||
MAYBE_UNUSED(mask);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ DLL_LINKAGE void NewObject::applyGs(CGameState *gs)
|
||||
|
||||
const int3 previousXAxisTile = int3(pos.x - 1, pos.y, pos.z);
|
||||
assert(gs->isInTheMap(previousXAxisTile) && (testObject.visitablePos() == previousXAxisTile));
|
||||
UNUSED(previousXAxisTile);
|
||||
MAYBE_UNUSED(previousXAxisTile);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -957,7 +957,7 @@ DLL_LINKAGE void RebalanceStacks::applyGs(CGameState * gs)
|
||||
if(const CCreature *c = dst.army->getCreature(dst.slot)) //stack at dest -> merge
|
||||
{
|
||||
assert(c == srcType);
|
||||
UNUSED(c);
|
||||
MAYBE_UNUSED(c);
|
||||
auto alHere = ArtifactLocation (src.getStack(), ArtifactPosition::CREATURE_SLOT);
|
||||
auto alDest = ArtifactLocation (dst.getStack(), ArtifactPosition::CREATURE_SLOT);
|
||||
auto artHere = alHere.getArt();
|
||||
@ -1008,7 +1008,7 @@ DLL_LINKAGE void RebalanceStacks::applyGs(CGameState * gs)
|
||||
if(const CCreature *c = dst.army->getCreature(dst.slot)) //stack at dest -> rebalance
|
||||
{
|
||||
assert(c == srcType);
|
||||
UNUSED(c);
|
||||
MAYBE_UNUSED(c);
|
||||
if (stackExp)
|
||||
{
|
||||
ui64 totalExp = srcCount * src.army->getStackExperience(src.slot) + dst.army->getStackCount(dst.slot) * dst.army->getStackExperience(dst.slot);
|
||||
@ -1177,7 +1177,7 @@ DLL_LINKAGE void AssembledArtifact::applyGs(CGameState *gs)
|
||||
assert(transformedArt);
|
||||
bool combineEquipped = !ArtifactUtils::isSlotBackpack(al.slot);
|
||||
assert(vstd::contains(transformedArt->assemblyPossibilities(artSet, combineEquipped), builtArt));
|
||||
UNUSED(transformedArt);
|
||||
MAYBE_UNUSED(transformedArt);
|
||||
|
||||
auto combinedArt = new CCombinedArtifactInstance(builtArt);
|
||||
gs->map->addNewArtifactInstance(combinedArt);
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
seek(0);
|
||||
auto readSize = read(data.get(), getSize());
|
||||
assert(readSize == getSize());
|
||||
UNUSED(readSize);
|
||||
MAYBE_UNUSED(readSize);
|
||||
|
||||
return std::make_pair(std::move(data), getSize());
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ void WaterProxy::process()
|
||||
//check terrain type
|
||||
for(auto & t : zone.area().getTilesVector())
|
||||
{
|
||||
MAYBE_UNUSED(t);
|
||||
assert(map.isOnMap(t));
|
||||
assert(map.map().getTile(t).terType->id == zone.getTerrainType());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user