Skip to content

Commit 5eaaf99

Browse files
committed
fix warnings appearing with -Wextra
This fixes pretty much exclusively unsued-parameter warnings. Removes some function parameters which have fallen out of use and also the permutating parameter test. The latter did not really do what it promised and was pretty much beyond repair.
1 parent 5f7341e commit 5eaaf99

30 files changed

+183
-282
lines changed

middle-ram.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void middle_ram_t::analyze(void)
157157

158158
void middle_ram_t::start() {}
159159

160-
void middle_ram_t::stop(osmium::thread::Pool &pool)
160+
void middle_ram_t::stop(osmium::thread::Pool &)
161161
{
162162
cache.reset(nullptr);
163163

output-multi.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ int output_multi_t::pending_relation(osmid_t id, int exists) {
172172
buffer.clear();
173173
if (m_mid->relations_get(id, buffer)) {
174174
auto const &rel = buffer.get<osmium::Relation>(0);
175-
ret = process_relation(rel, exists, true);
175+
ret = process_relation(rel, exists);
176176
}
177177

178178
return ret;
@@ -350,9 +350,7 @@ int output_multi_t::process_way(osmium::Way *way) {
350350
return 0;
351351
}
352352

353-
354-
int output_multi_t::process_relation(osmium::Relation const &rel,
355-
bool exists, bool pending)
353+
int output_multi_t::process_relation(osmium::Relation const &rel, bool exists)
356354
{
357355
//if it may exist already, delete it first
358356
if(exists)

output-multi.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class output_multi_t : public output_t
7272
int process_node(osmium::Node const &node);
7373
int process_way(osmium::Way *way);
7474
int reprocess_way(osmium::Way *way, bool exists);
75-
int process_relation(osmium::Relation const &rel, bool exists, bool pending=false);
75+
int process_relation(osmium::Relation const &rel, bool exists);
7676
void copy_node_to_table(osmid_t id, const std::string &geom, taglist_t &tags);
7777
void copy_to_table(const osmid_t id, geometry_processor::wkb_t const &geom,
7878
taglist_t &tags);

output-pgsql.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ int output_pgsql_t::pending_relation(osmid_t id, int exists) {
226226
}
227227

228228
auto const &rel = rels_buffer.get<osmium::Relation>(0);
229-
return pgsql_process_relation(rel, true);
229+
return pgsql_process_relation(rel);
230230
}
231231

232232
return 0;
@@ -288,8 +288,7 @@ int output_pgsql_t::way_add(osmium::Way *way)
288288

289289

290290
/* This is the workhorse of pgsql_add_relation, split out because it is used as the callback for iterate relations */
291-
int output_pgsql_t::pgsql_process_relation(osmium::Relation const &rel,
292-
bool pending)
291+
int output_pgsql_t::pgsql_process_relation(osmium::Relation const &rel)
293292
{
294293
taglist_t prefiltered_tags;
295294
if (m_tagtransform->filter_tags(rel, nullptr, nullptr, *m_export_list.get(),
@@ -381,7 +380,7 @@ int output_pgsql_t::relation_add(osmium::Relation const &rel)
381380
return 0;
382381
}
383382

384-
return pgsql_process_relation(rel, false);
383+
return pgsql_process_relation(rel);
385384
}
386385

387386
/* Delete is easy, just remove all traces of this object. We don't need to

output-pgsql.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class output_pgsql_t : public output_t {
6262
protected:
6363
void pgsql_out_way(osmium::Way const &way, taglist_t *tags, bool polygon,
6464
bool roads);
65-
int pgsql_process_relation(osmium::Relation const &rel, bool pending);
65+
int pgsql_process_relation(osmium::Relation const &rel);
6666
int pgsql_delete_way_from_output(osmid_t osm_id);
6767
int pgsql_delete_relation_from_output(osmid_t osm_id);
6868

tagtransform-c.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,9 @@ bool c_tagtransform_t::filter_tags(osmium::OSMObject const &o, int *polygon,
204204
}
205205

206206
bool c_tagtransform_t::filter_rel_member_tags(
207-
taglist_t const &rel_tags, osmium::memory::Buffer const &members,
208-
rolelist_t const &member_roles, int *make_boundary, int *make_polygon,
209-
int *roads, export_list const &exlist, taglist_t &out_tags,
210-
bool allow_typeless)
207+
taglist_t const &rel_tags, osmium::memory::Buffer const &,
208+
rolelist_t const &, int *make_boundary, int *make_polygon, int *roads,
209+
export_list const &, taglist_t &out_tags, bool allow_typeless)
211210
{
212211
//if it has a relation figure out what kind it is
213212
const std::string *type = rel_tags.get("type");

tests/test-expire-tiles.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,8 @@ void test_expire_merge_complete() {
442442

443443
int main(int argc, char *argv[])
444444
{
445+
(void)argc;
446+
(void)argv;
445447
srand(0);
446448

447449
//try each test if any fail we will exit

tests/test-hstore-match-only.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ The tags of inteest are specified in hstore-match-only.style
3232
#include "tests/common-pg.hpp"
3333

3434
int main(int argc, char *argv[]) {
35+
(void)argc;
36+
(void)argv;
3537
std::unique_ptr<pg::tempdb> db;
3638

3739
try {

tests/test-middle-flat.cpp

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -23,54 +23,59 @@
2323

2424
/* This is basically the same as test-middle-pgsql, but with flat nodes. */
2525

26-
void run_tests(options_t options, const std::string cache_type) {
27-
options.append = false;
28-
options.create = true;
29-
options.flat_node_cache_enabled = true;
30-
// flat nodes truncates the file each time it's started, so we can reuse the same file
31-
options.flat_node_file = boost::optional<std::string>(FLAT_NODES_FILE_NAME);
32-
33-
{
34-
test_middle_helper<middle_pgsql_t> t(options);
35-
36-
if (t.test_node_set() != 0) {
37-
throw std::runtime_error("test_node_set failed.");
38-
}
39-
}
40-
41-
{
42-
test_middle_helper<middle_pgsql_t> t(options);
43-
44-
if (t.test_nodes_comprehensive_set() != 0) {
45-
throw std::runtime_error("test_nodes_comprehensive_set failed.");
46-
}
47-
}
48-
49-
/* This should work, but doesn't. More tests are needed that look at updates
26+
void run_tests(options_t options)
27+
{
28+
options.append = false;
29+
options.create = true;
30+
options.flat_node_cache_enabled = true;
31+
// flat nodes truncates the file each time it's started, so we can reuse the same file
32+
options.flat_node_file = boost::optional<std::string>(FLAT_NODES_FILE_NAME);
33+
34+
{
35+
test_middle_helper<middle_pgsql_t> t(options);
36+
37+
if (t.test_node_set() != 0) {
38+
throw std::runtime_error("test_node_set failed.");
39+
}
40+
}
41+
42+
{
43+
test_middle_helper<middle_pgsql_t> t(options);
44+
45+
if (t.test_nodes_comprehensive_set() != 0) {
46+
throw std::runtime_error("test_nodes_comprehensive_set failed.");
47+
}
48+
}
49+
50+
/* This should work, but doesn't. More tests are needed that look at updates
5051
without the complication of ways.
5152
*/
52-
{
53-
// First make sure we have an empty table.
54-
{ test_middle_helper<middle_pgsql_t> t(options); }
53+
{
54+
// First make sure we have an empty table.
55+
{
56+
test_middle_helper<middle_pgsql_t> t(options);
57+
}
5558

56-
// Switch to append mode because this tests updates
57-
options.append = true;
58-
options.create = false;
59+
// Switch to append mode because this tests updates
60+
options.append = true;
61+
options.create = false;
5962

60-
test_middle_helper<middle_pgsql_t> t(options);
63+
test_middle_helper<middle_pgsql_t> t(options);
6164

62-
t.commit();
65+
t.commit();
6366

64-
if (t.test_way_set() != 0) {
65-
throw std::runtime_error("test_way_set failed.");
66-
}
67-
}
67+
if (t.test_way_set() != 0) {
68+
throw std::runtime_error("test_way_set failed.");
69+
}
70+
}
6871
}
6972
int main(int argc, char *argv[]) {
70-
std::unique_ptr<pg::tempdb> db;
73+
(void)argc;
74+
(void)argv;
75+
std::unique_ptr<pg::tempdb> db;
7176

72-
try {
73-
db.reset(new pg::tempdb);
77+
try {
78+
db.reset(new pg::tempdb);
7479
} catch (const std::exception &e) {
7580
std::cerr << "Unable to setup database: " << e.what() << "\n";
7681
return 77; // <-- code to skip this test.
@@ -89,15 +94,15 @@ int main(int argc, char *argv[]) {
8994
cleanup::file flat_nodes_file(FLAT_NODES_FILE_NAME);
9095

9196
options.alloc_chunkwise = ALLOC_SPARSE | ALLOC_DENSE; // what you get with optimized
92-
run_tests(options, "optimized");
97+
run_tests(options);
9398
options.alloc_chunkwise = ALLOC_SPARSE;
94-
run_tests(options, "sparse");
99+
run_tests(options);
95100

96101
options.alloc_chunkwise = ALLOC_DENSE;
97-
run_tests(options, "dense");
102+
run_tests(options);
98103

99104
options.alloc_chunkwise = ALLOC_DENSE | ALLOC_DENSE_CHUNK; // what you get with chunk
100-
run_tests(options, "chunk");
105+
run_tests(options);
101106

102107
} catch (const std::exception &e) {
103108
std::cerr << "ERROR: " << e.what() << std::endl;

tests/test-middle-pgsql.cpp

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -18,47 +18,52 @@
1818
#include "tests/middle-tests.hpp"
1919
#include "tests/common-pg.hpp"
2020

21-
void run_tests(options_t options, const std::string cache_type) {
22-
options.append = false;
23-
options.create = true;
24-
{
25-
test_middle_helper<middle_pgsql_t> t(options);
26-
27-
if (t.test_node_set() != 0) {
28-
throw std::runtime_error("test_node_set failed.");
29-
}
30-
}
31-
32-
{
33-
test_middle_helper<middle_pgsql_t> t(options);
34-
35-
if (t.test_nodes_comprehensive_set() != 0) {
36-
throw std::runtime_error("test_nodes_comprehensive_set failed.");
37-
}
38-
}
39-
40-
{
41-
// First make sure we have an empty table.
42-
{ test_middle_helper<middle_pgsql_t> t(options); }
43-
44-
// Then switch to append mode because this tests updates.
45-
options.append = true;
46-
options.create = false;
47-
48-
test_middle_helper<middle_pgsql_t> t(options);
49-
50-
t.commit();
51-
52-
if (t.test_way_set() != 0) {
53-
throw std::runtime_error("test_way_set failed.");
54-
}
55-
}
21+
static void run_tests(options_t options)
22+
{
23+
options.append = false;
24+
options.create = true;
25+
{
26+
test_middle_helper<middle_pgsql_t> t(options);
27+
28+
if (t.test_node_set() != 0) {
29+
throw std::runtime_error("test_node_set failed.");
30+
}
31+
}
32+
33+
{
34+
test_middle_helper<middle_pgsql_t> t(options);
35+
36+
if (t.test_nodes_comprehensive_set() != 0) {
37+
throw std::runtime_error("test_nodes_comprehensive_set failed.");
38+
}
39+
}
40+
41+
{
42+
// First make sure we have an empty table.
43+
{
44+
test_middle_helper<middle_pgsql_t> t(options);
45+
}
46+
47+
// Then switch to append mode because this tests updates.
48+
options.append = true;
49+
options.create = false;
50+
51+
test_middle_helper<middle_pgsql_t> t(options);
52+
53+
t.commit();
54+
55+
if (t.test_way_set() != 0) {
56+
throw std::runtime_error("test_way_set failed.");
57+
}
58+
}
5659
}
5760
int main(int argc, char *argv[]) {
58-
std::unique_ptr<pg::tempdb> db;
61+
(void)argc;
62+
(void)argv;
63+
std::unique_ptr<pg::tempdb> db;
5964

60-
try {
61-
db.reset(new pg::tempdb);
65+
try {
66+
db.reset(new pg::tempdb);
6267
} catch (const std::exception &e) {
6368
std::cerr << "Unable to setup database: " << e.what() << "\n";
6469
return 77; // <-- code to skip this test.
@@ -73,15 +78,15 @@ int main(int argc, char *argv[]) {
7378
options.slim = true;
7479

7580
options.alloc_chunkwise = ALLOC_SPARSE | ALLOC_DENSE; // what you get with optimized
76-
run_tests(options, "optimized");
81+
run_tests(options);
7782
options.alloc_chunkwise = ALLOC_SPARSE;
78-
run_tests(options, "sparse");
83+
run_tests(options);
7984

8085
options.alloc_chunkwise = ALLOC_DENSE;
81-
run_tests(options, "dense");
86+
run_tests(options);
8287

8388
options.alloc_chunkwise = ALLOC_DENSE | ALLOC_DENSE_CHUNK; // what you get with chunk
84-
run_tests(options, "chunk");
89+
run_tests(options);
8590
} catch (const std::exception &e) {
8691
std::cerr << "ERROR: " << e.what() << std::endl;
8792
return 1;

0 commit comments

Comments
 (0)