Skip to content

Commit a22703d

Browse files
Fixed numerous warnings (#20)
* Fixed warnings with unused arguments * Fixed clang warnings * Fixed windows warnings * Fixed reserved identifiers * CHANGELOG
1 parent 3e65a36 commit a22703d

31 files changed

+179
-172
lines changed

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ build:ci --announce_rc
2929
build:linux --copt="-fvisibility=hidden"
3030
build:linux --copt="-fno-omit-frame-pointer" # for friendlier stack traces
3131
build:linux --copt="-Wno-error"
32+
build:linux --copt="-Wall"
33+
build:linux --copt="-Wextra"
34+
build:linux --copt="-Werror=return-type"
35+
build:linux --copt="-Werror=switch"
3236
build:linux --copt="-mavx"
3337
build:linux --copt="-Wsequence-point"
3438
build:linux --copt="-Wsign-compare"

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8-
- Nothing yet.
8+
### Added
9+
- FilterSphere for filtering by sphere constraint (by ctbur)
10+
### Changed
11+
- Fixed imports `<climits>` -> `<limits>` (by ctbur)
12+
- Fixed warnings:
13+
- "unused" function argument warnings
14+
- gcc/clang warnings
15+
- MSVC warnings
16+
- reserved identifier warnings (identifiers starting with `_`)
917

1018
## [1.0.1] - 2021-05-06
1119
### Changed

phtree/benchmark/count_mm_d_benchmark.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class IndexBenchmark {
7979

8080
template <dimension_t DIM, Scenario SCENARIO>
8181
IndexBenchmark<DIM, SCENARIO>::IndexBenchmark(benchmark::State& state, double avg_query_result_size)
82-
: data_type_{static_cast<const TestGenerator>(state.range(1))}
82+
: data_type_{static_cast<TestGenerator>(state.range(1))}
8383
, num_entities_(state.range(0))
8484
, avg_query_result_size_(avg_query_result_size)
8585
, tree_{}
@@ -118,7 +118,7 @@ void InsertEntry(
118118
}
119119

120120
struct CounterTreeWithMap {
121-
void operator()(const PhPointD<3>& key, const BucketType& value) {
121+
void operator()(const PhPointD<3>&, const BucketType& value) {
122122
for (auto& x : value) {
123123
n_ += x.size();
124124
}

phtree/benchmark/erase_benchmark.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void IndexBenchmark<DIM>::SetupWorld(benchmark::State& state) {
9191
}
9292

9393
template <dimension_t DIM>
94-
void IndexBenchmark<DIM>::Insert(benchmark::State& state, PhTree<DIM, int>& tree) {
94+
void IndexBenchmark<DIM>::Insert(benchmark::State&, PhTree<DIM, int>& tree) {
9595
for (int i = 0; i < num_entities_; ++i) {
9696
tree.emplace(points_[i], i);
9797
}

phtree/benchmark/erase_d_benchmark.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void IndexBenchmark<DIM>::SetupWorld(benchmark::State& state) {
9191
}
9292

9393
template <dimension_t DIM>
94-
void IndexBenchmark<DIM>::Insert(benchmark::State& state, PhTreeD<DIM, int>& tree) {
94+
void IndexBenchmark<DIM>::Insert(benchmark::State&, PhTreeD<DIM, int>& tree) {
9595
for (int i = 0; i < num_entities_; ++i) {
9696
tree.emplace(points_[i], i);
9797
}

phtree/benchmark/extent_benchmark_weird.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class FilterBoxIntersection {
104104
max_include_bits = PRE(maxExclude);
105105
}
106106

107-
[[nodiscard]] bool IsEntryValid(const PhPoint<DIM>& key, const int& value) const {
107+
[[nodiscard]] bool IsEntryValid(const PhPoint<DIM>& key, const int&) const {
108108
for (int i = 0; i < DIM; ++i) {
109109
if (key[i] < min_include_bits[i] || key[i] > max_include_bits[i]) {
110110
return false;
@@ -146,11 +146,11 @@ class FilterTrue {
146146
maxIncludeBits = PRE(maxExclude);
147147
}
148148

149-
[[nodiscard]] bool IsEntryValid(const PhPoint<DIM>& key, const int& value) const {
149+
[[nodiscard]] bool IsEntryValid(const PhPoint<DIM>&, const int&) const {
150150
return true;
151151
}
152152

153-
[[nodiscard]] bool IsNodeValid(const PhPoint<DIM>& prefix, int bits_to_ignore) const {
153+
[[nodiscard]] bool IsNodeValid(const PhPoint<DIM>&, int) const {
154154
return true;
155155
}
156156

@@ -164,11 +164,11 @@ class FilterTrue2 {
164164
public:
165165
FilterTrue2() : minIncludeBits{}, maxIncludeBits{} {};
166166

167-
[[nodiscard]] bool IsEntryValid(const PhPoint<DIM>& key, const int& value) const {
167+
[[nodiscard]] bool IsEntryValid(const PhPoint<DIM>&, const int&) const {
168168
return true;
169169
}
170170

171-
[[nodiscard]] bool IsNodeValid(const PhPoint<DIM>& prefix, int bits_to_ignore) const {
171+
[[nodiscard]] bool IsNodeValid(const PhPoint<DIM>&, int) const {
172172
return true;
173173
}
174174

@@ -179,11 +179,11 @@ class FilterTrue2 {
179179

180180
template <dimension_t DIM, typename T>
181181
struct FilterTrue3 {
182-
[[nodiscard]] constexpr bool IsEntryValid(const PhPoint<DIM>& key, const T& value) const {
182+
[[nodiscard]] constexpr bool IsEntryValid(const PhPoint<DIM>&, const T&) const {
183183
return true;
184184
}
185185

186-
[[nodiscard]] constexpr bool IsNodeValid(const PhPoint<DIM>& prefix, int bits_to_ignore) const {
186+
[[nodiscard]] constexpr bool IsNodeValid(const PhPoint<DIM>&, int) const {
187187
return true;
188188
}
189189
};

phtree/benchmark/find_benchmark.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void IndexBenchmark<DIM>::SetupWorld(benchmark::State& state) {
115115
}
116116

117117
template <dimension_t DIM>
118-
int IndexBenchmark<DIM>::QueryWorldCount(benchmark::State& state) {
118+
int IndexBenchmark<DIM>::QueryWorldCount(benchmark::State&) {
119119
static int pos = 0;
120120
pos = (pos + 1) % num_entities_;
121121
bool found = true;
@@ -130,7 +130,7 @@ int IndexBenchmark<DIM>::QueryWorldCount(benchmark::State& state) {
130130
}
131131

132132
template <dimension_t DIM>
133-
int IndexBenchmark<DIM>::QueryWorldFind(benchmark::State& state) {
133+
int IndexBenchmark<DIM>::QueryWorldFind(benchmark::State&) {
134134
static int pos = 0;
135135
pos = (pos + 1) % num_entities_;
136136
bool found = true;

phtree/benchmark/query_box_d_benchmark.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void IndexBenchmark<DIM, QUERY_TYPE>::SetupWorld(benchmark::State& state) {
120120

121121
template <dimension_t DIM, typename T>
122122
struct Counter {
123-
void operator()(BoxType<DIM> key, T& t) {
123+
void operator()(BoxType<DIM>, T&) {
124124
++n_;
125125
}
126126

phtree/benchmark/query_d_benchmark.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void IndexBenchmark<DIM, QUERY_TYPE>::SetupWorld(benchmark::State& state) {
120120

121121
template <dimension_t DIM, typename T>
122122
struct Counter {
123-
void operator()(PointType<DIM> key, T& t) {
123+
void operator()(PointType<DIM>, T&) {
124124
++n_;
125125
}
126126

phtree/benchmark/query_mm_box_d_benchmark.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class IndexBenchmark {
8080

8181
template <dimension_t DIM, Scenario SCENARIO>
8282
IndexBenchmark<DIM, SCENARIO>::IndexBenchmark(benchmark::State& state, double avg_query_result_size)
83-
: data_type_{static_cast<const TestGenerator>(state.range(1))}
83+
: data_type_{static_cast<TestGenerator>(state.range(1))}
8484
, num_entities_(state.range(0))
8585
, avg_query_result_size_(avg_query_result_size)
8686
, tree_{}
@@ -126,7 +126,7 @@ bool CheckPosition(const payload_t& entity, const QueryBox& query) {
126126
}
127127

128128
struct CounterTreeWithMap {
129-
void operator()(const PhBoxD<3>& key, const BucketType& value) {
129+
void operator()(const PhBoxD<3>&, const BucketType& value) {
130130
for (auto& x : value) {
131131
n_ += CheckPosition(x, box_);
132132
}
@@ -136,7 +136,7 @@ struct CounterTreeWithMap {
136136
};
137137

138138
struct CounterMultiMap {
139-
void operator()(const PhBoxD<3>& key, const payload_t& value) {
139+
void operator()(const PhBoxD<3>&, const payload_t& value) {
140140
n_ += CheckPosition(value, box_);
141141
}
142142
const QueryBox& box_;

0 commit comments

Comments
 (0)