Refactor CMake code related to compiler warnings, enable some additional warnings (#6355)

This commit is contained in:
Siarhei Fedartsou
2022-09-30 11:42:36 +02:00
committed by GitHub
parent 3c5d99b4cb
commit 902bfc7806
23 changed files with 142 additions and 93 deletions
+1 -1
View File
@@ -106,7 +106,7 @@ class RuntimeError : public exception
// This function exists to 'anchor' the class, and stop the compiler from
// copying vtable and RTTI info into every object file that includes
// this header. (Caught by -Wweak-vtables under Clang.)
virtual void anchor() const;
virtual void anchor() const override;
const ErrorCode code;
static std::string BuildMessage(const std::string &message,
+5 -5
View File
@@ -87,11 +87,11 @@ template <typename Integer, typename Filter> class filtered_range
// convenience function to construct an integer range with type deduction
template <typename Integer, typename Filter>
filtered_range<Integer, Filter>
filtered_irange(const Integer first,
const Integer last,
const Filter &filter,
typename std::enable_if<std::is_integral<Integer>::value>::type * = 0) noexcept
filtered_range<Integer, Filter> filtered_irange(
const Integer first,
const Integer last,
const Filter &filter,
typename std::enable_if<std::is_integral<Integer>::value>::type * = nullptr) noexcept
{
return filtered_range<Integer, Filter>(first, last, filter);
}
+2 -2
View File
@@ -89,8 +89,8 @@ struct DiyFp
h++;
return DiyFp(h, e + rhs.e + 64);
#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__)
unsigned __int128 p =
static_cast<unsigned __int128>(f) * static_cast<unsigned __int128>(rhs.f);
__extension__ using uint128 = unsigned __int128;
uint128 p = static_cast<uint128>(f) * static_cast<uint128>(rhs.f);
uint64_t h = p >> 64;
uint64_t l = static_cast<uint64_t>(p);
if (l & (uint64_t(1) << 63)) // rounding
+1 -1
View File
@@ -86,7 +86,7 @@ template <typename Integer>
range<Integer>
irange(const Integer first,
const Integer last,
typename std::enable_if<std::is_integral<Integer>::value>::type * = 0) noexcept
typename std::enable_if<std::is_integral<Integer>::value>::type * = nullptr) noexcept
{
return range<Integer>(first, last);
}
+10 -6
View File
@@ -49,14 +49,16 @@ template <typename WordT, typename T>
inline T get_lower_half_value(WordT word,
WordT mask,
std::uint8_t offset,
typename std::enable_if_t<std::is_integral<T>::value> * = 0)
typename std::enable_if_t<std::is_integral<T>::value> * = nullptr)
{
return static_cast<T>((word & mask) >> offset);
}
template <typename WordT, typename T>
inline T
get_lower_half_value(WordT word, WordT mask, std::uint8_t offset, typename T::value_type * = 0)
inline T get_lower_half_value(WordT word,
WordT mask,
std::uint8_t offset,
typename T::value_type * = nullptr)
{
return T{static_cast<typename T::value_type>((word & mask) >> offset)};
}
@@ -65,14 +67,16 @@ template <typename WordT, typename T>
inline T get_upper_half_value(WordT word,
WordT mask,
std::uint8_t offset,
typename std::enable_if_t<std::is_integral<T>::value> * = 0)
typename std::enable_if_t<std::is_integral<T>::value> * = nullptr)
{
return static_cast<T>((word & mask) << offset);
}
template <typename WordT, typename T>
inline T
get_upper_half_value(WordT word, WordT mask, std::uint8_t offset, typename T::value_type * = 0)
inline T get_upper_half_value(WordT word,
WordT mask,
std::uint8_t offset,
typename T::value_type * = nullptr)
{
static_assert(std::is_unsigned<WordT>::value, "Only unsigned word types supported for now.");
return T{static_cast<typename T::value_type>((word & mask) << offset)};
-2
View File
@@ -63,8 +63,6 @@ template <typename NodeID, typename Key> class ArrayStorage
public:
explicit ArrayStorage(std::size_t size) : positions(size, 0) {}
~ArrayStorage() {}
Key &operator[](NodeID node) { return positions[node]; }
Key peek_index(const NodeID node) const { return positions[node]; }
+2 -2
View File
@@ -313,8 +313,8 @@ class StaticGraph
}
protected:
NodeIterator number_of_nodes;
EdgeIterator number_of_edges;
NodeIterator number_of_nodes = 0;
EdgeIterator number_of_edges = 0;
Vector<NodeArrayEntry> node_array;
Vector<EdgeArrayEntry> edge_array;
+1 -1
View File
@@ -118,7 +118,7 @@ static const EdgeDuration MAXIMAL_EDGE_DURATION = std::numeric_limits<EdgeDurati
static const EdgeDistance MAXIMAL_EDGE_DISTANCE = std::numeric_limits<EdgeDistance>::max();
static const TurnPenalty INVALID_TURN_PENALTY = std::numeric_limits<TurnPenalty>::max();
static const EdgeDistance INVALID_EDGE_DISTANCE = std::numeric_limits<EdgeDistance>::max();
static const EdgeDistance INVALID_FALLBACK_SPEED = std::numeric_limits<double>::max();
static const EdgeDistance INVALID_FALLBACK_SPEED = std::numeric_limits<EdgeDistance>::max();
using DatasourceID = std::uint8_t;