Skip to content

Commit b89da13

Browse files
committed
Various clang-tidy fixes
1 parent 5559187 commit b89da13

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

.clang-tidy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Checks: '*,-abseil-string-find-str-contains,-altera-*,-android-cloexec-*,-bugprone-branch-clone,-bugprone-macro-parentheses,-cert-dcl21-cpp,-cert-err58-cpp,-clang-analyzer-optin.cplusplus.VirtualCall,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-vararg,-fuchsia-*,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-invalid-access-moved,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-vararg,-llvmlibc-*,-llvm-qualified-auto,-misc-macro-parentheses,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-unused-parameters,-modernize-avoid-c-arrays,-modernize-make-unique,-modernize-raw-string-literal,-modernize-use-trailing-return-type,-readability-avoid-const-params-in-decls,-readability-implicit-bool-cast,-readability-implicit-bool-conversion,-readability-magic-numbers,-readability-qualified-auto'
2+
Checks: '*,-abseil-string-find-str-contains,-altera-*,-android-cloexec-*,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-macro-parentheses,-cert-dcl21-cpp,-cert-err58-cpp,-clang-analyzer-optin.cplusplus.VirtualCall,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-vararg,-fuchsia-*,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-invalid-access-moved,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-vararg,-llvmlibc-*,-llvm-qualified-auto,-misc-macro-parentheses,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-unused-parameters,-modernize-avoid-c-arrays,-modernize-make-unique,-modernize-raw-string-literal,-modernize-use-trailing-return-type,-readability-avoid-const-params-in-decls,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-implicit-bool-cast,-readability-implicit-bool-conversion,-readability-magic-numbers,-readability-qualified-auto'
33
#
44
# For a list of check options, see:
55
# https://clang.llvm.org/extra/clang-tidy/checks/list.html
@@ -19,6 +19,9 @@ Checks: '*,-abseil-string-find-str-contains,-altera-*,-android-cloexec-*,-bugpro
1919
# Nice idea but collides but with switch statements we'll need to use
2020
# fall-throughs to fix this, which is also bad.
2121
#
22+
# bugprone-easily-swappable-parameters
23+
# Interesting test, but not something we can do much about in many places.
24+
#
2225
# bugprone-macro-parentheses
2326
# False positive in the only place where it reports something and
2427
# disabling locally doesn't work.
@@ -137,6 +140,9 @@ Checks: '*,-abseil-string-find-str-contains,-altera-*,-android-cloexec-*,-bugpro
137140
# readability-function-cognitive-complexity
138141
# Sometimes the large functions are needed.
139142
#
143+
# readability-identifier-length
144+
# Too strict.
145+
#
140146
# readability-implicit-bool-cast
141147
# Old name for readability-implicit-bool-conversion.
142148
#

include/osmium/io/detail/xml_input_format.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ namespace osmium {
171171
class ExpatXMLParser {
172172

173173
XML_Parser m_parser;
174-
std::exception_ptr m_exception_ptr{};
174+
std::exception_ptr m_exception_ptr{}; // NOLINT(bugprone-throw-keyword-missing) see https://bugs.llvm.org/show_bug.cgi?id=52400
175175

176176
template <typename TFunc>
177177
void member_wrap(XMLParser& xml_parser, TFunc&& func) noexcept {

include/osmium/io/reader.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ namespace osmium {
211211
}
212212
}
213213
if (dup2(pipefd[1], 1) < 0) { // put end of pipe as stdout/stdin
214-
exit(1);
214+
std::exit(1); // NOLINT(concurrency-mt-unsafe)
215215
}
216216

217217
::open("/dev/null", O_RDONLY); // stdin
@@ -221,7 +221,7 @@ namespace osmium {
221221
// in theory this execute() function could be used for other commands, but it is
222222
// only used for curl at the moment, so this is okay.
223223
if (::execlp(command.c_str(), command.c_str(), "-g", filename.c_str(), nullptr) < 0) {
224-
exit(1);
224+
std::exit(1); // NOLINT(concurrency-mt-unsafe)
225225
}
226226
}
227227
// parent

include/osmium/io/reader_iterator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace osmium {
4545
}
4646

4747
inline InputIterator<Reader> end(Reader& /*reader*/) {
48-
return InputIterator<Reader>();
48+
return {};
4949
}
5050

5151
} // namespace io

include/osmium/memory/buffer.hpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,7 @@ namespace osmium {
161161
* Most methods of the Buffer class will not work with an invalid
162162
* buffer.
163163
*/
164-
Buffer() noexcept :
165-
m_next_buffer() {
166-
}
164+
Buffer() noexcept = default;
167165

168166
/**
169167
* Constructs a valid externally memory-managed buffer using the
@@ -176,7 +174,6 @@ namespace osmium {
176174
* the alignment.
177175
*/
178176
explicit Buffer(unsigned char* data, std::size_t size) :
179-
m_next_buffer(),
180177
m_data(data),
181178
m_capacity(size),
182179
m_written(size),
@@ -199,7 +196,6 @@ namespace osmium {
199196
* than capacity.
200197
*/
201198
explicit Buffer(unsigned char* data, std::size_t capacity, std::size_t committed) :
202-
m_next_buffer(),
203199
m_data(data),
204200
m_capacity(capacity),
205201
m_written(committed),
@@ -229,7 +225,6 @@ namespace osmium {
229225
* than capacity.
230226
*/
231227
explicit Buffer(std::unique_ptr<unsigned char[]> data, std::size_t capacity, std::size_t committed) :
232-
m_next_buffer(),
233228
m_memory(std::move(data)),
234229
m_data(m_memory.get()),
235230
m_capacity(capacity),
@@ -259,7 +254,6 @@ namespace osmium {
259254
* becomes to small?
260255
*/
261256
explicit Buffer(std::size_t capacity, auto_grow auto_grow = auto_grow::yes) :
262-
m_next_buffer(),
263257
m_memory(new unsigned char[calculate_capacity(capacity)]),
264258
m_data(m_memory.get()),
265259
m_capacity(calculate_capacity(capacity)),

0 commit comments

Comments
 (0)