diff options
author | smatz <smatz@openttd.org> | 2008-06-01 15:08:14 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-06-01 15:08:14 +0000 |
commit | 69ebefe1aced0abd8885d4a30fa0387c0cafd5cc (patch) | |
tree | a69876051417b114e25b34280ada013d1522cee1 | |
parent | 462384651566943a1d14f49ab988ae6af439c94c (diff) | |
download | openttd-69ebefe1aced0abd8885d4a30fa0387c0cafd5cc.tar.xz |
(svn r13351) -Codechange: disable warnings about unused variable for builds without asserts
-rw-r--r-- | config.lib | 4 | ||||
-rw-r--r-- | src/blitter/factory.hpp | 7 | ||||
-rw-r--r-- | src/driver.cpp | 6 | ||||
-rw-r--r-- | src/gfxinit.cpp | 4 | ||||
-rw-r--r-- | src/newgrf_engine.cpp | 12 | ||||
-rw-r--r-- | src/town_cmd.cpp | 6 |
6 files changed, 12 insertions, 27 deletions
diff --git a/config.lib b/config.lib index 741c399f5..81a80fce9 100644 --- a/config.lib +++ b/config.lib @@ -936,6 +936,10 @@ make_cflags_and_ldflags() { if [ $cc_version -ge 30 ]; then CFLAGS="$CFLAGS -W -Wno-unused-parameter -Wformat=2" CFLAGS="$CFLAGS -Wredundant-decls" + # Do not warn about unused variables when building without asserts + if [ $enable_assert -eq 0 ]; then + CFLAGS="$CFLAGS -Wno-unused-variable" + fi fi if [ $cc_version -ge 34 ]; then diff --git a/src/blitter/factory.hpp b/src/blitter/factory.hpp index bd0a6daa8..f9dd9c463 100644 --- a/src/blitter/factory.hpp +++ b/src/blitter/factory.hpp @@ -43,11 +43,8 @@ protected: if (name == NULL) return; this->name = strdup(name); -#if !defined(NDEBUG) || defined(WITH_ASSERT) - /* NDEBUG disables asserts and gives a warning: unused variable 'P' */ - std::pair<Blitters::iterator, bool> P = -#endif /* !NDEBUG */ - GetBlitters().insert(Blitters::value_type(name, this)); + + std::pair<Blitters::iterator, bool> P = GetBlitters().insert(Blitters::value_type(name, this)); assert(P.second); } diff --git a/src/driver.cpp b/src/driver.cpp index a71f21cc7..202b84fab 100644 --- a/src/driver.cpp +++ b/src/driver.cpp @@ -156,11 +156,7 @@ void DriverFactoryBase::RegisterDriver(const char *name, Driver::Type type, int strecpy(buf, GetDriverTypeName(type), lastof(buf)); strecpy(buf + 5, name, lastof(buf)); -#if !defined(NDEBUG) || defined(WITH_ASSERT) - /* NDEBUG disables asserts and gives a warning: unused variable 'P' */ - std::pair<Drivers::iterator, bool> P = -#endif /* !NDEBUG */ - GetDrivers().insert(Drivers::value_type(buf, this)); + std::pair<Drivers::iterator, bool> P = GetDrivers().insert(Drivers::value_type(buf, this)); assert(P.second); } diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index fe79abf77..8b04b1517 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -71,12 +71,8 @@ void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_t uint end = *index_tbl++; do { - #ifdef NDEBUG - LoadNextSprite(start, file_index, *sprite_id); - #else bool b = LoadNextSprite(start, file_index, *sprite_id); assert(b); - #endif (*sprite_id)++; } while (++start <= end); } diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 039c2a186..e0355d3d4 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -886,23 +886,19 @@ SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle *v, Direction dire SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle *v, bool info_view) { - #if !defined(NDEBUG) || defined(WITH_ASSERT) const Engine *e = GetEngine(engine); - #endif /* !defined(NDEBUG) || defined(WITH_ASSERT) */ - - const SpriteGroup *group; - ResolverObject object; - - assert(e->type == VEH_AIRCRAFT); /* Only valid for helicopters */ + assert(e->type == VEH_AIRCRAFT); assert(!(e->u.air.subtype & AIR_CTOL)); + ResolverObject object; + NewVehicleResolver(&object, engine, v); object.info_view = info_view; - group = GetWagonOverrideSpriteSet(engine, CT_DEFAULT, engine); + const SpriteGroup *group = GetWagonOverrideSpriteSet(engine, CT_DEFAULT, engine); group = Resolve(group, &object); if (group == NULL || group->type != SGT_RESULT) return 0; diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index a8b6d9135..c3dc04842 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1639,11 +1639,7 @@ HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile) */ static inline void ClearMakeHouseTile(TileIndex tile, TownID tid, byte counter, byte stage, HouseID type, byte random_bits) { - #if !defined(NDEBUG) || defined(WITH_ASSERT) - CommandCost cc = - #endif /* !defined(NDEBUG) || defined(WITH_ASSERT) */ - - DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR); + CommandCost cc = DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR); assert(CmdSucceeded(cc)); |