← Back to team overview

widelands-dev team mailing list archive

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

 

Peter Waller has proposed merging lp:~peter.waller/widelands/clang-warning-fixes into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #913369 in widelands: "Warnings at compile-time (clang/llvm)"
  https://bugs.launchpad.net/widelands/+bug/913369

For more details, see:
https://code.launchpad.net/~peter.waller/widelands/clang-warning-fixes/+merge/103975

Fixes several of the issues mentioned in #913369
-- 
https://code.launchpad.net/~peter.waller/widelands/clang-warning-fixes/+merge/103975
Your team Widelands Developers is requested to review the proposed merge of lp:~peter.waller/widelands/clang-warning-fixes into lp:widelands.
=== modified file 'src/cookie_priority_queue.h'
--- src/cookie_priority_queue.h	2012-04-25 07:26:30 +0000
+++ src/cookie_priority_queue.h	2012-04-28 11:00:31 +0000
@@ -156,7 +156,8 @@
 }
 
 template<typename _T, typename _Cw, typename _CA>
-void cookie_priority_queue<_T, _Cw, _CA>::push(typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
+void cookie_priority_queue<_T, _Cw, _CA>::push
+	(typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
 {
 	cookie & elt_cookie(ca(elt));
 
@@ -169,7 +170,8 @@
 }
 
 template<typename _T, typename _Cw, typename _CA>
-void cookie_priority_queue<_T, _Cw, _CA>::pop(typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
+void cookie_priority_queue<_T, _Cw, _CA>::pop
+	(typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
 {
 	cookie & elt_cookie(ca(elt));
 
@@ -192,7 +194,8 @@
 }
 
 template<typename _T, typename _Cw, typename _CA>
-void cookie_priority_queue<_T, _Cw, _CA>::decrease_key(typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
+void cookie_priority_queue<_T, _Cw, _CA>::decrease_key
+	(typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
 {
 	cookie & elt_cookie(ca(elt));
 
@@ -215,7 +218,8 @@
 }
 
 template<typename _T, typename _Cw, typename _CA>
-void cookie_priority_queue<_T, _Cw, _CA>::increase_key(typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
+void cookie_priority_queue<_T, _Cw, _CA>::increase_key
+	(typename cookie_priority_queue<_T, _Cw, _CA>::type * elt)
 {
 	cookie & elt_cookie(ca(elt));
 

=== modified file 'src/economy/road.cc'
--- src/economy/road.cc	2012-02-15 21:25:34 +0000
+++ src/economy/road.cc	2012-04-28 11:00:31 +0000
@@ -291,7 +291,7 @@
 	 * request a new carrier
 	 */
 	if (upcast(Game, game, &egbase))
-	container_iterate(SlotVector, m_carrier_slots, i)
+	container_iterate(SlotVector, m_carrier_slots, i) {
 		if (Carrier * const carrier = i.current->carrier.get(*game)) {
 			//  This happens after a road split. Tell the carrier what's going on.
 			carrier->set_location    (this);
@@ -301,6 +301,7 @@
 			 (i.current->carrier_type == 1 or
 			  m_type == Road_Busy))
 			_request_carrier(*i.current);
+	}
 }
 
 /**

=== modified file 'src/economy/ware_instance.h'
--- src/economy/ware_instance.h	2012-02-15 21:25:34 +0000
+++ src/economy/ware_instance.h	2012-04-28 11:00:31 +0000
@@ -31,7 +31,7 @@
 struct Economy;
 struct Editor_Game_Base;
 struct Game;
-class IdleWareSupply;
+struct IdleWareSupply;
 class Map_Object;
 struct PlayerImmovable;
 struct Transfer;

=== modified file 'src/editor/editorinteractive.h'
--- src/editor/editorinteractive.h	2012-02-21 13:52:14 +0000
+++ src/editor/editorinteractive.h	2012-04-28 11:00:31 +0000
@@ -115,8 +115,8 @@
 	void exit();
 
 	//  reference functions
-	void   reference_player_tribe(Widelands::Player_Number, void const *);
-	void unreference_player_tribe(Widelands::Player_Number, void const *);
+	void   reference_player_tribe(Widelands::Player_Number, void const * const);
+	void unreference_player_tribe(Widelands::Player_Number, void const * const);
 	bool is_player_tribe_referenced(Widelands::Player_Number);
 	void set_need_save(bool const t) {m_need_save = t;}
 

=== modified file 'src/gamecontroller.h'
--- src/gamecontroller.h	2012-02-15 21:25:34 +0000
+++ src/gamecontroller.h	2012-04-28 11:00:31 +0000
@@ -91,7 +91,12 @@
 		(Widelands::Game &, bool cpls, Widelands::Player_Number local);
 
 	// until now only implemented for nethost and only used for dedicated servers
-	virtual void report_result(uint8_t player, int32_t points, bool win, std::string extra) {}
+	virtual void report_result
+	    (uint8_t /* player */,
+	     int32_t /* points */,
+	     bool /* win */,
+	     std::string /* extra */)
+	{}
 };
 
 #endif

=== modified file 'src/graphic/surface.h'
--- src/graphic/surface.h	2012-02-15 21:25:34 +0000
+++ src/graphic/surface.h	2012-04-28 11:00:31 +0000
@@ -58,11 +58,11 @@
 
 	/// draw a line to the surface
 	virtual void draw_line
-		(int32_t x1,
-		 int32_t y1,
-		 int32_t x2,
-		 int32_t y2,
-		 RGBColor color, uint8_t width = 1)
+		(int32_t /* x1 */,
+		 int32_t /* y1 */,
+		 int32_t /* x2 */,
+		 int32_t /* y2 */,
+		 RGBColor /* color */, uint8_t /* width = 1 */)
 	{
 		throw wexception("draw_line() not implemented");
 	}

=== modified file 'src/io/filesystem/filesystem.h'
--- src/io/filesystem/filesystem.h	2012-02-15 21:25:34 +0000
+++ src/io/filesystem/filesystem.h	2012-04-28 11:00:31 +0000
@@ -109,7 +109,7 @@
 
 	// basic path/filename manipulation
 	std::string fixCrossFile(std::string const &) const;
-	const char  fileSeparator() {return m_filesep;}
+	char  fileSeparator() {return m_filesep;}
 	std::string getWorkingDirectory() const;
 	std::string FS_CanonicalizeName(std::string path) const;
 	bool pathIsAbsolute(std::string const & path) const;

=== modified file 'src/logic/map.h'
--- src/logic/map.h	2012-03-09 10:37:34 +0000
+++ src/logic/map.h	2012-04-28 11:00:31 +0000
@@ -199,7 +199,7 @@
 	const std::string & get_background() const {return m_background;}
 	typedef std::set<std::string> Tags;
 	const Tags & get_tags() const {return m_tags;}
-	const bool has_tag(std::string & s) const {return m_tags.count(s);}
+	bool has_tag(std::string & s) const {return m_tags.count(s);}
 
 	Player_Number get_nrplayers() const throw () {return m_nrplayers;}
 	ScenarioTypes scenario_types() const throw () {return m_scenario_types;}

=== modified file 'src/logic/productionsite.cc'
--- src/logic/productionsite.cc	2012-02-15 21:25:34 +0000
+++ src/logic/productionsite.cc	2012-04-28 11:00:31 +0000
@@ -655,7 +655,7 @@
 }
 
 
-void ProductionSite::log_general_info(Editor_Game_Base & egbase) {
+void ProductionSite::log_general_info(Editor_Game_Base const & egbase) {
 	Building::log_general_info(egbase);
 
 	molog("m_is_stopped: %u\n", m_is_stopped);

=== modified file 'src/logic/productionsite.h'
--- src/logic/productionsite.h	2012-02-15 21:25:34 +0000
+++ src/logic/productionsite.h	2012-04-28 11:00:31 +0000
@@ -132,7 +132,7 @@
 	ProductionSite(const ProductionSite_Descr & descr);
 	virtual ~ProductionSite();
 
-	void log_general_info(Editor_Game_Base &);
+	void log_general_info(Editor_Game_Base const &);
 
 	bool is_stopped() const {return m_is_stopped;}
 	void set_stopped(bool);

=== modified file 'src/md5.h'
--- src/md5.h	2012-02-15 21:25:34 +0000
+++ src/md5.h	2012-04-28 11:00:31 +0000
@@ -91,7 +91,7 @@
 	///
 	/// \param data data to compute chksum for
 	/// \param size size of data
-	void Data(const void * const newdata, const size_t size) {
+	void Data(void const * const newdata, size_t const size) {
 		assert(can_handle_data);
 		md5_process_bytes(newdata, size, &ctx);
 	}

=== modified file 'src/scripting/luna.h'
--- src/scripting/luna.h	2012-02-15 21:25:34 +0000
+++ src/scripting/luna.h	2012-04-28 11:00:31 +0000
@@ -73,6 +73,7 @@
  */
 class LunaClass {
 	public:
+		virtual ~LunaClass() {}
 		virtual void __persist(lua_State *) = 0;
 		virtual void __unpersist(lua_State *) = 0;
 		virtual const char * get_modulename() = 0;

=== modified file 'src/wui/interactive_base.h'
--- src/wui/interactive_base.h	2012-02-20 15:54:26 +0000
+++ src/wui/interactive_base.h	2012-04-28 11:00:31 +0000
@@ -57,7 +57,7 @@
 	virtual ~Interactive_Base();
 
 	Widelands::Editor_Game_Base & egbase() const {return m_egbase;}
-	virtual void reference_player_tribe(const int32_t, const void * const) {}
+	virtual void reference_player_tribe(Widelands::Player_Number, const void * const) {}
 
 	bool m_show_workarea_preview;
 


Follow ups