From: Matthias Braun Date: Sun, 1 May 2005 21:52:33 +0000 (+0000) Subject: accidently lowered warning level in one of my commits. raised it to -Wall -W -Werror... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=eba5f4b45f92cb19a09fbac1a478648062480adb;p=supertux.git accidently lowered warning level in one of my commits. raised it to -Wall -W -Werror again in debug mode and fixed some warnings SVN-Revision: 2384 --- diff --git a/Jamrules b/Jamrules index 5a51ca184..3213e5db0 100644 --- a/Jamrules +++ b/Jamrules @@ -21,16 +21,16 @@ if $(USE_STLPORT_DEBUG) switch $(VARIANT) { case optimize : - CFLAGS += -O3 -g ; - CXXFLAGS += -O3 -g ; + CFLAGS += -Wall -O3 -g ; + CXXFLAGS += -Wall -O3 -g ; LIBS += -g ; case debug : - CFLAGS += -O0 -g3 -DDEBUG ; - CXXFLAGS += -O0 -g3 -DDEBUG ; + CFLAGS += -Wall -W -Werror -O0 -g3 -DDEBUG ; + CXXFLAGS += -Wall -W -Werror -O0 -g3 -DDEBUG ; LIBS += -g3 ; case profile : - CFLAGS += -O3 -g3 -pg ; - CXXFLAGS += -O3 -g3 -pg ; + CFLAGS += -Wall -W -O3 -g3 -pg ; + CXXFLAGS += -Wall -W -O3 -g3 -pg ; LIBS += -g3 -pg ; case * : EXIT "Invalid variant $(VARIANT) selected" ; diff --git a/configure.ac b/configure.ac index 699bf968d..d6f62ea94 100644 --- a/configure.ac +++ b/configure.ac @@ -69,11 +69,9 @@ AC_ARG_ENABLE(debug, [enable_debug=$enableval], [enable_debug=no]) if test "$enable_debug" = "yes"; then AC_DEFINE([DEBUG], 1, [define to compile in debug checks]) - #CXXFLAGS="$CXXFLAGS -Wall -Werror -O0 -g3" VARIANT=debug AC_MSG_RESULT([enabled]) else - #CXXFLAGS="$CXXFLAGS -O2 -g" VARIANT=optimize AC_MSG_RESULT([disabled]) fi diff --git a/src/control/joystickkeyboardcontroller.cpp b/src/control/joystickkeyboardcontroller.cpp index 83cbdbced..06ffd062e 100644 --- a/src/control/joystickkeyboardcontroller.cpp +++ b/src/control/joystickkeyboardcontroller.cpp @@ -520,7 +520,7 @@ JoystickKeyboardController::check_cheatcode(const std::string& cheatcode) return false; } - for(int i = 0; i < cheatcode.size(); ++i) { + for(size_t i = 0; i < cheatcode.size(); ++i) { if(last_keys[sizeof(last_keys)-1 - i] != cheatcode[cheatcode.size()-1-i]) return false; } diff --git a/src/control/semantic.cache b/src/control/semantic.cache index c9eefee02..8a236b99e 100644 --- a/src/control/semantic.cache +++ b/src/control/semantic.cache @@ -19,9 +19,9 @@ ) (semanticdb-table "joystickkeyboardcontroller.cpp" :file "joystickkeyboardcontroller.cpp" - :pointmax 16908 + :pointmax 18657 :major-mode 'c++-mode - :tokens '(("config.h" include t nil nil [1 20]) ("sstream" include t nil nil [22 40]) ("joystickkeyboardcontroller.h" include nil nil nil [41 80]) ("gui/menu.h" include nil nil nil [81 102]) ("app/gettext.h" include nil nil nil [103 127]) ("lisp/lisp.h" include nil nil nil [128 150]) ("lisp/list_iterator.h" include nil nil nil [151 182]) ("JoystickKeyboardController" function ("JoystickKeyboardController" type "class") nil ((parent . "JoystickKeyboardController") (constructor . t)) nil nil [785 3226]) ("JoystickKeyboardController" function "void" nil ((parent . "JoystickKeyboardController") (destructor . t)) nil nil [3228 3499]) ("read" function ("void") (("lisp" variable ("lisp::Lisp" type "class") nil ((const . t)) nil nil [3539 3562])) ((parent . "JoystickKeyboardController")) nil nil [3501 5764]) ("write" function ("void") (("writer" variable ("lisp::Writer" type "class") nil nil nil nil [5805 5826])) ((parent . "JoystickKeyboardController")) nil nil [5766 6671]) ("process_event" function ("void") (("event" variable ("SDL_Event" type "class") nil ((const . t)) nil nil [6720 6743])) ((parent . "JoystickKeyboardController")) nil nil [6673 9532]) ("process_menu_key_event" function ("void") (("event" variable ("SDL_Event" type "class") nil ((const . t)) nil nil [9590 9613])) ((parent . "JoystickKeyboardController")) nil nil [9534 10775]) ("reset_joybutton" function ("void") (("button" variable "int" nil nil nil nil [10826 10837]) ("control" variable ("Control" type "class") nil nil nil nil [10838 10854])) ((parent . "JoystickKeyboardController")) nil nil [10777 11619]) ("reset_key" function ("void") (("key" variable ("SDLKey" type "class") nil nil nil nil [11664 11675]) ("control" variable ("Control" type "class") nil nil nil nil [11676 11692])) ((parent . "JoystickKeyboardController")) nil nil [11621 12132]) ("reversemap_key" function ("SDLKey" type "class") (("c" variable ("Control" type "class") nil nil nil nil [12184 12194])) ((parent . "JoystickKeyboardController")) nil nil [12134 12341]) ("reversemap_joybutton" function ("int") (("c" variable ("Control" type "class") nil nil nil nil [12396 12406])) ((parent . "JoystickKeyboardController")) nil nil [12343 12568]) ("get_key_options_menu" function ("Menu" type "class") nil ((parent . "JoystickKeyboardController") (pointer . 1)) nil nil [12570 12739]) ("get_joystick_options_menu" function ("Menu" type "class") nil ((parent . "JoystickKeyboardController") (pointer . 1)) nil nil [12741 12930]) ("KeyboardMenu" function "int" (("_controller" variable ("JoystickKeyboardController" type "class") nil ((pointer . 1)) nil nil [13072 13112])) ((parent . "JoystickKeyboardController::KeyboardMenu")) nil nil [13012 13558]) ("KeyboardMenu" function "void" nil ((parent . "JoystickKeyboardController::KeyboardMenu") (destructor . t)) nil nil [13560 13620]) ("get_key_name" function ("std::string" type "class") (("key" variable ("SDLKey" type "class") nil nil nil nil [13689 13700])) ((parent . "JoystickKeyboardController::KeyboardMenu")) nil nil [13622 14432]) ("menu_action" function ("void") (("item" variable ("MenuItem" type "class") nil ((pointer . 1)) nil nil [14493 14508])) ((parent . "JoystickKeyboardController::KeyboardMenu")) nil nil [14434 14653]) ("update" function ("void") nil ((parent . "JoystickKeyboardController::KeyboardMenu")) nil nil [14655 15453]) ("JoystickMenu" function "int" (("_controller" variable ("JoystickKeyboardController" type "class") nil ((pointer . 1)) nil nil [15592 15632])) ((parent . "JoystickKeyboardController::JoystickMenu")) nil nil [15534 15923]) ("JoystickMenu" function "void" nil ((parent . "JoystickKeyboardController::JoystickMenu") (destructor . t)) nil nil [15925 15985]) ("get_button_name" function ("std::string" type "class") (("button" variable "int" nil nil nil nil [16057 16068])) ((parent . "JoystickKeyboardController::JoystickMenu")) nil nil [15987 16195]) ("menu_action" function ("void") (("item" variable ("MenuItem" type "class") nil ((pointer . 1)) nil nil [16256 16271])) ((parent . "JoystickKeyboardController::JoystickMenu")) nil nil [16197 16425]) ("update" function ("void") nil ((parent . "JoystickKeyboardController::JoystickMenu")) nil nil [16427 16906])) + :tokens '(("config.h" include t nil nil [818 837]) ("sstream" include t nil nil [839 857]) ("joystickkeyboardcontroller.h" include nil nil nil [858 897]) ("gui/menu.h" include nil nil nil [898 919]) ("app/gettext.h" include nil nil nil [920 944]) ("lisp/lisp.h" include nil nil nil [945 967]) ("lisp/list_iterator.h" include nil nil nil [968 999]) ("game_session.h" include nil nil nil [1000 1025]) ("JoystickKeyboardController" function ("JoystickKeyboardController" type "class") nil ((parent . "JoystickKeyboardController") (constructor . t)) nil nil [1628 4114]) ("JoystickKeyboardController" function "void" nil ((parent . "JoystickKeyboardController") (destructor . t)) nil nil [4116 4387]) ("read" function ("void") (("lisp" variable ("lisp::Lisp" type "class") nil ((const . t)) nil nil [4427 4450])) ((parent . "JoystickKeyboardController")) nil nil [4389 6610]) ("write" function ("void") (("writer" variable ("lisp::Writer" type "class") nil nil nil nil [6651 6672])) ((parent . "JoystickKeyboardController")) nil nil [6612 7517]) ("process_event" function ("void") (("event" variable ("SDL_Event" type "class") nil ((const . t)) nil nil [7566 7589])) ((parent . "JoystickKeyboardController")) nil nil [7519 10816]) ("process_menu_key_event" function ("void") (("event" variable ("SDL_Event" type "class") nil ((const . t)) nil nil [10874 10897])) ((parent . "JoystickKeyboardController")) nil nil [10818 12143]) ("reset_joybutton" function ("void") (("button" variable "int" nil nil nil nil [12194 12205]) ("control" variable ("Control" type "class") nil nil nil nil [12206 12222])) ((parent . "JoystickKeyboardController")) nil nil [12145 12987]) ("reset_key" function ("void") (("key" variable ("SDLKey" type "class") nil nil nil nil [13032 13043]) ("control" variable ("Control" type "class") nil nil nil nil [13044 13060])) ((parent . "JoystickKeyboardController")) nil nil [12989 13500]) ("reversemap_key" function ("SDLKey" type "class") (("c" variable ("Control" type "class") nil nil nil nil [13552 13562])) ((parent . "JoystickKeyboardController")) nil nil [13502 13709]) ("reversemap_joybutton" function ("int") (("c" variable ("Control" type "class") nil nil nil nil [13764 13774])) ((parent . "JoystickKeyboardController")) nil nil [13711 13936]) ("get_key_options_menu" function ("Menu" type "class") nil ((parent . "JoystickKeyboardController") (pointer . 1)) nil nil [13938 14107]) ("get_joystick_options_menu" function ("Menu" type "class") nil ((parent . "JoystickKeyboardController") (pointer . 1)) nil nil [14109 14298]) ("check_cheatcode" function ("bool" type "class") (("cheatcode" variable ("std::string" type "class") nil ((const . t)) nil nil [14349 14378])) ((parent . "JoystickKeyboardController")) nil nil [14300 14679]) ("KeyboardMenu" function "int" (("_controller" variable ("JoystickKeyboardController" type "class") nil ((pointer . 1)) nil nil [14821 14861])) ((parent . "JoystickKeyboardController::KeyboardMenu")) nil nil [14761 15307]) ("KeyboardMenu" function "void" nil ((parent . "JoystickKeyboardController::KeyboardMenu") (destructor . t)) nil nil [15309 15369]) ("get_key_name" function ("std::string" type "class") (("key" variable ("SDLKey" type "class") nil nil nil nil [15438 15449])) ((parent . "JoystickKeyboardController::KeyboardMenu")) nil nil [15371 16181]) ("menu_action" function ("void") (("item" variable ("MenuItem" type "class") nil ((pointer . 1)) nil nil [16242 16257])) ((parent . "JoystickKeyboardController::KeyboardMenu")) nil nil [16183 16402]) ("update" function ("void") nil ((parent . "JoystickKeyboardController::KeyboardMenu")) nil nil [16404 17202]) ("JoystickMenu" function "int" (("_controller" variable ("JoystickKeyboardController" type "class") nil ((pointer . 1)) nil nil [17341 17381])) ((parent . "JoystickKeyboardController::JoystickMenu")) nil nil [17283 17672]) ("JoystickMenu" function "void" nil ((parent . "JoystickKeyboardController::JoystickMenu") (destructor . t)) nil nil [17674 17734]) ("get_button_name" function ("std::string" type "class") (("button" variable "int" nil nil nil nil [17806 17817])) ((parent . "JoystickKeyboardController::JoystickMenu")) nil nil [17736 17944]) ("menu_action" function ("void") (("item" variable ("MenuItem" type "class") nil ((pointer . 1)) nil nil [18005 18020])) ((parent . "JoystickKeyboardController::JoystickMenu")) nil nil [17946 18174]) ("update" function ("void") nil ((parent . "JoystickKeyboardController::JoystickMenu")) nil nil [18176 18655])) :unmatched-syntax '((punctuation 780 . 781) (semantic-list 550 . 780) (symbol 545 . 549) (PUBLIC 538 . 544) (punctuation 536 . 537) (symbol 523 . 535) (punctuation 522 . 523) (punctuation 521 . 522) (symbol 495 . 521) (CLASS 489 . 494) (punctuation 486 . 487) (semantic-list 245 . 486) (symbol 240 . 244) (PUBLIC 233 . 239) (punctuation 231 . 232) (symbol 218 . 230) (punctuation 217 . 218) (punctuation 216 . 217) (symbol 190 . 216) (CLASS 184 . 189)) ) (semanticdb-table "codecontroller.h" diff --git a/src/game_session.cpp b/src/game_session.cpp index 662371f27..6aae47e09 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -486,10 +486,10 @@ GameSession::run() while (fps_nextframe_ticks > SDL_GetTicks()){ /* just wait */ // If we really have to wait long, then do an imprecise SDL_Delay() - if (fps_nextframe_ticks - SDL_GetTicks() > 15){ - SDL_Delay(5); - } - + Uint32 ticks = SDL_GetTicks(); + if (fps_nextframe_ticks - ticks > 15) { + SDL_Delay((Uint32) (fps_nextframe_ticks - ticks)); + } } float diff = SDL_GetTicks() - fps_nextframe_ticks; if (diff > 5.0) diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index 88fffd57b..03a6a3c0a 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -818,12 +818,11 @@ Menu::event(const SDL_Event& event) void Menu::set_active_item(int id) { - for(int i = 0; i < items.size(); ++i) { - MenuItem* item = items[i]; - if(item->id == id) { - active_item = i; - break; - } - } + for(size_t i = 0; i < items.size(); ++i) { + MenuItem* item = items[i]; + if(item->id == id) { + active_item = i; + break; + } + } } - diff --git a/src/gui/menu.h b/src/gui/menu.h index 3c6bad091..46373b45b 100644 --- a/src/gui/menu.h +++ b/src/gui/menu.h @@ -76,9 +76,9 @@ public: private: /// copy-construction not allowed - MenuItem(const MenuItem& other) { assert(false); } + MenuItem(const MenuItem& ) { assert(false); } /// assignment not allowed - void operator= (const MenuItem& other) { assert(false); } + void operator= (const MenuItem& ) { assert(false); } /// keyboard key or joystick button bool input_flickering; @@ -144,7 +144,7 @@ public: std::vector items; Menu(); - ~Menu(); + virtual ~Menu(); void add_hl(); void add_label(const std::string& text); diff --git a/src/resources.cpp b/src/resources.cpp index 196924281..4119b7ae8 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -81,8 +81,6 @@ void load_shared() Button::info_font = white_small_text; - int i; - sprite_manager = new SpriteManager( get_resource_filename("/images/supertux.strf")); tile_manager = new TileManager("/images/tilesets/supertux.stgt"); diff --git a/src/title.cpp b/src/title.cpp index 12c58e2ae..6badcd5a3 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -275,7 +275,7 @@ void draw_demo(float elapsed_time) void title() { walking = true; - LevelEditor* leveleditor; + //LevelEditor* leveleditor; MusicRef credits_music; controller = new CodeController(); @@ -370,13 +370,14 @@ void title() generate_contrib_menu(); break; #if 0 - case MNID_LEVELEDITOR: - leveleditor = new LevelEditor(); + case MNID_LEVELEDITOR: { + LevelEdtiro* leveleditor = new LevelEditor(); leveleditor->run(); delete leveleditor; Menu::set_current(main_menu); resume_demo(); break; + } #endif case MNID_CREDITS: fadeout(500);