Skip to content

Commit 42eae3c

Browse files
authored
Merge pull request #906 from lonvia/enable-wextra
Fix various unused parameter issues and enable -Wextra on travis
2 parents 5f7341e + 24d6099 commit 42eae3c

31 files changed

Lines changed: 188 additions & 291 deletions

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ matrix:
5757
- os: linux
5858
compiler: "clang-3.8"
5959
env: T="clang38_pg92_dbtest" LUAJIT_OPTION="OFF"
60-
CXXFLAGS="-pedantic -Werror"
60+
CXXFLAGS="-pedantic -Wextra -Werror"
6161
CC=clang-3.8 CXX=clang++-3.8
6262
addons: *clang38_pg92
6363

6464
- os: linux
6565
compiler: "clang-7"
6666
env: T="clang7_pg96_dbtest_luajit" LUAJIT_OPTION="ON"
67-
CXXFLAGS="-pedantic -Werror"
67+
CXXFLAGS="-pedantic -Wextra -Werror"
6868
CC=clang-7 CXX=clang++-7
6969
addons: *clang7_pg96
7070

7171
# ---- OSX + CLANG ---------------------------
7272
- os: osx
7373
compiler: clang
7474
env: T="osx_clang_NoDB" LUAJIT_OPTION="OFF" TEST_NODB=1
75-
CXXFLAGS="-pedantic -Werror"
75+
CXXFLAGS="-pedantic -Wextra -Werror"
7676
before_install:
7777
- brew install lua; brew install lua
7878
before_script:
@@ -84,14 +84,14 @@ matrix:
8484
- os: linux
8585
compiler: "gcc-4.8"
8686
env: T="gcc48_pg96_dbtest" LUAJIT_OPTION="OFF"
87-
CXXFLAGS="-pedantic -Werror"
87+
CXXFLAGS="-pedantic -Wextra -Werror"
8888
CC=gcc-4.8 CXX=g++-4.8
8989
addons: *gcc48_pg96
9090

9191
- os: linux
9292
compiler: gcc-8
9393
env: T="gcc8_pg96_dbtest_luajit" LUAJIT_OPTION="ON"
94-
CXXFLAGS="-pedantic -Werror"
94+
CXXFLAGS="-pedantic -Wextra -Werror"
9595
CC=gcc-8 CXX=g++-8
9696
addons: *gcc8_pg96
9797

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;

0 commit comments

Comments
 (0)