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

Proposed by SirVer
Status: Merged
Merged at revision: 7683
Proposed branch: lp:~widelands-dev/widelands/clang_warnings
Merge into: lp:widelands
Diff against target: 131 lines (+21/-45)
6 files modified
src/economy/fleet.cc (+1/-1)
src/economy/ware_instance.cc (+1/-2)
src/logic/soldier.cc (+0/-12)
src/map_io/map_players_messages_packet.cc (+17/-21)
src/map_io/map_players_view_packet.cc (+0/-6)
src/wui/encyclopedia_window.h (+2/-3)
To merge this branch: bzr merge lp:~widelands-dev/widelands/clang_warnings
Reviewer Review Type Date Requested Status
TiborB Approve
Review via email: mp+281383@code.launchpad.net

Description of the change

Fixes some compile warnings for clang.

To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote :

I can't compile or test right now, but code LGTM :)

Revision history for this message
TiborB (tiborb95) wrote :

I compiled and tested. Nothing suspicious there...

review: Approve
Revision history for this message
SirVer (sirver) wrote :

I am working on a buildbot for us, this is testing.

@bunnybot: merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/economy/fleet.cc'
2--- src/economy/fleet.cc 2015-11-03 10:39:08 +0000
3+++ src/economy/fleet.cc 2015-12-28 10:11:15 +0000
4@@ -580,7 +580,7 @@
5
6 if (m_ships.empty() && m_ports.empty()) {
7 remove(egbase);
8- } else if (upcast(Game, game, &egbase)) {
9+ } else if (is_a(Game, &egbase)) {
10 // Some ship perhaps lose their destination now, so new a destination must be appointed (if any)
11 molog("Port removed from fleet, triggering fleet update\n");
12 update(egbase);
13
14=== modified file 'src/economy/ware_instance.cc'
15--- src/economy/ware_instance.cc 2015-11-11 09:52:55 +0000
16+++ src/economy/ware_instance.cc 2015-12-28 10:11:15 +0000
17@@ -643,8 +643,7 @@
18 } catch (const std::exception & e) {
19 throw wexception("WareInstance: %s", e.what());
20 }
21-
22- return nullptr; // Should never be reached
23+ throw wexception("Never here.");
24 }
25
26 }
27
28=== modified file 'src/logic/soldier.cc'
29--- src/logic/soldier.cc 2015-12-03 08:45:37 +0000
30+++ src/logic/soldier.cc 2015-12-28 10:11:15 +0000
31@@ -58,18 +58,6 @@
32
33 namespace {
34
35-/**
36- * remove spaces at the beginning or the end of a string
37- */
38-void remove_spaces(std::string& s) {
39- while (s[0] == ' ' || s[0] == '\t' || s[0] == '\n')
40- s.erase(0, 1);
41-
42- while (*s.rbegin() == ' ' || * s.rbegin() == '\t' || * s.rbegin() == '\n')
43- s.erase(s.size() - 1, 1);
44-}
45-
46-
47 constexpr int kRetreatWhenHealthDropsBelowThisPercentage = 50;
48 } // namespace
49
50
51=== modified file 'src/map_io/map_players_messages_packet.cc'
52--- src/map_io/map_players_messages_packet.cc 2015-12-03 19:32:15 +0000
53+++ src/map_io/map_players_messages_packet.cc 2015-12-28 10:11:15 +0000
54@@ -59,27 +59,23 @@
55 {
56 MessageQueue::const_iterator const begin = messages.begin();
57 if (begin != messages.end()) {
58- log
59- ("ERROR: The message queue for player %u contains a message "
60- "before any messages have been loaded into it. This is a bug "
61- "in the savegame loading code. It created a new message and "
62- "added it to the queue. This is only allowed during "
63- "simulation, not at load. The following messge will be "
64- "removed when the queue is reset:\n"
65- "\tstype : %u\n"
66- "\ttitle : %s\n"
67- "\tsent : %u\n"
68- "\tposition: (%i, %i)\n"
69- "\tstatus : %u\n"
70- "\tbody : %s\n",
71- p,
72- begin->second->type (),
73- begin->second->title ().c_str(),
74- begin->second->sent (),
75- begin->second->position().x, begin->second->position().y,
76- begin->second->status (),
77- begin->second->body ().c_str());
78- messages.clear();
79+ log("ERROR: The message queue for player %u contains a message "
80+ "before any messages have been loaded into it. This is a bug "
81+ "in the savegame loading code. It created a new message and "
82+ "added it to the queue. This is only allowed during "
83+ "simulation, not at load. The following messge will be "
84+ "removed when the queue is reset:\n"
85+ "\tstype : %u\n"
86+ "\ttitle : %s\n"
87+ "\tsent : %u\n"
88+ "\tposition: (%i, %i)\n"
89+ "\tstatus : %u\n"
90+ "\tbody : %s\n",
91+ p, static_cast<int>(begin->second->type()), begin->second->title().c_str(),
92+ begin->second->sent(), begin->second->position().x,
93+ begin->second->position().y, static_cast<int>(begin->second->status()),
94+ begin->second->body().c_str());
95+ messages.clear();
96 }
97 }
98
99
100=== modified file 'src/map_io/map_players_view_packet.cc'
101--- src/map_io/map_players_view_packet.cc 2015-11-14 13:18:24 +0000
102+++ src/map_io/map_players_view_packet.cc 2015-12-28 10:11:15 +0000
103@@ -176,12 +176,6 @@
104
105
106 // Errors for the Read* functions.
107-struct TribeNonexistent : public FileRead::DataError {
108- TribeNonexistent(char const* const Name)
109- : DataError("tribe \"%s\" does not exist", Name), name(Name) {
110- }
111- char const* const name;
112-};
113 struct TribeImmovableNonexistent : public FileRead::DataError {
114 TribeImmovableNonexistent(const std::string& Name)
115 : DataError("immovable type \"%s\" does not seem to be a tribe immovable", Name.c_str()),
116
117=== modified file 'src/wui/encyclopedia_window.h'
118--- src/wui/encyclopedia_window.h 2015-11-21 11:47:05 +0000
119+++ src/wui/encyclopedia_window.h 2015-12-28 10:11:15 +0000
120@@ -40,9 +40,8 @@
121
122 private:
123 struct EncyclopediaEntry {
124- EncyclopediaEntry(const EncyclopediaEntry& other)
125- : EncyclopediaEntry(other.index, other.descname, other.icon) {
126- }
127+ EncyclopediaEntry(const EncyclopediaEntry& other) = default;
128+ EncyclopediaEntry& operator = (const EncyclopediaEntry& other) = default;
129 EncyclopediaEntry(const Widelands::DescriptionIndex _index,
130 const std::string& _descname,
131 const Image* _icon)

Subscribers

People subscribed via source and target branches

to status/vote changes: