Merge lp:~peter.waller/widelands/clang-warning-fixes into lp:widelands

Proposed by Peter Waller
Status: Merged
Merged at revision: 6394
Proposed branch: lp:~peter.waller/widelands/clang-warning-fixes
Merge into: lp:widelands
Diff against target: 220 lines (+31/-20)
13 files modified
src/cookie_priority_queue.h (+8/-4)
src/economy/road.cc (+2/-1)
src/economy/ware_instance.h (+1/-1)
src/editor/editorinteractive.h (+2/-2)
src/gamecontroller.h (+6/-1)
src/graphic/surface.h (+5/-5)
src/io/filesystem/filesystem.h (+1/-1)
src/logic/map.h (+1/-1)
src/logic/productionsite.cc (+1/-1)
src/logic/productionsite.h (+1/-1)
src/md5.h (+1/-1)
src/scripting/luna.h (+1/-0)
src/wui/interactive_base.h (+1/-1)
To merge this branch: bzr merge lp:~peter.waller/widelands/clang-warning-fixes
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+103975@code.launchpad.net

Description of the change

Fixes several of the issues mentioned in #913369

To post a comment you must log in.
Revision history for this message
David Allwicher (aber) wrote :

Why do you comment the names out?

Revision history for this message
Peter Waller (peter.waller) wrote :

> Why do you comment the names out?

This is to avoid "unused variable" warnings, which can be quite prolific because the header files are included in many places and generate the warnings for in each and every file they are included in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/cookie_priority_queue.h'
2--- src/cookie_priority_queue.h 2012-04-25 07:26:30 +0000
3+++ src/cookie_priority_queue.h 2012-04-28 11:03:21 +0000
4@@ -156,7 +156,8 @@
5 }
6
7 template<typename _T, typename _Cw, typename _CA>
8-void cookie_priority_queue<_T, _Cw, _CA>::push(typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
9+void cookie_priority_queue<_T, _Cw, _CA>::push
10+ (typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
11 {
12 cookie & elt_cookie(ca(elt));
13
14@@ -169,7 +170,8 @@
15 }
16
17 template<typename _T, typename _Cw, typename _CA>
18-void cookie_priority_queue<_T, _Cw, _CA>::pop(typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
19+void cookie_priority_queue<_T, _Cw, _CA>::pop
20+ (typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
21 {
22 cookie & elt_cookie(ca(elt));
23
24@@ -192,7 +194,8 @@
25 }
26
27 template<typename _T, typename _Cw, typename _CA>
28-void cookie_priority_queue<_T, _Cw, _CA>::decrease_key(typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
29+void cookie_priority_queue<_T, _Cw, _CA>::decrease_key
30+ (typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
31 {
32 cookie & elt_cookie(ca(elt));
33
34@@ -215,7 +218,8 @@
35 }
36
37 template<typename _T, typename _Cw, typename _CA>
38-void cookie_priority_queue<_T, _Cw, _CA>::increase_key(typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
39+void cookie_priority_queue<_T, _Cw, _CA>::increase_key
40+ (typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
41 {
42 cookie & elt_cookie(ca(elt));
43
44
45=== modified file 'src/economy/road.cc'
46--- src/economy/road.cc 2012-02-15 21:25:34 +0000
47+++ src/economy/road.cc 2012-04-28 11:03:21 +0000
48@@ -291,7 +291,7 @@
49 * request a new carrier
50 */
51 if (upcast(Game, game, &egbase))
52- container_iterate(SlotVector, m_carrier_slots, i)
53+ container_iterate(SlotVector, m_carrier_slots, i) {
54 if (Carrier * const carrier = i.current->carrier.get(*game)) {
55 // This happens after a road split. Tell the carrier what's going on.
56 carrier->set_location (this);
57@@ -301,6 +301,7 @@
58 (i.current->carrier_type == 1 or
59 m_type == Road_Busy))
60 _request_carrier(*i.current);
61+ }
62 }
63
64 /**
65
66=== modified file 'src/economy/ware_instance.h'
67--- src/economy/ware_instance.h 2012-02-15 21:25:34 +0000
68+++ src/economy/ware_instance.h 2012-04-28 11:03:21 +0000
69@@ -31,7 +31,7 @@
70 struct Economy;
71 struct Editor_Game_Base;
72 struct Game;
73-class IdleWareSupply;
74+struct IdleWareSupply;
75 class Map_Object;
76 struct PlayerImmovable;
77 struct Transfer;
78
79=== modified file 'src/editor/editorinteractive.h'
80--- src/editor/editorinteractive.h 2012-02-21 13:52:14 +0000
81+++ src/editor/editorinteractive.h 2012-04-28 11:03:21 +0000
82@@ -115,8 +115,8 @@
83 void exit();
84
85 // reference functions
86- void reference_player_tribe(Widelands::Player_Number, void const *);
87- void unreference_player_tribe(Widelands::Player_Number, void const *);
88+ void reference_player_tribe(Widelands::Player_Number, void const * const);
89+ void unreference_player_tribe(Widelands::Player_Number, void const * const);
90 bool is_player_tribe_referenced(Widelands::Player_Number);
91 void set_need_save(bool const t) {m_need_save = t;}
92
93
94=== modified file 'src/gamecontroller.h'
95--- src/gamecontroller.h 2012-02-15 21:25:34 +0000
96+++ src/gamecontroller.h 2012-04-28 11:03:21 +0000
97@@ -91,7 +91,12 @@
98 (Widelands::Game &, bool cpls, Widelands::Player_Number local);
99
100 // until now only implemented for nethost and only used for dedicated servers
101- virtual void report_result(uint8_t player, int32_t points, bool win, std::string extra) {}
102+ virtual void report_result
103+ (uint8_t /* player */,
104+ int32_t /* points */,
105+ bool /* win */,
106+ std::string /* extra */)
107+ {}
108 };
109
110 #endif
111
112=== modified file 'src/graphic/surface.h'
113--- src/graphic/surface.h 2012-02-15 21:25:34 +0000
114+++ src/graphic/surface.h 2012-04-28 11:03:21 +0000
115@@ -58,11 +58,11 @@
116
117 /// draw a line to the surface
118 virtual void draw_line
119- (int32_t x1,
120- int32_t y1,
121- int32_t x2,
122- int32_t y2,
123- RGBColor color, uint8_t width = 1)
124+ (int32_t /* x1 */,
125+ int32_t /* y1 */,
126+ int32_t /* x2 */,
127+ int32_t /* y2 */,
128+ RGBColor /* color */, uint8_t /* width = 1 */)
129 {
130 throw wexception("draw_line() not implemented");
131 }
132
133=== modified file 'src/io/filesystem/filesystem.h'
134--- src/io/filesystem/filesystem.h 2012-02-15 21:25:34 +0000
135+++ src/io/filesystem/filesystem.h 2012-04-28 11:03:21 +0000
136@@ -109,7 +109,7 @@
137
138 // basic path/filename manipulation
139 std::string fixCrossFile(std::string const &) const;
140- const char fileSeparator() {return m_filesep;}
141+ char fileSeparator() {return m_filesep;}
142 std::string getWorkingDirectory() const;
143 std::string FS_CanonicalizeName(std::string path) const;
144 bool pathIsAbsolute(std::string const & path) const;
145
146=== modified file 'src/logic/map.h'
147--- src/logic/map.h 2012-03-09 10:37:34 +0000
148+++ src/logic/map.h 2012-04-28 11:03:21 +0000
149@@ -199,7 +199,7 @@
150 const std::string & get_background() const {return m_background;}
151 typedef std::set<std::string> Tags;
152 const Tags & get_tags() const {return m_tags;}
153- const bool has_tag(std::string & s) const {return m_tags.count(s);}
154+ bool has_tag(std::string & s) const {return m_tags.count(s);}
155
156 Player_Number get_nrplayers() const throw () {return m_nrplayers;}
157 ScenarioTypes scenario_types() const throw () {return m_scenario_types;}
158
159=== modified file 'src/logic/productionsite.cc'
160--- src/logic/productionsite.cc 2012-02-15 21:25:34 +0000
161+++ src/logic/productionsite.cc 2012-04-28 11:03:21 +0000
162@@ -655,7 +655,7 @@
163 }
164
165
166-void ProductionSite::log_general_info(Editor_Game_Base & egbase) {
167+void ProductionSite::log_general_info(Editor_Game_Base const & egbase) {
168 Building::log_general_info(egbase);
169
170 molog("m_is_stopped: %u\n", m_is_stopped);
171
172=== modified file 'src/logic/productionsite.h'
173--- src/logic/productionsite.h 2012-02-15 21:25:34 +0000
174+++ src/logic/productionsite.h 2012-04-28 11:03:21 +0000
175@@ -132,7 +132,7 @@
176 ProductionSite(const ProductionSite_Descr & descr);
177 virtual ~ProductionSite();
178
179- void log_general_info(Editor_Game_Base &);
180+ void log_general_info(Editor_Game_Base const &);
181
182 bool is_stopped() const {return m_is_stopped;}
183 void set_stopped(bool);
184
185=== modified file 'src/md5.h'
186--- src/md5.h 2012-02-15 21:25:34 +0000
187+++ src/md5.h 2012-04-28 11:03:21 +0000
188@@ -91,7 +91,7 @@
189 ///
190 /// \param data data to compute chksum for
191 /// \param size size of data
192- void Data(const void * const newdata, const size_t size) {
193+ void Data(void const * const newdata, size_t const size) {
194 assert(can_handle_data);
195 md5_process_bytes(newdata, size, &ctx);
196 }
197
198=== modified file 'src/scripting/luna.h'
199--- src/scripting/luna.h 2012-02-15 21:25:34 +0000
200+++ src/scripting/luna.h 2012-04-28 11:03:21 +0000
201@@ -73,6 +73,7 @@
202 */
203 class LunaClass {
204 public:
205+ virtual ~LunaClass() {}
206 virtual void __persist(lua_State *) = 0;
207 virtual void __unpersist(lua_State *) = 0;
208 virtual const char * get_modulename() = 0;
209
210=== modified file 'src/wui/interactive_base.h'
211--- src/wui/interactive_base.h 2012-02-20 15:54:26 +0000
212+++ src/wui/interactive_base.h 2012-04-28 11:03:21 +0000
213@@ -57,7 +57,7 @@
214 virtual ~Interactive_Base();
215
216 Widelands::Editor_Game_Base & egbase() const {return m_egbase;}
217- virtual void reference_player_tribe(const int32_t, const void * const) {}
218+ virtual void reference_player_tribe(Widelands::Player_Number, const void * const) {}
219
220 bool m_show_workarea_preview;
221

Subscribers

People subscribed via source and target branches

to status/vote changes: