widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #00816
[Merge] lp:~peter.waller/widelands/eliminate-unused-arguments into lp:widelands
Peter Waller has proposed merging lp:~peter.waller/widelands/eliminate-unused-arguments into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~peter.waller/widelands/eliminate-unused-arguments/+merge/109448
This branch fixes a large number of compile time warnings created by unused parameters, getting us ever closer to being warning free and revealing a couple of bugs in the remaining warnings.
With this branch, I only count a total of 21 warnings with -DWL_EXTRAWARNINGS=true.
--
https://code.launchpad.net/~peter.waller/widelands/eliminate-unused-arguments/+merge/109448
Your team Widelands Developers is requested to review the proposed merge of lp:~peter.waller/widelands/eliminate-unused-arguments into lp:widelands.
=== modified file 'cmake/codecheck/CodeCheck.py'
--- cmake/codecheck/CodeCheck.py 2012-02-15 21:25:34 +0000
+++ cmake/codecheck/CodeCheck.py 2012-06-08 22:38:40 +0000
@@ -17,6 +17,23 @@
import os
import re
+def strip_multi_line_c_comments(input_lines):
+ """
+ Remove multi-line C comments from a one-line-per-entry list of strings,
+ but preserve new lines so that line-numbering is not affected.
+ """
+ new_lines = "".join(input_lines)
+
+ def fixup(match):
+ "Remove everything except newlines"
+ orig_string = match.string[match.start():match.end()]
+ return "\n" * orig_string.count("\n")
+
+ # Strip multi-line c-style comments
+ new_lines = re.sub(r"/\*.*?\*/", fixup, new_lines, flags=re.DOTALL | re.M)
+
+ return new_lines.splitlines(True)
+
class Preprocessor(object):
"""
This class knows how to remove certain
@@ -61,33 +78,13 @@
# Strings are replaced with blanks
line = self._literal_chars.sub(lambda k: "'%s'" % ((len(k.group(0))-2)*" "),line)
line = self._literal_strings.sub(lambda k: '"%s"' % ((len(k.group(0))-2)*" "),line)
-
- # Strip comments and strings
- # Multiline comments
- start_idx = line.find('/*')
- if not in_comment:
- if start_idx != -1:
- stop_idx = line.find("*/",start_idx+2)
- if stop_idx != -1:
- line = line[:start_idx] + line[stop_idx+2:]
- else:
- line = line[:start_idx].strip()
- in_comment = True
-
- if in_comment:
- stop_idx = line.find('*/')
- if stop_idx == -1:
- line = ""
- else:
- line = line[stop_idx+2:].strip()
- in_comment = False
-
- # Single line comments
- idx = line.find('//')
- if idx != -1:
- line = line[:idx].strip()
+
+ # Remove whitespace followed by single-line comment (old behaviour)
+ line = re.sub(r"\s*//.*$", "", line)
new_lines.append( line )
+
+ new_lines = strip_multi_line_c_comments(new_lines)
self._stripped_comments_and_strings[fn] = new_lines
=== modified file 'cmake/codecheck/rules/missing_padding'
--- cmake/codecheck/rules/missing_padding 2010-11-01 12:45:13 +0000
+++ cmake/codecheck/rules/missing_padding 2012-06-08 22:38:40 +0000
@@ -292,7 +292,7 @@
allowed = [
"RoutingNode * a;",
"Blahtype & b;",
- "/** Some comment",
+ "/** Some comment **/",
"std::vector<RoutingNode *> & nodes",
"if (a && b)",
"\tOpen.push(&start);",
@@ -368,5 +368,8 @@
"friend class NoteReceiver<T>;",
'a %= a;',
+
+ 'Texture const & /* f_r_texture */',
+ 'int32_t estimate(Map & /* map */, FCoords /* pos */) const {return 0;}',
]
=== modified file 'cmake/codecheck/run_tests.py'
--- cmake/codecheck/run_tests.py 2012-02-15 21:25:34 +0000
+++ cmake/codecheck/run_tests.py 2012-06-08 22:38:40 +0000
@@ -45,6 +45,41 @@
return allowed_tests + forbidden_tests
+class CommentsTest(unittest.TestCase):
+ """
+ Tests that comment stripping is working correctly
+ """
+ def __init__(self, before, after):
+ unittest.TestCase.__init__(self)
+ self.before = before
+ self.after = after
+
+ def runTest(self):
+ preprocessor = Preprocessor()
+ after = preprocessor.get_preprocessed_data("test", self.before, True, False)
+ self.assertTrue(after == self.after,
+ "Stripping comments from %r failed. Expected %r, got %r"
+ % (self.before, self.after, after)
+ )
+
+comment_tests = [
+ # Let's get the basics right.
+ ("a b c",
+ "a b c"),
+ # Whitespace before comments should be stripped
+ ("a b c // a",
+ "a b c"),
+ # Single line comment shouldn't affect the next line
+ ("a b c // a\nd e",
+ "a b c\nd e"),
+ # Multi-line comments should retain original line numbering
+ ("a /* \n b \n */ c",
+ "a \n\n c"),
+ # Multiple comments on one line should work
+ ("int32_t estimate(Map & /* map */, FCoords /* pos */) const {return 0;}\ntest",
+ "int32_t estimate(Map & " ", FCoords " ") const {return 0;}\ntest"),
+]
+
if __name__ == '__main__':
import sys
@@ -60,4 +95,7 @@
for checker in d._checkers:
suite.addTests( _make_tests_from_checker(checker) )
+ for before, after in comment_tests:
+ suite.addTest(CommentsTest(before, after.splitlines(True)))
+
unittest.TextTestRunner(verbosity=1).run(suite)
=== modified file 'src/economy/economy.cc'
--- src/economy/economy.cc 2012-02-15 21:25:34 +0000
+++ src/economy/economy.cc 2012-06-08 22:38:40 +0000
@@ -188,7 +188,7 @@
}
struct ZeroEstimator {
- int32_t operator()(RoutingNode & node) const {return 0;}
+ int32_t operator()(RoutingNode & /* node */) const {return 0;}
};
/**
=== modified file 'src/economy/fleet.cc'
--- src/economy/fleet.cc 2012-04-04 20:39:25 +0000
+++ src/economy/fleet.cc 2012-06-08 22:38:40 +0000
@@ -116,8 +116,8 @@
}
struct StepEvalFindFleet {
- int32_t estimate(Map & map, FCoords pos) const {return 0;}
- int32_t stepcost(Map & map, FCoords from, int32_t fromcost, WalkingDir dir, FCoords to) const {
+ int32_t estimate(Map & /* map */, FCoords /* pos */) const {return 0;}
+ int32_t stepcost(Map & /* map */, FCoords from, int32_t fromcost, WalkingDir /* dir */, FCoords to) const {
if (!(to.field->nodecaps() & (MOVECAPS_SWIM | MOVECAPS_WALK)))
return -1;
@@ -402,7 +402,7 @@
return std::max(0, est - 5 * map.calc_cost(0));
}
- int32_t stepcost(Map & map, FCoords from, int32_t fromcost, WalkingDir dir, FCoords to) const
+ int32_t stepcost(Map & map, FCoords from, int32_t /* fromcost */, WalkingDir dir, FCoords to) const
{
if (!(to.field->nodecaps() & MOVECAPS_SWIM))
return -1;
@@ -493,7 +493,7 @@
}
}
-void Fleet::add_port(Editor_Game_Base & egbase, PortDock * port)
+void Fleet::add_port(Editor_Game_Base & /* egbase */, PortDock * port)
{
m_ports.push_back(port);
port->set_fleet(this);
@@ -584,7 +584,7 @@
*
* @note Do not call this directly; instead, trigger it via @ref update
*/
-void Fleet::act(Game & game, uint32_t data)
+void Fleet::act(Game & game, uint32_t /* data */)
{
m_act_pending = false;
=== modified file 'src/editor/tools/editor_decrease_height_tool.cc'
--- src/editor/tools/editor_decrease_height_tool.cc 2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_decrease_height_tool.cc 2012-06-08 22:38:40 +0000
@@ -30,7 +30,7 @@
int32_t Editor_Decrease_Height_Tool::handle_click_impl
(Widelands::Map & map,
Widelands::Node_and_Triangle<> center,
- Editor_Interactive & parent,
+ Editor_Interactive & /* parent */,
Editor_Action_Args & args)
{
if (args.origHights.empty()) {
@@ -52,7 +52,7 @@
int32_t Editor_Decrease_Height_Tool::handle_undo_impl
(Widelands::Map & map,
Widelands::Node_and_Triangle<> center,
- Editor_Interactive & parent,
+ Editor_Interactive & /* parent */,
Editor_Action_Args & args)
{
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
=== modified file 'src/editor/tools/editor_decrease_resources_tool.cc'
--- src/editor/tools/editor_decrease_resources_tool.cc 2012-05-01 15:56:04 +0000
+++ src/editor/tools/editor_decrease_resources_tool.cc 2012-06-08 22:38:40 +0000
@@ -37,7 +37,7 @@
int32_t Editor_Decrease_Resources_Tool::handle_click_impl
(Widelands::Map & map,
Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent,
+ Editor_Interactive & /* parent */,
Editor_Action_Args & args)
{
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
=== modified file 'src/editor/tools/editor_draw_tool.cc'
--- src/editor/tools/editor_draw_tool.cc 2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_draw_tool.cc 2012-06-08 22:38:40 +0000
@@ -37,8 +37,8 @@
}
int32_t Editor_Draw_Tool::handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<Widelands::Coords> center,
- Editor_Interactive & parent, Editor_Action_Args & args)
+ (Widelands::Map & /* map */, Widelands::Node_and_Triangle<Widelands::Coords> /* center */,
+ Editor_Interactive & /* parent */, Editor_Action_Args & args)
{
for
@@ -54,8 +54,8 @@
}
int32_t Editor_Draw_Tool::handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<Widelands::Coords> center,
- Editor_Interactive & parent, Editor_Action_Args & args)
+ (Widelands::Map & /* map */, Widelands::Node_and_Triangle<Widelands::Coords> /* center */,
+ Editor_Interactive & /* parent */, Editor_Action_Args & args)
{
for
(std::list<Editor_Tool_Action *>::reverse_iterator i = args.draw_actions.rbegin();
=== modified file 'src/editor/tools/editor_increase_height_tool.cc'
--- src/editor/tools/editor_increase_height_tool.cc 2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_increase_height_tool.cc 2012-06-08 22:38:40 +0000
@@ -28,7 +28,7 @@
int32_t Editor_Increase_Height_Tool::handle_click_impl
(Widelands::Map & map,
Widelands::Node_and_Triangle<> center,
- Editor_Interactive & parent,
+ Editor_Interactive & /* parent */,
Editor_Action_Args & args)
{
if (args.origHights.empty()) {
=== modified file 'src/editor/tools/editor_increase_resources_tool.cc'
--- src/editor/tools/editor_increase_resources_tool.cc 2012-05-18 12:31:47 +0000
+++ src/editor/tools/editor_increase_resources_tool.cc 2012-06-08 22:38:40 +0000
@@ -75,7 +75,7 @@
int32_t Editor_Increase_Resources_Tool::handle_click_impl
(Widelands::Map & map,
Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent,
+ Editor_Interactive & /* parent */,
Editor_Action_Args & args)
{
Widelands::World const & world = map.world();
=== modified file 'src/editor/tools/editor_info_tool.cc'
--- src/editor/tools/editor_info_tool.cc 2012-03-19 06:03:18 +0000
+++ src/editor/tools/editor_info_tool.cc 2012-06-08 22:38:40 +0000
@@ -35,7 +35,7 @@
(Widelands::Map & map,
Widelands::Node_and_Triangle<> const center,
Editor_Interactive & parent,
- Editor_Action_Args & args)
+ Editor_Action_Args & /* args */)
{
Widelands::World const & world = map.world();
UI::Window * const w =
=== modified file 'src/editor/tools/editor_make_infrastructure_tool.cc'
--- src/editor/tools/editor_make_infrastructure_tool.cc 2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_make_infrastructure_tool.cc 2012-06-08 22:38:40 +0000
@@ -51,7 +51,7 @@
(Widelands::Map &,
Widelands::Node_and_Triangle<> const,
Editor_Interactive & parent,
- Editor_Action_Args & args)
+ Editor_Action_Args & /* args */)
{
show_field_action
(&parent, parent.egbase().get_player(m_player), &m_registry);
=== modified file 'src/editor/tools/editor_noise_height_tool.cc'
--- src/editor/tools/editor_noise_height_tool.cc 2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_noise_height_tool.cc 2012-06-08 22:38:40 +0000
@@ -30,7 +30,7 @@
int32_t Editor_Noise_Height_Tool::handle_click_impl
(Widelands::Map & map,
Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent,
+ Editor_Interactive & /* parent */,
Editor_Action_Args & args)
{
if (args.origHights.empty()) {
=== modified file 'src/editor/tools/editor_set_height_tool.cc'
--- src/editor/tools/editor_set_height_tool.cc 2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_set_height_tool.cc 2012-06-08 22:38:40 +0000
@@ -30,7 +30,7 @@
int32_t Editor_Set_Height_Tool::handle_click_impl
(Widelands::Map & map,
Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent, Editor_Action_Args & args)
+ Editor_Interactive & /* parent */, Editor_Action_Args & args)
{
if (args.origHights.empty())
{
@@ -50,7 +50,7 @@
int32_t Editor_Set_Height_Tool::handle_undo_impl
(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args)
+ Editor_Interactive & /* parent */, Editor_Action_Args & args)
{
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
=== modified file 'src/editor/tools/editor_set_origin_tool.cc'
--- src/editor/tools/editor_set_origin_tool.cc 2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_set_origin_tool.cc 2012-06-08 22:38:40 +0000
@@ -28,7 +28,7 @@
(Widelands::Map & map,
Widelands::Node_and_Triangle<> const center,
Editor_Interactive & eia,
- Editor_Action_Args & args)
+ Editor_Action_Args & /* args */)
{
map.set_origin(center.node);
map.overlay_manager().reset();
@@ -43,7 +43,7 @@
int32_t Editor_Set_Origin_Tool::handle_undo_impl
(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args)
+ Editor_Interactive & parent, Editor_Action_Args & /* args */)
{
Widelands::Coords nc
(map.get_width() - center.node.x,
=== modified file 'src/editor/tools/editor_set_resources_tool.cc'
--- src/editor/tools/editor_set_resources_tool.cc 2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_set_resources_tool.cc 2012-06-08 22:38:40 +0000
@@ -34,7 +34,7 @@
int32_t Editor_Set_Resources_Tool::handle_click_impl
(Widelands::Map & map,
Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent,
+ Editor_Interactive & /* parent */,
Editor_Action_Args & args)
{
Widelands::World const & world = map.world();
@@ -88,7 +88,7 @@
int32_t Editor_Set_Resources_Tool::handle_undo_impl
(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args)
+ Editor_Interactive & /* parent */, Editor_Action_Args & args)
{
Widelands::World const & world = map.world();
Overlay_Manager & overlay_manager = map.overlay_manager();
=== modified file 'src/editor/tools/editor_set_terrain_tool.cc'
--- src/editor/tools/editor_set_terrain_tool.cc 2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_set_terrain_tool.cc 2012-06-08 22:38:40 +0000
@@ -28,7 +28,7 @@
int32_t Editor_Set_Terrain_Tool::handle_click_impl
(Widelands::Map & map,
Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent, Editor_Action_Args & args)
+ Editor_Interactive & /* parent */, Editor_Action_Args & args)
{
assert
(center.triangle.t == TCoords<>::D or center.triangle.t == TCoords<>::R);
@@ -69,7 +69,7 @@
int32_t Editor_Set_Terrain_Tool::handle_undo_impl
(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args)
+ Editor_Interactive & /* parent */, Editor_Action_Args & args)
{
assert
(center.triangle.t == TCoords<>::D or center.triangle.t == TCoords<>::R);
=== modified file 'src/graphic/render/gameview.cc'
--- src/graphic/render/gameview.cc 2012-03-02 13:21:49 +0000
+++ src/graphic/render/gameview.cc 2012-06-08 22:38:40 +0000
@@ -1014,16 +1014,16 @@
*/
void GameView::draw_field
- (Rect & subwin,
- Vertex const & f_vert,
- Vertex const & r_vert,
- Vertex const & bl_vert,
- Vertex const & br_vert,
- uint8_t roads,
- Texture const & tr_d_texture,
- Texture const & l_r_texture,
- Texture const & f_d_texture,
- Texture const & f_r_texture)
+ (Rect & /* subwin */,
+ Vertex const & /* f_vert */,
+ Vertex const & /* r_vert */,
+ Vertex const & /* bl_vert */,
+ Vertex const & /* br_vert */,
+ uint8_t /* roads */,
+ Texture const & /* tr_d_texture */,
+ Texture const & /* l_r_texture */,
+ Texture const & /* f_d_texture */,
+ Texture const & /* f_r_texture */)
{
}
=== modified file 'src/logic/carrier.cc'
--- src/logic/carrier.cc 2012-03-23 16:08:40 +0000
+++ src/logic/carrier.cc 2012-06-08 22:38:40 +0000
@@ -123,7 +123,7 @@
* a second carrier (ox or something). If we promised a flag that we would pick up
* a ware there, we have to make sure that they do not count on us anymore.
*/
-void Carrier::road_pop(Game & game, State & state)
+void Carrier::road_pop(Game & game, State & /* state */)
{
if (m_promised_pickup_to != NOONE && get_location(game)) {
Road & road = ref_cast<Road, PlayerImmovable>(*get_location(game));
=== modified file 'src/logic/immovable.cc'
--- src/logic/immovable.cc 2012-04-06 19:26:17 +0000
+++ src/logic/immovable.cc 2012-06-08 22:38:40 +0000
@@ -1240,7 +1240,7 @@
*
* If the immovable is not currently in construction mode, return \c false.
*/
-bool Immovable::construct_remaining_buildcost(Game & game, Buildcost * buildcost)
+bool Immovable::construct_remaining_buildcost(Game & /* game */, Buildcost * buildcost)
{
ActConstructionData * d = get_action_data<ActConstructionData>();
if (!d)
=== modified file 'src/logic/legacy.cc'
--- src/logic/legacy.cc 2012-02-15 21:25:34 +0000
+++ src/logic/legacy.cc 2012-06-08 22:38:40 +0000
@@ -376,7 +376,7 @@
struct Loader : public BaseImmovable::Loader {
- virtual void load(FileRead & fr, uint8_t const version) {
+ virtual void load(FileRead & fr, uint8_t const /* version */) {
BaseImmovable::Loader::load(fr);
try {
@@ -457,7 +457,7 @@
}
struct Loader : public BaseImmovable::Loader {
- virtual void load(FileRead & fr, uint8_t const version) {
+ virtual void load(FileRead & fr, uint8_t const /* version */) {
BaseImmovable::Loader::load(fr);
fr.Unsigned32();
=== modified file 'src/logic/mapastar.h'
--- src/logic/mapastar.h 2011-11-30 21:38:37 +0000
+++ src/logic/mapastar.h 2012-06-08 22:38:40 +0000
@@ -70,7 +70,7 @@
return est;
}
- int32_t stepcost(Map & map, FCoords from, int32_t fromcost, WalkingDir dir, FCoords to) const
+ int32_t stepcost(Map & map, FCoords from, int32_t /* fromcost */, WalkingDir dir, FCoords to) const
{
if
((m_swim && !(to.field->nodecaps() & MOVECAPS_SWIM)) ||
=== modified file 'src/logic/production_program.cc'
--- src/logic/production_program.cc 2012-04-06 19:26:17 +0000
+++ src/logic/production_program.cc 2012-06-08 22:38:40 +0000
@@ -931,7 +931,7 @@
}
bool ProductionProgram::ActProduce::get_building_work
- (Game & game, ProductionSite & psite, Worker & worker) const
+ (Game & game, ProductionSite & psite, Worker & /* worker */) const
{
// We reach this point once all wares have been carried outside the building
psite.program_step(game);
@@ -1022,7 +1022,7 @@
}
bool ProductionProgram::ActRecruit::get_building_work
- (Game & game, ProductionSite & psite, Worker & worker) const
+ (Game & game, ProductionSite & psite, Worker & /* worker */) const
{
// We reach this point once all recruits have been guided outside the building
psite.program_step(game);
=== modified file 'src/logic/productionsite.cc'
--- src/logic/productionsite.cc 2012-06-06 14:51:03 +0000
+++ src/logic/productionsite.cc 2012-06-08 22:38:40 +0000
@@ -265,7 +265,7 @@
* Detect if the workers are experienced enough for an upgrade
* @param idx Index of the enhanchement
*/
-bool ProductionSite::has_workers(Building_Index targetSite, Game & game)
+bool ProductionSite::has_workers(Building_Index targetSite, Game & /* game */)
{
// bld holds the description of the building we want to have
if (upcast(ProductionSite_Descr const, bld, tribe().get_building_descr(targetSite))) {
@@ -504,7 +504,7 @@
void ProductionSite::request_worker_callback
(Game & game,
Request & rq,
- Ware_Index widx,
+ Ware_Index /* widx */,
Worker * const w,
PlayerImmovable & target)
{
=== modified file 'src/logic/warehouse.cc'
--- src/logic/warehouse.cc 2012-06-06 19:32:13 +0000
+++ src/logic/warehouse.cc 2012-06-08 22:38:40 +0000
@@ -178,13 +178,13 @@
return true;
}
-void WarehouseSupply::get_ware_type(WareWorker & type, Ware_Index & ware) const
+void WarehouseSupply::get_ware_type(WareWorker & /* type */, Ware_Index & /* ware */) const
{
throw wexception
("WarehouseSupply::get_ware_type: calling this is nonsensical");
}
-void WarehouseSupply::send_to_storage(Game &, Warehouse * wh)
+void WarehouseSupply::send_to_storage(Game &, Warehouse * /* wh */)
{
throw wexception("WarehouseSupply::send_to_storage: should never be called");
}
@@ -795,7 +795,7 @@
* requirements.
*/
uint32_t Warehouse::count_workers
- (Game const & game, Ware_Index ware, Requirements const & req)
+ (Game const & /* game */, Ware_Index ware, Requirements const & req)
{
uint32_t sum = 0;
@@ -982,7 +982,7 @@
/**
* Receive a ware from a transfer that was not associated to a \ref Request.
*/
-void Warehouse::receive_ware(Game & game, Ware_Index ware)
+void Warehouse::receive_ware(Game & /* game */, Ware_Index ware)
{
m_supply->add_wares(ware, 1);
}
@@ -1063,7 +1063,7 @@
* Return the number of workers of the given type that we plan to
* create in this warehouse.
*/
-uint32_t Warehouse::get_planned_workers(Game & game, Ware_Index index) const
+uint32_t Warehouse::get_planned_workers(Game & /* game */, Ware_Index index) const
{
container_iterate_const(std::vector<PlannedWorkers>, m_planned_workers, i) {
if (i.current->index == index)
@@ -1080,7 +1080,7 @@
* This is the current stock plus any incoming transfers.
*/
std::vector<uint32_t> Warehouse::calc_available_for_worker
- (Game & game, Ware_Index index) const
+ (Game & /* game */, Ware_Index index) const
{
const Worker_Descr & w_desc = *tribe().get_worker_descr(index);
const Worker_Descr::Buildcost & cost = w_desc.buildcost();
@@ -1395,7 +1395,7 @@
return 0;
}
-int Warehouse::outcorporateSoldier(Editor_Game_Base & egbase, Soldier & soldier) {
+int Warehouse::outcorporateSoldier(Editor_Game_Base & /* egbase */, Soldier & soldier) {
Ware_Index const ware = tribe().safe_worker_index("soldier");
if (m_incorporated_workers.count(ware)) {
=== modified file 'src/logic/warehouse.h'
--- src/logic/warehouse.h 2012-02-15 21:25:34 +0000
+++ src/logic/warehouse.h 2012-06-08 22:38:40 +0000
@@ -152,7 +152,7 @@
uint32_t minSoldierCapacity() const {return 0;}
uint32_t maxSoldierCapacity() const {return 4294967295U;}
uint32_t soldierCapacity() const {return maxSoldierCapacity();}
- void setSoldierCapacity(uint32_t capacity) {
+ void setSoldierCapacity(uint32_t /* capacity */) {
throw wexception("Not implemented for a Warehouse!");
}
void dropSoldier(Soldier &) {
=== modified file 'src/logic/worker.cc'
--- src/logic/worker.cc 2012-06-01 05:44:53 +0000
+++ src/logic/worker.cc 2012-06-08 22:38:40 +0000
@@ -994,7 +994,7 @@
* If we are currently carrying some ware item, hand it off to the currently
* selected immovable (\ref objvar1) for construction.
*/
-bool Worker::run_construct(Game & game, State & state, Action const & action)
+bool Worker::run_construct(Game & game, State & state, Action const & /* action */)
{
Immovable * imm = dynamic_cast<Immovable *>(state.objvar1.get(game));
if (!imm) {
@@ -1274,7 +1274,7 @@
*
* This sets the needed experience on a value between max and min
*/
-void Worker::create_needed_experience(Game & game)
+void Worker::create_needed_experience(Game & /* game */)
{
if (descr().get_level_experience() == -1) {
m_current_exp = -1;
@@ -1393,7 +1393,7 @@
}
}
-void Worker::transfer_pop(Game & game, State & state)
+void Worker::transfer_pop(Game & /* game */, State & /* state */)
{
if (m_transfer) {
m_transfer->has_failed();
@@ -1401,7 +1401,7 @@
}
}
-void Worker::transfer_update(Game & game, State & state) {
+void Worker::transfer_update(Game & game, State & /* state */) {
Map & map = game.map();
PlayerImmovable * location = get_location(game);
@@ -1635,7 +1635,7 @@
return get_state(taskShipping);
}
-void Worker::shipping_pop(Game & game, State & state)
+void Worker::shipping_pop(Game & game, State & /* state */)
{
// Defense against unorderly cleanup via reset_tasks
if (!get_location(game)) {
@@ -1953,7 +1953,7 @@
}
-void Worker::gowarehouse_update(Game & game, State & state)
+void Worker::gowarehouse_update(Game & game, State & /* state */)
{
PlayerImmovable * const location = get_location(game);
@@ -2021,7 +2021,7 @@
}
void Worker::gowarehouse_signalimmediate
- (Game &, State & state, std::string const & signal)
+ (Game &, State & /* state */, std::string const & signal)
{
if (signal == "transfer") {
// We are assigned a transfer, make sure our supply disappears immediately
=== modified file 'src/map_io/widelands_map_bob_data_packet.cc'
--- src/map_io/widelands_map_bob_data_packet.cc 2012-02-15 21:25:34 +0000
+++ src/map_io/widelands_map_bob_data_packet.cc 2012-06-08 22:38:40 +0000
@@ -142,7 +142,7 @@
void Map_Bob_Data_Packet::Write
- (FileSystem & fs, Editor_Game_Base & egbase, Map_Map_Object_Saver & mos)
+ (FileSystem & /* fs */, Editor_Game_Base & /* egbase */, Map_Map_Object_Saver & /* mos */)
throw (_wexception)
{
throw wexception("bob packet is deprecated");
=== modified file 'src/map_io/widelands_map_bobdata_data_packet.cc'
--- src/map_io/widelands_map_bobdata_data_packet.cc 2012-03-23 16:08:40 +0000
+++ src/map_io/widelands_map_bobdata_data_packet.cc 2012-06-08 22:38:40 +0000
@@ -557,7 +557,7 @@
void Map_Bobdata_Data_Packet::Write
- (FileSystem & fs, Editor_Game_Base & egbase, Map_Map_Object_Saver & mos)
+ (FileSystem & /* fs */, Editor_Game_Base & /* egbase */, Map_Map_Object_Saver & /* mos */)
throw (_wexception)
{
throw wexception("bobdata packet is deprecated");
=== modified file 'src/map_io/widelands_map_ware_data_packet.cc'
--- src/map_io/widelands_map_ware_data_packet.cc 2012-02-15 21:25:34 +0000
+++ src/map_io/widelands_map_ware_data_packet.cc 2012-06-08 22:38:40 +0000
@@ -80,7 +80,7 @@
void Map_Ware_Data_Packet::Write
- (FileSystem & fs, Editor_Game_Base & egbase, Map_Map_Object_Saver & mos)
+ (FileSystem & /* fs */, Editor_Game_Base & /* egbase */, Map_Map_Object_Saver & /* mos */)
throw (_wexception)
{
throw wexception("Map_Ware_Data_Packet::Write is obsolete");
=== modified file 'src/map_io/widelands_map_waredata_data_packet.cc'
--- src/map_io/widelands_map_waredata_data_packet.cc 2012-02-15 21:25:34 +0000
+++ src/map_io/widelands_map_waredata_data_packet.cc 2012-06-08 22:38:40 +0000
@@ -211,7 +211,7 @@
void Map_Waredata_Data_Packet::Write
- (FileSystem & fs, Editor_Game_Base & egbase, Map_Map_Object_Saver & mos)
+ (FileSystem & /* fs */, Editor_Game_Base & /* egbase */, Map_Map_Object_Saver & /* mos */)
throw (_wexception)
{
throw wexception("Map_Waredata_Data_Packet::Write is obsolete");
=== modified file 'src/network/netclient.cc'
--- src/network/netclient.cc 2012-02-15 21:25:34 +0000
+++ src/network/netclient.cc 2012-06-08 22:38:40 +0000
@@ -391,7 +391,11 @@
return true;
}
-void NetClient::setMap(std::string const & name, std::string const & path, uint32_t players, bool savegame)
+void NetClient::setMap
+ (std::string const & name,
+ std::string const & path,
+ uint32_t /* players */,
+ bool savegame)
{
// only accessible, if server is a dedicated server and access is granted
if (!m_dedicated_access)
@@ -410,7 +414,7 @@
// client is not allowed to do this
}
-void NetClient::setPlayerAI(uint8_t, std::string const &, bool const random_ai)
+void NetClient::setPlayerAI(uint8_t, std::string const &, bool const /* random_ai */)
{
// client is not allowed to do this
}
@@ -562,7 +566,7 @@
return false;
}
-void NetClient::setPaused(bool paused)
+void NetClient::setPaused(bool /* paused */)
{
}
=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc 2012-06-06 19:32:13 +0000
+++ src/network/nethost.cc 2012-06-08 22:38:40 +0000
@@ -1845,7 +1845,7 @@
return false;
}
-void NetHost::setPaused(bool paused)
+void NetHost::setPaused(bool /* paused */)
{
}
=== modified file 'src/scripting/lua_bases.cc'
--- src/scripting/lua_bases.cc 2012-02-15 21:25:34 +0000
+++ src/scripting/lua_bases.cc 2012-06-08 22:38:40 +0000
@@ -80,9 +80,9 @@
};
-void L_EditorGameBase::__persist(lua_State * L) {
+void L_EditorGameBase::__persist(lua_State * /* L */) {
}
-void L_EditorGameBase::__unpersist(lua_State * L) {
+void L_EditorGameBase::__unpersist(lua_State * /* L */) {
}
/*
=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc 2012-05-25 19:23:11 +0000
+++ src/scripting/lua_map.cc 2012-06-08 22:38:40 +0000
@@ -804,9 +804,9 @@
{0, 0, 0},
};
-void L_Map::__persist(lua_State * L) {
+void L_Map::__persist(lua_State * /* L */) {
}
-void L_Map::__unpersist(lua_State * L) {
+void L_Map::__unpersist(lua_State * /* L */) {
}
/*
=== modified file 'src/scripting/lua_root.cc'
--- src/scripting/lua_root.cc 2012-02-15 21:25:34 +0000
+++ src/scripting/lua_root.cc 2012-06-08 22:38:40 +0000
@@ -85,13 +85,13 @@
{0, 0, 0},
};
-L_Game::L_Game(lua_State * L) {
+L_Game::L_Game(lua_State * /* L */) {
// Nothing to do.
}
-void L_Game::__persist(lua_State * L) {
+void L_Game::__persist(lua_State * /* L */) {
}
-void L_Game::__unpersist(lua_State * L) {
+void L_Game::__unpersist(lua_State * /* L */) {
}
@@ -247,13 +247,13 @@
{0, 0, 0},
};
-L_Editor::L_Editor(lua_State * L) {
+L_Editor::L_Editor(lua_State * /* L */) {
// Nothing to do.
}
-void L_Editor::__persist(lua_State * L) {
+void L_Editor::__persist(lua_State * /* L */) {
}
-void L_Editor::__unpersist(lua_State * L) {
+void L_Editor::__unpersist(lua_State * /* L */) {
}
/*
=== modified file 'src/scripting/lua_ui.cc'
--- src/scripting/lua_ui.cc 2012-03-07 12:15:32 +0000
+++ src/scripting/lua_ui.cc 2012-06-08 22:38:40 +0000
@@ -363,7 +363,7 @@
Press and hold this button. This is mainly to visualize a pressing
event in tutorials
*/
-int L_Button::press(lua_State * L) {
+int L_Button::press(lua_State * /* L */) {
get()->handle_mousein(true);
get()->handle_mousepress(SDL_BUTTON_LEFT, 1, 1);
return 0;
@@ -374,7 +374,7 @@
Click this button just as if the user would have moused over and clicked
it.
*/
-int L_Button::click(lua_State * L) {
+int L_Button::click(lua_State * /* L */) {
get()->handle_mousein(true);
get()->handle_mousepress(SDL_BUTTON_LEFT, 1, 1);
get()->handle_mouserelease(SDL_BUTTON_LEFT, 1, 1);
@@ -434,7 +434,7 @@
Click this tab making it the active one.
*/
-int L_Tab::click(lua_State * L) {
+int L_Tab::click(lua_State * /* L */) {
get()->activate();
return 0;
}
@@ -483,7 +483,7 @@
Closes this window. This invalidates this Object, do
not use it any longer.
*/
-int L_Window::close(lua_State * L) {
+int L_Window::close(lua_State * /* L */) {
delete m_panel;
m_panel = 0;
return 0;
@@ -683,7 +683,7 @@
If he wasn't, this will do nothing.
*/
// UNTESTED
-int L_MapView::abort_road_building(lua_State * L) {
+int L_MapView::abort_road_building(lua_State * /* L */) {
Interactive_Base * me = get();
if (me->is_building_road())
me->abort_build_road();
@@ -699,7 +699,7 @@
This is especially useful for automated testing of features and is for
example used in the widelands Lua test suite.
*/
-int L_MapView::close(lua_State * l) {
+int L_MapView::close(lua_State * /* l */) {
get()->end_modal(0);
return 0;
}
=== modified file 'src/scripting/persistence.cc'
--- src/scripting/persistence.cc 2012-02-15 21:25:34 +0000
+++ src/scripting/persistence.cc 2012-06-08 22:38:40 +0000
@@ -188,7 +188,7 @@
uint32_t unpersist_object
(lua_State * L,
Widelands::FileRead & fr, Widelands::Map_Map_Object_Loader & mol,
- uint32_t size)
+ uint32_t /* size */)
{
// Save the mol in the registry
lua_pushlightuserdata(L, &mol);
=== modified file 'src/scripting/pluto.cc'
--- src/scripting/pluto.cc 2010-11-21 11:44:22 +0000
+++ src/scripting/pluto.cc 2012-06-08 22:38:40 +0000
@@ -1267,7 +1267,7 @@
}
}
-static void unpersistuserdata(int ref, UnpersistInfo * upi)
+static void unpersistuserdata(int /* ref */, UnpersistInfo * upi)
{
/* perms reftbl ... */
lua_checkstack(upi->L, 2);
=== modified file 'src/scripting/test/test_luna.cc'
--- src/scripting/test/test_luna.cc 2012-02-15 21:25:34 +0000
+++ src/scripting/test/test_luna.cc 2012-06-08 22:38:40 +0000
@@ -41,7 +41,7 @@
const char * get_modulename() {return "test";}
L_Class() :x(123), prop(246) {}
virtual ~L_Class() {}
- L_Class(lua_State *L) :x(124), prop(248) {}
+ L_Class(lua_State * /* L */) :x(124), prop(248) {}
virtual int test(lua_State *L)
{
lua_pushuint32(L, x);
@@ -62,8 +62,8 @@
prop = lua_tointeger(L, -1);
return 0;
}
- virtual void __persist(lua_State * L) {}
- virtual void __unpersist(lua_State * L) {}
+ virtual void __persist(lua_State * /* L */) {}
+ virtual void __unpersist(lua_State * /* L */) {}
};
const char L_Class::className[] = "Class";
const MethodType<L_Class> L_Class::Methods[] = {
@@ -87,8 +87,8 @@
lua_pushuint32(L, y);
return 1;
}
- virtual void __persist(lua_State * L) {}
- virtual void __unpersist(lua_State * L) {}
+ virtual void __persist(lua_State * /* L */) {}
+ virtual void __unpersist(lua_State * /* L */) {}
};
const char L_SubClass::className[] = "SubClass";
const MethodType<L_SubClass> L_SubClass::Methods[] = {
@@ -110,8 +110,8 @@
lua_pushuint32(L, z);
return 1;
}
- virtual void __persist(lua_State * L) {}
- virtual void __unpersist(lua_State * L) {}
+ virtual void __persist(lua_State * /* L */) {}
+ virtual void __unpersist(lua_State * /* L */) {}
};
const char L_VirtualClass::className[] = "VirtualClass";
const MethodType<L_VirtualClass> L_VirtualClass::Methods[] = {
@@ -144,8 +144,8 @@
lua_pushuint32(L, z);
return 1;
}
- virtual void __persist(lua_State * L) {}
- virtual void __unpersist(lua_State * L) {}
+ virtual void __persist(lua_State * /* L */) {}
+ virtual void __unpersist(lua_State * /* L */) {}
};
const char L_MultiClass::className[] = "MultiClass";
const MethodType<L_MultiClass> L_MultiClass::Methods[] = {
=== modified file 'src/ui_basic/multilinetextarea.cc'
--- src/ui_basic/multilinetextarea.cc 2012-02-15 21:25:34 +0000
+++ src/ui_basic/multilinetextarea.cc 2012-06-08 22:38:40 +0000
@@ -150,7 +150,7 @@
/**
* Callback from the scrollbar.
*/
-void Multiline_Textarea::scrollpos_changed(int32_t const pixels)
+void Multiline_Textarea::scrollpos_changed(int32_t const /* pixels */)
{
update(0, 0, get_eff_w(), get_h());
}
=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc 2012-02-21 19:36:34 +0000
+++ src/ui_basic/panel.cc 2012-06-08 22:38:40 +0000
@@ -668,7 +668,7 @@
* It should be only overwritten by the UI::Window class.
* \return true if the click was processed, false otherwise
*/
-bool Panel::handle_alt_drag(int32_t x, int32_t y)
+bool Panel::handle_alt_drag(int32_t /* x */, int32_t /* y */)
{
return false;
}
=== modified file 'src/ui_basic/textarea.cc'
--- src/ui_basic/textarea.cc 2012-02-15 21:25:34 +0000
+++ src/ui_basic/textarea.cc 2012-06-08 22:38:40 +0000
@@ -241,7 +241,7 @@
* Set both the actual and the desired size to the
* size needed to fit the given \p text.
*/
-void Textarea::set_fixed_size(const std::string & text)
+void Textarea::set_fixed_size(const std::string & /* text */)
{
uint32_t w = m_textstyle.calc_bare_width(m_text);
uint32_t h = m_textstyle.font->height();
=== modified file 'src/ui_fsmenu/launchSPG.cc'
--- src/ui_fsmenu/launchSPG.cc 2012-03-07 09:39:47 +0000
+++ src/ui_fsmenu/launchSPG.cc 2012-06-08 22:38:40 +0000
@@ -39,7 +39,7 @@
Fullscreen_Menu_LaunchSPG::Fullscreen_Menu_LaunchSPG
(GameSettingsProvider * const settings, GameController * const ctrl,
- bool autolaunch)
+ bool /* autolaunch */)
:
Fullscreen_Menu_Base("launchgamemenu.jpg"),
=== modified file 'src/wui/chatoverlay.cc'
--- src/wui/chatoverlay.cc 2012-02-15 21:25:34 +0000
+++ src/wui/chatoverlay.cc 2012-06-08 22:38:40 +0000
@@ -85,7 +85,7 @@
/**
* Callback that is run when a new chat message comes in.
*/
-void ChatOverlay::Impl::receive(const ChatMessage & note)
+void ChatOverlay::Impl::receive(const ChatMessage & /* note */)
{
recompute();
}
=== modified file 'src/wui/game_message_menu.cc'
--- src/wui/game_message_menu.cc 2012-02-15 21:25:34 +0000
+++ src/wui/game_message_menu.cc 2012-06-08 22:38:40 +0000
@@ -242,7 +242,7 @@
/**
* a message was double clicked
*/
-void GameMessageMenu::double_clicked(uint32_t const t) {
+void GameMessageMenu::double_clicked(uint32_t const /* t */) {
if (m_centerviewbtn->enabled()) center_view();
}
=== modified file 'src/wui/multiplayersetupgroup.cc'
--- src/wui/multiplayersetupgroup.cc 2012-02-15 21:25:34 +0000
+++ src/wui/multiplayersetupgroup.cc 2012-06-08 22:38:40 +0000
@@ -38,7 +38,7 @@
struct MultiPlayerClientGroup : public UI::Box {
MultiPlayerClientGroup
(UI::Panel * const parent, uint8_t id,
- int32_t const x, int32_t const y, int32_t const w, int32_t const h,
+ int32_t const /* x */, int32_t const /* y */, int32_t const w, int32_t const h,
GameSettingsProvider * const settings,
UI::Font * font)
:
@@ -143,7 +143,7 @@
struct MultiPlayerPlayerGroup : public UI::Box {
MultiPlayerPlayerGroup
(UI::Panel * const parent, uint8_t id,
- int32_t const x, int32_t const y, int32_t const w, int32_t const h,
+ int32_t const /* x */, int32_t const /* y */, int32_t const w, int32_t const h,
GameSettingsProvider * const settings,
NetworkPlayerSettingsBackend * const npsb,
UI::Font * font,
@@ -383,7 +383,7 @@
(UI::Panel * const parent,
int32_t const x, int32_t const y, int32_t const w, int32_t const h,
GameSettingsProvider * const settings,
- uint32_t butw, uint32_t buth,
+ uint32_t /* butw */, uint32_t buth,
std::string const & fname, uint32_t const fsize)
:
UI::Panel(parent, x, y, w, h),
=== modified file 'src/wui/plot_area.cc'
--- src/wui/plot_area.cc 2012-02-15 21:25:34 +0000
+++ src/wui/plot_area.cc 2012-06-08 22:38:40 +0000
@@ -315,7 +315,7 @@
* draw the background and the axis of the diagram
*/
uint32_t WUIPlot_Area::draw_diagram
- (RenderTarget & dst, float const xline_length, float const yline_length) {
+ (RenderTarget & dst, float const xline_length, float const /* yline_length */) {
uint32_t time_in_ms_, how_many_ticks, max_x;
char buffer[200];
=== modified file 'src/wui/soldierlist.cc'
--- src/wui/soldierlist.cc 2012-04-06 19:26:17 +0000
+++ src/wui/soldierlist.cc 2012-06-08 22:38:40 +0000
@@ -327,7 +327,12 @@
m_mouseover_fn(0);
}
-bool SoldierPanel::handle_mousemove(Uint8 state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff)
+bool SoldierPanel::handle_mousemove
+ (Uint8 /* state */,
+ int32_t x,
+ int32_t y,
+ int32_t /* xdiff */,
+ int32_t /* ydiff */)
{
if (m_mouseover_fn)
m_mouseover_fn(find_soldier(x, y));
=== modified file 'src/wui/ware_statistics_menu.cc'
--- src/wui/ware_statistics_menu.cc 2012-04-30 13:26:19 +0000
+++ src/wui/ware_statistics_menu.cc 2012-06-08 22:38:40 +0000
@@ -125,7 +125,7 @@
set_size(w, h);
}
protected:
- std::string info_for_ware(Widelands::Ware_Index const ware) {
+ std::string info_for_ware(Widelands::Ware_Index const /* ware */) {
return "";
}
=== modified file 'src/wui/waresdisplay.cc'
--- src/wui/waresdisplay.cc 2012-02-15 21:25:34 +0000
+++ src/wui/waresdisplay.cc 2012-06-08 22:38:40 +0000
@@ -316,7 +316,7 @@
: AbstractWaresDisplay(parent, x, y, tribe, type, selectable)
{}
-RGBColor AbstractWaresDisplay::info_color_for_ware(Widelands::Ware_Index const ware) {
+RGBColor AbstractWaresDisplay::info_color_for_ware(Widelands::Ware_Index const /* ware */) {
return RGBColor(0, 0, 0);
}
Follow ups