← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/run-asan-fix-clang-warnings into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/run-asan-fix-clang-warnings into lp:widelands.

Commit message:
Fixed some clang compiler warnings.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/run-asan-fix-clang-warnings/+merge/334273
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/run-asan-fix-clang-warnings into lp:widelands.
=== modified file 'src/ai/ai_help_structs.cc'
--- src/ai/ai_help_structs.cc	2017-11-20 07:54:19 +0000
+++ src/ai/ai_help_structs.cc	2017-11-25 03:58:31 +0000
@@ -539,9 +539,6 @@
 		case DnaParent::kSecondary:
 			set_military_number_at(i, AI_military_numbers_P2[i]);
 			break;
-		default:
-			log("Invalid dna_donor for military numbers\n");
-			NEVER_HERE();
 		}
 	}
 
@@ -563,9 +560,6 @@
 			persistent_data->neuron_weights.push_back(input_weights_P2[i]);
 			persistent_data->neuron_functs.push_back(input_func_P2[i]);
 			break;
-		default:
-			log("Invalid dna_donor for neurons\n");
-			NEVER_HERE();
 		}
 	}
 
@@ -580,9 +574,6 @@
 		case DnaParent::kSecondary:
 			persistent_data->f_neurons.push_back(f_neurons_P2[i]);
 			break;
-		default:
-			log("Invalid dna_donor for f-neurons\n");
-			NEVER_HERE();
 		}
 	}
 

=== modified file 'src/graphic/text/rt_render.cc'
--- src/graphic/text/rt_render.cc	2017-11-12 08:53:36 +0000
+++ src/graphic/text/rt_render.cc	2017-11-25 03:58:31 +0000
@@ -1606,8 +1606,7 @@
 std::shared_ptr<const UI::RenderedText>
 Renderer::render(const std::string& text, uint16_t width, const TagSet& allowed_tags) {
 	std::unique_ptr<RenderNode> node(layout_(text, width, allowed_tags));
-
-	return std::shared_ptr<const UI::RenderedText>(std::move(node->render(texture_cache_)));
+	return std::shared_ptr<const UI::RenderedText>(node->render(texture_cache_));
 }
 
 IRefMap*

=== modified file 'src/ui_fsmenu/launch_mpg.cc'
--- src/ui_fsmenu/launch_mpg.cc	2017-09-02 21:48:44 +0000
+++ src/ui_fsmenu/launch_mpg.cc	2017-11-25 03:58:31 +0000
@@ -287,7 +287,7 @@
 		return;
 
 	Widelands::Game game;  // The place all data is saved to.
-	FullscreenMenuLoadGame lsgm(game, settings_, ctrl_);
+	FullscreenMenuLoadGame lsgm(game, settings_);
 	FullscreenMenuBase::MenuTarget code = lsgm.run<FullscreenMenuBase::MenuTarget>();
 
 	if (code == FullscreenMenuBase::MenuTarget::kBack) {

=== modified file 'src/ui_fsmenu/loadgame.cc'
--- src/ui_fsmenu/loadgame.cc	2017-11-21 18:36:22 +0000
+++ src/ui_fsmenu/loadgame.cc	2017-11-25 03:58:31 +0000
@@ -26,7 +26,6 @@
 
 FullscreenMenuLoadGame::FullscreenMenuLoadGame(Widelands::Game& g,
                                                GameSettingsProvider* gsp,
-                                               GameController* gc,
                                                bool is_replay)
    : FullscreenMenuLoadMapOrGame(),
 
@@ -49,10 +48,7 @@
                    GameDetails::Style::kFsMenu,
                    true),
 
-     is_replay_(is_replay),
-     game_(g),
-     settings_(gsp),
-     ctrl_(gc) {
+     is_replay_(is_replay) {
 
 	// Make sure that we have some space to work with.
 	main_box_.set_size(get_w(), get_w());

=== modified file 'src/ui_fsmenu/loadgame.h'
--- src/ui_fsmenu/loadgame.h	2017-08-17 06:05:24 +0000
+++ src/ui_fsmenu/loadgame.h	2017-11-25 03:58:31 +0000
@@ -23,7 +23,6 @@
 #include "ui_fsmenu/base.h"
 
 #include "logic/game.h"
-#include "logic/game_controller.h"
 #include "logic/game_settings.h"
 #include "ui_basic/box.h"
 #include "ui_basic/button.h"
@@ -37,7 +36,6 @@
 public:
 	FullscreenMenuLoadGame(Widelands::Game&,
 	                       GameSettingsProvider* gsp,
-	                       GameController* gc = nullptr,
 	                       bool is_replay = false);
 
 	/// The currently selected filename
@@ -64,15 +62,11 @@
 
 	LoadOrSaveGame load_or_save_;
 
-	UI::Button* delete_;
 	// TODO(GunChleoc): Get rid of this hack once everything is 100% box layout
 	UI::Panel* button_spacer_;
 	std::string filename_;
 
 	bool is_replay_;
-	Widelands::Game& game_;
-	GameSettingsProvider* settings_;
-	GameController* ctrl_;
 };
 
 #endif  // end of include guard: WL_UI_FSMENU_LOADGAME_H

=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc	2017-11-24 11:22:07 +0000
+++ src/ui_fsmenu/options.cc	2017-11-25 03:58:31 +0000
@@ -513,7 +513,7 @@
 				Section& s = prof.get_safe_section("global");
 				const int total = s.get_int("total");
 				s = prof.get_safe_section(locale);
-				percent = floor(100.f * s.get_int("translated") / total);
+				percent = static_cast<int>(floor(100 * s.get_int("translated") / total));
 				if (percent == 100) {
 					message =
 					   /** TRANSLATORS: %s = language name */

=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc	2017-11-06 20:19:56 +0000
+++ src/wlapplication.cc	2017-11-25 03:58:31 +0000
@@ -1274,7 +1274,7 @@
 
 	game.set_ai_training_mode(g_options.pull_section("global").get_bool("ai_training", false));
 	SinglePlayerGameSettingsProvider sp;
-	FullscreenMenuLoadGame ssg(game, &sp, nullptr);
+	FullscreenMenuLoadGame ssg(game, &sp);
 
 	if (ssg.run<FullscreenMenuBase::MenuTarget>() == FullscreenMenuBase::MenuTarget::kOk)
 		filename = ssg.filename();
@@ -1342,7 +1342,7 @@
 	Widelands::Game game;
 	if (filename_.empty()) {
 		SinglePlayerGameSettingsProvider sp;
-		FullscreenMenuLoadGame rm(game, &sp, nullptr, true);
+		FullscreenMenuLoadGame rm(game, &sp, true);
 		if (rm.run<FullscreenMenuBase::MenuTarget>() == FullscreenMenuBase::MenuTarget::kBack)
 			return;
 

=== modified file 'src/wui/gamedetails.cc'
--- src/wui/gamedetails.cc	2017-11-06 20:19:56 +0000
+++ src/wui/gamedetails.cc	2017-11-25 03:58:31 +0000
@@ -58,9 +58,8 @@
 		        (noescape ? header : richtext_escape(header)) %
 		        (noescape ? content : richtext_escape(content)))
 		   .str();
-	default:
-		NEVER_HERE();
 	}
+	NEVER_HERE();
 }
 
 }  // namespace

=== modified file 'src/wui/load_or_save_game.h'
--- src/wui/load_or_save_game.h	2017-11-21 18:36:22 +0000
+++ src/wui/load_or_save_game.h	2017-11-25 03:58:31 +0000
@@ -30,8 +30,8 @@
 
 /// Common functions for loading or saving a game or replay.
 class LoadOrSaveGame {
-	friend class GameMainMenuSaveGame;
 	friend class FullscreenMenuLoadGame;
+	friend struct GameMainMenuSaveGame;
 
 protected:
 	/// Choose which type of files to show


Follow ups