← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/clang_warnings into lp:widelands

 

SirVer has proposed merging lp:~widelands-dev/widelands/clang_warnings into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/clang_warnings/+merge/281383

Fixes some compile warnings for clang.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/clang_warnings into lp:widelands.
=== modified file 'src/economy/fleet.cc'
--- src/economy/fleet.cc	2015-11-03 10:39:08 +0000
+++ src/economy/fleet.cc	2015-12-28 10:11:15 +0000
@@ -580,7 +580,7 @@
 
 	if (m_ships.empty() && m_ports.empty()) {
 		remove(egbase);
-	} else if (upcast(Game, game, &egbase)) {
+	} else if (is_a(Game, &egbase)) {
 		// Some ship perhaps lose their destination now, so new a destination must be appointed (if any)
 		molog("Port removed from fleet, triggering fleet update\n");
 		update(egbase);

=== modified file 'src/economy/ware_instance.cc'
--- src/economy/ware_instance.cc	2015-11-11 09:52:55 +0000
+++ src/economy/ware_instance.cc	2015-12-28 10:11:15 +0000
@@ -643,8 +643,7 @@
 	} catch (const std::exception & e) {
 		throw wexception("WareInstance: %s", e.what());
 	}
-
-	return nullptr; // Should never be reached
+	throw wexception("Never here.");
 }
 
 }

=== modified file 'src/logic/soldier.cc'
--- src/logic/soldier.cc	2015-12-03 08:45:37 +0000
+++ src/logic/soldier.cc	2015-12-28 10:11:15 +0000
@@ -58,18 +58,6 @@
 
 namespace  {
 
-/**
- * remove spaces at the beginning or the end of a string
- */
-void remove_spaces(std::string& s) {
-	while (s[0] == ' ' || s[0] == '\t' || s[0] == '\n')
-		s.erase(0, 1);
-
-	while (*s.rbegin() == ' ' || * s.rbegin() == '\t' || * s.rbegin() == '\n')
-		s.erase(s.size() - 1, 1);
-}
-
-
 constexpr int kRetreatWhenHealthDropsBelowThisPercentage = 50;
 }  // namespace
 

=== modified file 'src/map_io/map_players_messages_packet.cc'
--- src/map_io/map_players_messages_packet.cc	2015-12-03 19:32:15 +0000
+++ src/map_io/map_players_messages_packet.cc	2015-12-28 10:11:15 +0000
@@ -59,27 +59,23 @@
 				{
 					MessageQueue::const_iterator const begin = messages.begin();
 					if (begin != messages.end()) {
-						log
-							("ERROR: The message queue for player %u contains a message "
-							 "before any messages have been loaded into it. This is a bug "
-							 "in the savegame loading code. It created a new message and "
-							 "added it to the queue. This is only allowed during "
-							 "simulation, not at load. The following messge will be "
-							 "removed when the queue is reset:\n"
-							 "\tstype   : %u\n"
-							 "\ttitle   : %s\n"
-							 "\tsent    : %u\n"
-							 "\tposition: (%i, %i)\n"
-							 "\tstatus  : %u\n"
-							 "\tbody    : %s\n",
-							 p,
-							 begin->second->type    (),
-							 begin->second->title   ().c_str(),
-							 begin->second->sent    (),
-							 begin->second->position().x, begin->second->position().y,
-							 begin->second->status  (),
-							 begin->second->body    ().c_str());
-						messages.clear();
+					   log("ERROR: The message queue for player %u contains a message "
+					       "before any messages have been loaded into it. This is a bug "
+					       "in the savegame loading code. It created a new message and "
+					       "added it to the queue. This is only allowed during "
+					       "simulation, not at load. The following messge will be "
+					       "removed when the queue is reset:\n"
+					       "\tstype   : %u\n"
+					       "\ttitle   : %s\n"
+					       "\tsent    : %u\n"
+					       "\tposition: (%i, %i)\n"
+					       "\tstatus  : %u\n"
+					       "\tbody    : %s\n",
+					       p, static_cast<int>(begin->second->type()), begin->second->title().c_str(),
+					       begin->second->sent(), begin->second->position().x,
+					       begin->second->position().y, static_cast<int>(begin->second->status()),
+					       begin->second->body().c_str());
+					   messages.clear();
 					}
 				}
 

=== modified file 'src/map_io/map_players_view_packet.cc'
--- src/map_io/map_players_view_packet.cc	2015-11-14 13:18:24 +0000
+++ src/map_io/map_players_view_packet.cc	2015-12-28 10:11:15 +0000
@@ -176,12 +176,6 @@
 
 
 // Errors for the Read* functions.
-struct TribeNonexistent : public FileRead::DataError {
-	TribeNonexistent(char const* const Name)
-	   : DataError("tribe \"%s\" does not exist", Name), name(Name) {
-	}
-	char const* const name;
-};
 struct TribeImmovableNonexistent : public FileRead::DataError {
 	TribeImmovableNonexistent(const std::string& Name)
 	   : DataError("immovable type \"%s\" does not seem to be a tribe immovable", Name.c_str()),

=== modified file 'src/wui/encyclopedia_window.h'
--- src/wui/encyclopedia_window.h	2015-11-21 11:47:05 +0000
+++ src/wui/encyclopedia_window.h	2015-12-28 10:11:15 +0000
@@ -40,9 +40,8 @@
 
 private:
 	struct EncyclopediaEntry {
-		EncyclopediaEntry(const EncyclopediaEntry& other)
-		   : EncyclopediaEntry(other.index, other.descname, other.icon) {
-		}
+		EncyclopediaEntry(const EncyclopediaEntry& other) = default;
+		EncyclopediaEntry& operator = (const EncyclopediaEntry& other) = default;
 		EncyclopediaEntry(const Widelands::DescriptionIndex _index,
 		                  const std::string& _descname,
 		                  const Image* _icon)


Follow ups