Enable more clang-tidy checks. (#6270)

* Enable more clang-tidy checks
This commit is contained in:
Siarhei Fedartsou
2022-06-30 15:32:12 +02:00
committed by GitHub
parent 59953172e8
commit 3d2db20777
35 changed files with 69 additions and 79 deletions
+14 -13
View File
@@ -47,7 +47,7 @@ class exception : public std::exception
public:
explicit exception(const char *message) : message(message) {}
explicit exception(std::string message) : message(std::move(message)) {}
explicit exception(boost::format message) : message(message.str()) {}
explicit exception(const boost::format &message) : message(message.str()) {}
const char *what() const noexcept override { return message.c_str(); }
private:
@@ -65,18 +65,19 @@ class exception : public std::exception
*/
constexpr const std::array<const char *, 11> ErrorDescriptions = {{
"", // Dummy - ErrorCode values start at 2
"", // Dummy - ErrorCode values start at 2
"Fingerprint did not match the expected value", // InvalidFingerprint
"File is incompatible with this version of OSRM", // IncompatibleFileVersion
"Problem opening file", // FileOpenError
"Problem reading from file", // FileReadError
"Problem writing to file", // FileWriteError
"I/O error occurred", // FileIOError
"Unexpected end of file", // UnexpectedEndOfFile
"The dataset you are trying to load is not " // IncompatibleDataset
"compatible with the routing algorithm you want to use." // ...continued...
"Incompatible algorithm" // IncompatibleAlgorithm
"", // Dummy - ErrorCode values start at 2
"", // Dummy - ErrorCode values start at 2
"Fingerprint did not match the expected value", // InvalidFingerprint
"File is incompatible with this version of OSRM", // IncompatibleFileVersion
"Problem opening file", // FileOpenError
"Problem reading from file", // FileReadError
"Problem writing to file", // FileWriteError
"I/O error occurred", // FileIOError
"Unexpected end of file", // UnexpectedEndOfFile
// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
"The dataset you are trying to load is not " // IncompatibleDataset
"compatible with the routing algorithm you want to use.", // ...continued...
"Incompatible algorithm" // IncompatibleAlgorithm
}};
#ifndef NDEBUG
+1 -1
View File
@@ -10,6 +10,6 @@
#define OSRM_SOURCE_FILE_ PROJECT_RELATIVE_PATH_(__FILE__)
// This is the macro to use
#define SOURCE_REF OSRM_SOURCE_FILE_ + ":" + std::to_string(__LINE__)
#define SOURCE_REF (OSRM_SOURCE_FILE_ + ":" + std::to_string(__LINE__))
#endif // SOURCE_MACROS_HPP
+2 -2
View File
@@ -71,12 +71,12 @@ template <typename StringView> inline auto decompose(const StringView &lhs, cons
// we compare suffixes based on this value, it might break UTF chars, but as long as we are
// consistent in handling, we do not create bad results
std::string str = boost::to_lower_copy(view.to_string());
auto front = str.find_first_not_of(" ");
auto front = str.find_first_not_of(' ');
if (front == std::string::npos)
return str;
auto back = str.find_last_not_of(" ");
auto back = str.find_last_not_of(' ');
return str.substr(front, back - front + 1);
};
+6
View File
@@ -83,19 +83,25 @@ template <unsigned BLOCK_SIZE, storage::Ownership Ownership> class RangeTable
unsigned block_idx = 0;
unsigned block_counter = 0;
BlockT block;
#ifndef BOOST_ASSERT_IS_VOID
unsigned block_sum = 0;
#endif
for (const unsigned l : lengths)
{
// first entry of a block: encode absolute offset
if (block_idx == 0)
{
block_offsets.push_back(lengths_prefix_sum);
#ifndef BOOST_ASSERT_IS_VOID
block_sum = 0;
#endif
}
else
{
block[block_idx - 1] = last_length;
#ifndef BOOST_ASSERT_IS_VOID
block_sum += last_length;
#endif
}
BOOST_ASSERT((block_idx == 0 && block_offsets[block_counter] == lengths_prefix_sum) ||