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
@@ -56,7 +56,7 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_,
// By not contracting all contractable nodes we avoid creating
// a very dense core. This increases the overall graph sizes a little bit
// but increases the final CH quality and contraction speed.
constexpr float BASE_CORE = 0.9;
constexpr float BASE_CORE = 0.9f;
is_shared_core =
contractGraph(contractor_graph, std::move(always_allowed), node_weights, BASE_CORE);
+5 -5
View File
@@ -123,9 +123,9 @@ class BaseAPI
const auto &snapped_location = candidatesSnappedLocation(candidates);
const auto &input_location = candidatesInputLocation(candidates);
auto location =
fbresult::Position(static_cast<double>(util::toFloating(snapped_location.lon)),
static_cast<double>(util::toFloating(snapped_location.lat)));
auto location = fbresult::Position(
static_cast<float>(static_cast<double>(util::toFloating(snapped_location.lon))),
static_cast<float>(static_cast<double>(util::toFloating(snapped_location.lat))));
const auto toName = [this](const auto &phantom) {
return facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id))
@@ -156,8 +156,8 @@ class BaseAPI
auto waypoint = std::make_unique<fbresult::WaypointBuilder>(*builder);
waypoint->add_location(&location);
waypoint->add_distance(
util::coordinate_calculation::greatCircleDistance(snapped_location, input_location));
waypoint->add_distance(static_cast<float>(
util::coordinate_calculation::greatCircleDistance(snapped_location, input_location)));
waypoint->add_name(name_string);
if (parameters.generate_hints)
{
+1 -1
View File
@@ -83,7 +83,7 @@ template <typename Algorithm> class Engine final : public EngineInterface
Engine(const Engine &) = delete;
Engine &operator=(const Engine &) = delete;
virtual ~Engine() = default;
virtual ~Engine() override = default;
Status Route(const api::RouteParameters &params, api::ResultT &result) const override final
{
+1 -1
View File
@@ -72,7 +72,7 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
{
}
virtual ~RoutingAlgorithms() = default;
virtual ~RoutingAlgorithms() override = default;
InternalManyRoutesResult
AlternativePathSearch(const PhantomEndpointCandidates &endpoint_candidates,
+2 -2
View File
@@ -75,7 +75,7 @@ template <typename Data> struct SharedMonitor
region = bi::mapped_region(shmem, bi::read_write);
}
catch (const bi::interprocess_exception &exception)
catch (const bi::interprocess_exception &)
{
auto message = boost::format("No shared memory block '%1%' found, have you forgotten "
"to run osrm-datastore?") %
@@ -124,7 +124,7 @@ template <typename Data> struct SharedMonitor
bi::shared_memory_object shmem_open =
bi::shared_memory_object(bi::open_only, Data::name, bi::read_only);
}
catch (const bi::interprocess_exception &exception)
catch (const bi::interprocess_exception &)
{
return false;
}
+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;