From dc67e25c67c6674b32635df5c1ac03bbd163a723 Mon Sep 17 00:00:00 2001 From: nlanza Date: Sun, 13 Aug 2006 04:18:50 +0000 Subject: Add a metric ton of compiler warnings to the Xcode project, and clean up the source accordingly. At some point these warnings should be merged into the makefile system, but I don't have the will to merge them into the 3451351235 individual makefiles at the moment. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@12 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/Crawl.xcodeproj/project.pbxproj | 9 +++++++++ crawl-ref/source/defines.h | 2 +- crawl-ref/source/direct.cc | 6 +++--- crawl-ref/source/enum.h | 14 +++++++------- crawl-ref/source/externs.h | 2 +- crawl-ref/source/files.cc | 3 +-- crawl-ref/source/items.cc | 2 +- crawl-ref/source/libutil.h | 2 +- crawl-ref/source/menu.h | 4 ++-- crawl-ref/source/monplace.cc | 2 +- crawl-ref/source/mutation.cc | 6 +++--- crawl-ref/source/newgame.cc | 2 +- crawl-ref/source/spl-util.cc | 2 +- crawl-ref/source/stash.cc | 8 +++++--- crawl-ref/source/travel.cc | 7 ++++--- crawl-ref/source/travel.h | 4 ++-- 16 files changed, 43 insertions(+), 32 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/Crawl.xcodeproj/project.pbxproj b/crawl-ref/source/Crawl.xcodeproj/project.pbxproj index 7cc559cb6b..418dde20a2 100644 --- a/crawl-ref/source/Crawl.xcodeproj/project.pbxproj +++ b/crawl-ref/source/Crawl.xcodeproj/project.pbxproj @@ -687,8 +687,17 @@ GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_PEDANTIC = YES; + GCC_WARN_SHADOW = NO; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_VALUE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h index 9f61c2961b..dbb079a458 100644 --- a/crawl-ref/source/defines.h +++ b/crawl-ref/source/defines.h @@ -152,7 +152,7 @@ CHATTR_ATTRMASK = 0xF, /* 15 (well, obviously) */ - CHATTR_COLMASK = 0xF00, // Mask with this to get extra colour info. + CHATTR_COLMASK = 0xF00 // Mask with this to get extra colour info. }; //#endif diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 8ff8a9732a..911ccc8522 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -65,7 +65,7 @@ enum LOSSelect // or visible to hidden when going backwards. LOS_FLIPHV = 0x40, - LOS_NONE = 0xFFFF, + LOS_NONE = 0xFFFF }; // x and y offsets in the following order: @@ -478,7 +478,7 @@ void look_around(struct dist &moves, bool justLooking, int first_move, int mode) case '\'': case '*': { - int dir = keyin == ';' || keyin == '/'? -1 : 1; + dir = keyin == ';' || keyin == '/'? -1 : 1; if (find_square( cx, cy, objfind_pos, dir, find_object, 0, true, Options.target_los_first @@ -499,7 +499,7 @@ void look_around(struct dist &moves, bool justLooking, int first_move, int mode) case '+': case '=': { - int dir = keyin == '-'? -1 : 1; + dir = keyin == '-'? -1 : 1; if (find_square( cx, cy, monsfind_pos, dir, find_monster, mode, Options.target_wrap )) { diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 1306540f2b..55d24085e1 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -150,7 +150,7 @@ enum ACT_INTERRUPT AI_BURDEN_CHANGE = 0x80, AI_STAT_CHANGE = 0x100, AI_SEE_MONSTER = 0x200, - AI_TELEPORT = 0x400, + AI_TELEPORT = 0x400 }; enum AI_PAYLOAD @@ -159,7 +159,7 @@ enum AI_PAYLOAD AIP_INT, AIP_STRING, AIP_MONSTER, - AIP_HP_LOSS, + AIP_HP_LOSS }; enum AMMUNITION_DESCRIPTIONS @@ -181,7 +181,7 @@ enum AQ_AGENTS AQ_CARD_PROTECTION, AQ_CARD_KNOWLEDGE, - AQ_WIZMODE = 200, + AQ_WIZMODE = 200 }; enum ARMOUR @@ -605,7 +605,7 @@ enum COMMANDS CMD_INTERLEVEL_TRAVEL, CMD_FIX_WAYPOINT, - CMD_CLEAR_MAP, + CMD_CLEAR_MAP }; enum CONFIRM_LEVEL @@ -2247,7 +2247,7 @@ enum OBJECT_CLASSES // (unsigned char) mitm[].base_type enum OBJECT_SELECTORS { OSEL_ANY = -1, - OSEL_WIELD = -2, + OSEL_WIELD = -2 }; enum ORBS @@ -2510,7 +2510,7 @@ enum SPECIAL_MISSILES // to separate from weapons in general {dlb} SPMSL_FLAME, // 1 SPMSL_ICE, // 2 SPMSL_POISONED, // 3 - from poison_ammo() enchantment {dlb} - SPMSL_POISONED_II, // 4 + SPMSL_POISONED_II // 4 }; enum SPECIAL_ROOMS @@ -2862,7 +2862,7 @@ enum SPELL_TYPES //jmf: 24jul2000: changed from integer-list to bitfield enum SLOT_SELECT_MODES { SS_FORWARD = 0, - SS_BACKWARD = 1, + SS_BACKWARD = 1 }; enum STATS diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 91b66e5f47..0a3a423b7c 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -605,7 +605,7 @@ private: { FSOP_COLOUR, FSOP_CURSOR, - FSOP_TEXT, + FSOP_TEXT }; struct fs_op diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 0fdd4ff381..367fe30ec4 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -390,7 +390,6 @@ void load( unsigned char stair_taken, int load_mode, bool was_a_labyrinth, you.prev_targ = MHITNOT; int following = -1; - int fmenv = 0; // not used again until after found_stair label {dlb} int minvc = 0; // Don't delete clouds just because the player saved and restarted. @@ -749,7 +748,7 @@ found_stair: grd[you.x_pos][you.y_pos] = DNGN_FLOOR; */ following = 0; - fmenv = -1; + int fmenv = -1; // actually "move" the followers if applicable if ((you.level_type == LEVEL_DUNGEON diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 357fc5f120..5949668139 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1837,7 +1837,7 @@ static std::string drop_selitem_text( const std::vector *s ) } } - snprintf( buf, sizeof buf, " (%u%s turn%s)", s->size(), + snprintf( buf, sizeof buf, " (%lu%s turn%s)", (unsigned long) (s->size()), extraturns? "+" : "", s->size() > 1? "s" : "" ); return buf; diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h index bc05362604..807d3f25a2 100644 --- a/crawl-ref/source/libutil.h +++ b/crawl-ref/source/libutil.h @@ -94,7 +94,7 @@ enum KEYS CK_CTRL_CLEAR, CK_CTRL_PGUP, - CK_CTRL_PGDN, + CK_CTRL_PGDN }; class base_pattern diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h index 4f1915fe31..05e4796383 100755 --- a/crawl-ref/source/menu.h +++ b/crawl-ref/source/menu.h @@ -126,7 +126,7 @@ enum MenuFlag // closes the menu. MF_SELECT_ANY_PAGE = 16, // Allow selections to occur on any page. - MF_EASY_EXIT = 64, + MF_EASY_EXIT = 64 }; /////////////////////////////////////////////////////////////////////// @@ -142,7 +142,7 @@ public: Menu( int flags = MF_MULTISELECT ); virtual ~Menu(); - void set_flags( int flags ) { this->flags = flags; } + void set_flags( int new_flags ) { this->flags = new_flags; } int get_flags() const { return flags; } bool is_set( int flag ) const; diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index d3112debc9..eeab5c61d7 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -118,7 +118,7 @@ bool place_monster(int &id, int mon_type, int power, char behaviour, for (i = 0; i < 10000; i++) { - int count = 0; + count = 0; do { diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 9e41a400cd..027a810432 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -1438,7 +1438,7 @@ bool mutate(int which_mutation, bool failMsg) { FixedVector < char, 8 > removed; - for (int i = EQ_WEAPON; i < EQ_RIGHT_RING; i++) + for (i = EQ_WEAPON; i < EQ_RIGHT_RING; i++) { removed[i] = 0; } @@ -1456,7 +1456,7 @@ bool mutate(int which_mutation, bool failMsg) { FixedVector < char, 8 > removed; - for (int i = EQ_WEAPON; i < EQ_RIGHT_RING; i++) + for (i = EQ_WEAPON; i < EQ_RIGHT_RING; i++) { removed[i] = 0; } @@ -1478,7 +1478,7 @@ bool mutate(int which_mutation, bool failMsg) FixedVector < char, 8 > removed; - for (int i = EQ_WEAPON; i < EQ_RIGHT_RING; i++) + for (i = EQ_WEAPON; i < EQ_RIGHT_RING; i++) { removed[i] = 0; } diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 6316209b4a..eca23d3815 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -3206,7 +3206,7 @@ job_query: int job_count = 0; int job = -1; - for (int i = 0; i < NUM_JOBS; i++) + for (i = 0; i < NUM_JOBS; i++) { if (!you.species || class_allowed(you.species, i)) { diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index fa6e2d5885..58a9ecb2fe 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -74,7 +74,7 @@ void init_playerspells(void) } return; // return value should not matter here {dlb} -}; // end init_playerspells() +} // end init_playerspells() int get_spell_slot_by_letter( char letter ) { diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index c82dc2d408..0c7dfe6e34 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -412,7 +412,7 @@ std::string Stash::description() const if (sz > 1) { char additionals[50]; - snprintf(additionals, sizeof additionals, " (+%u)", sz - 1); + snprintf(additionals, sizeof additionals, " (+%lu)", (unsigned long) (sz - 1)); desc += additionals; } return (desc); @@ -467,6 +467,8 @@ void Stash::write(std::ostream &os, bool identify) const { + int i; + if (!enabled || (items.size() == 0 && verified)) return; os << "(" << ((int) x - refx) << ", " << ((int) y - refy) << (place.length()? ", " + place : "") @@ -474,7 +476,7 @@ void Stash::write(std::ostream &os, << std::endl; char buf[ITEMNAME_SIZE]; - for (unsigned i = 0; i < items.size(); ++i) + for (i = 0; i < (int) items.size(); ++i) { item_def item = items[i]; @@ -510,7 +512,7 @@ void Stash::write(std::ostream &os, if (desc.length()) { // Walk backwards and prepend indenting spaces to \n characters - for (int i = desc.length() - 1; i >= 0; --i) + for (i = desc.length() - 1; i >= 0; --i) if (desc[i] == '\n') desc.insert(i + 1, " "); os << " " << desc << std::endl; diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index d65a852b9c..f9c3d2d3d7 100755 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -40,7 +40,7 @@ enum IntertravelDestination ID_REPEAT = -101, // Cancel interlevel travel - ID_CANCEL = -1000, + ID_CANCEL = -1000 }; TravelCache travel_cache; @@ -899,6 +899,7 @@ void find_travel_pos(int youx, int youy, int start_x = you.run_x, start_y = you.run_y; int dest_x = youx, dest_y = youy; bool floodout = false; + unsigned char feature; #ifdef STASH_TRACKING LevelStashes *lev = features? stashes.find_current_level() : NULL; #endif @@ -978,7 +979,7 @@ void find_travel_pos(int youx, int youy, // (x,y) is a known (explored) location - we never put unknown // points in the circumference vector, so we don't need to examine // the map array, just the grid array. - unsigned char feature = grd[x][y]; + feature = grd[x][y]; // If this is a feature that'll take time to travel past, we // simulate that extra turn by taking this feature next turn, @@ -1077,7 +1078,7 @@ void find_travel_pos(int youx, int youy, point_distance[dx][dy] = PD_EXCLUDED_RADIUS; } - unsigned char feature = grd[dx][dy]; + feature = grd[dx][dy]; if (features && !ignore_hostile && ((feature != DNGN_FLOOR && feature != DNGN_SHALLOW_WATER diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h index e48a148a8c..30327bd46a 100644 --- a/crawl-ref/source/travel.h +++ b/crawl-ref/source/travel.h @@ -114,7 +114,7 @@ enum RUN_MODES { RUN_TRAVEL = -1, // Classic or Plain Old travel RUN_EXPLORE = -2, // Exploring (Ctrl+O) - RUN_INTERLEVEL = -3, // Interlevel travel (Ctrl+G) + RUN_INTERLEVEL = -3 // Interlevel travel (Ctrl+G) }; enum EXPLORE_STOP @@ -123,7 +123,7 @@ enum EXPLORE_STOP ES_ITEM = 1, ES_STAIR = 2, ES_SHOP = 4, - ES_ALTAR = 8, + ES_ALTAR = 8 }; //////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3-54-g00ecf