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