Replace GCC-specific attribute with [[nodiscard]] attribute (#6899)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#ifndef OSRM_ENGINE_GUIDANCE_COLLAPSE_HPP
|
||||
|
||||
#include "engine/guidance/route_step.hpp"
|
||||
#include "util/attributes.hpp"
|
||||
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
@@ -12,16 +11,15 @@ namespace osrm::engine::guidance
|
||||
// Multiple possible reasons can result in unnecessary/confusing instructions
|
||||
// Collapsing such turns into a single turn instruction, we give a clearer
|
||||
// set of instructions that is not cluttered by unnecessary turns/name changes.
|
||||
OSRM_ATTR_WARN_UNUSED
|
||||
std::vector<RouteStep> collapseTurnInstructions(std::vector<RouteStep> steps);
|
||||
[[nodiscard]] std::vector<RouteStep> collapseTurnInstructions(std::vector<RouteStep> steps);
|
||||
|
||||
// Multiple possible reasons can result in unnecessary/confusing instructions
|
||||
// A prime example would be a segregated intersection. Turning around at this
|
||||
// intersection would result in two instructions to turn left.
|
||||
// Collapsing such turns into a single turn instruction, we give a clearer
|
||||
// set of instructions that is not cluttered by unnecessary turns/name changes.
|
||||
OSRM_ATTR_WARN_UNUSED
|
||||
std::vector<RouteStep> collapseSegregatedTurnInstructions(std::vector<RouteStep> steps);
|
||||
[[nodiscard]] std::vector<RouteStep>
|
||||
collapseSegregatedTurnInstructions(std::vector<RouteStep> steps);
|
||||
|
||||
// A combined turn is a set of two instructions that actually form a single turn, as far as we
|
||||
// perceive it. A u-turn consisting of two left turns is one such example. But there are also lots
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "guidance/turn_instruction.hpp"
|
||||
#include "engine/guidance/route_step.hpp"
|
||||
#include "util/attributes.hpp"
|
||||
#include "util/bearing.hpp"
|
||||
#include "util/guidance/name_announcements.hpp"
|
||||
|
||||
@@ -166,8 +165,7 @@ inline bool areSameSide(const RouteStep &lhs, const RouteStep &rhs)
|
||||
}
|
||||
|
||||
// do this after invalidating any steps to compress the step array again
|
||||
OSRM_ATTR_WARN_UNUSED
|
||||
inline std::vector<RouteStep> removeNoTurnInstructions(std::vector<RouteStep> steps)
|
||||
[[nodiscard]] inline std::vector<RouteStep> removeNoTurnInstructions(std::vector<RouteStep> steps)
|
||||
{
|
||||
// finally clean up the post-processed instructions.
|
||||
// Remove all invalid instructions from the set of instructions.
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#ifndef OSRM_ENGINE_GUIDANCE_LANE_PROCESSING_HPP_
|
||||
#define OSRM_ENGINE_GUIDANCE_LANE_PROCESSING_HPP_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "engine/guidance/route_step.hpp"
|
||||
#include "util/attributes.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace osrm::engine::guidance
|
||||
{
|
||||
@@ -14,9 +13,9 @@ namespace osrm::engine::guidance
|
||||
// we anticipate lane changes emitting only matching lanes early on.
|
||||
// the second parameter describes the duration that we feel two segments need to be apart to count
|
||||
// as separate maneuvers.
|
||||
OSRM_ATTR_WARN_UNUSED
|
||||
std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
|
||||
const double min_distance_needed_for_lane_change = 200);
|
||||
[[nodiscard]] std::vector<RouteStep>
|
||||
anticipateLaneChange(std::vector<RouteStep> steps,
|
||||
const double min_distance_needed_for_lane_change = 200);
|
||||
|
||||
} // namespace osrm::engine::guidance
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "engine/guidance/leg_geometry.hpp"
|
||||
#include "engine/guidance/route_step.hpp"
|
||||
#include "engine/phantom_node.hpp"
|
||||
#include "util/attributes.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -13,8 +12,7 @@ namespace osrm::engine::guidance
|
||||
{
|
||||
|
||||
// passed as none-reference to modify in-place and move out again
|
||||
OSRM_ATTR_WARN_UNUSED
|
||||
std::vector<RouteStep> handleRoundabouts(std::vector<RouteStep> steps);
|
||||
[[nodiscard]] std::vector<RouteStep> handleRoundabouts(std::vector<RouteStep> steps);
|
||||
|
||||
// trim initial/final segment of very short length.
|
||||
// This function uses in/out parameter passing to modify both steps and geometry in place.
|
||||
@@ -24,23 +22,21 @@ std::vector<RouteStep> handleRoundabouts(std::vector<RouteStep> steps);
|
||||
void trimShortSegments(std::vector<RouteStep> &steps, LegGeometry &geometry);
|
||||
|
||||
// assign relative locations to depart/arrive instructions
|
||||
OSRM_ATTR_WARN_UNUSED
|
||||
std::vector<RouteStep> assignRelativeLocations(std::vector<RouteStep> steps,
|
||||
const LegGeometry &geometry,
|
||||
const PhantomNode &source_node,
|
||||
const PhantomNode &target_node);
|
||||
[[nodiscard]] std::vector<RouteStep> assignRelativeLocations(std::vector<RouteStep> steps,
|
||||
const LegGeometry &geometry,
|
||||
const PhantomNode &source_node,
|
||||
const PhantomNode &target_node);
|
||||
|
||||
// collapse suppressed instructions remaining into intersections array
|
||||
OSRM_ATTR_WARN_UNUSED
|
||||
std::vector<RouteStep> buildIntersections(std::vector<RouteStep> steps);
|
||||
[[nodiscard]] std::vector<RouteStep> buildIntersections(std::vector<RouteStep> steps);
|
||||
|
||||
// postProcess will break the connection between the leg geometry
|
||||
// for which a segment is supposed to represent exactly the coordinates
|
||||
// between routing maneuvers and the route steps itself.
|
||||
// If required, we can get both in sync again using this function.
|
||||
// Move in LegGeometry for modification in place.
|
||||
OSRM_ATTR_WARN_UNUSED
|
||||
LegGeometry resyncGeometry(LegGeometry leg_geometry, const std::vector<RouteStep> &steps);
|
||||
[[nodiscard]] LegGeometry resyncGeometry(LegGeometry leg_geometry,
|
||||
const std::vector<RouteStep> &steps);
|
||||
|
||||
/**
|
||||
* Apply maneuver override relations to the selected route.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define OSRM_ENGINE_GUIDANCE_VERBOSITY_REDUCTION_HPP_
|
||||
|
||||
#include "engine/guidance/route_step.hpp"
|
||||
#include "util/attributes.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -13,8 +12,7 @@ namespace osrm::engine::guidance
|
||||
// to announce them. All these that are not collapsed into a single turn (think segregated
|
||||
// intersection) have to be checked for the length they are active in. If they are active for a
|
||||
// short distance only, we don't announce them
|
||||
OSRM_ATTR_WARN_UNUSED
|
||||
std::vector<RouteStep> suppressShortNameSegments(std::vector<RouteStep> steps);
|
||||
[[nodiscard]] std::vector<RouteStep> suppressShortNameSegments(std::vector<RouteStep> steps);
|
||||
|
||||
} // namespace osrm::engine::guidance
|
||||
|
||||
|
||||
Reference in New Issue
Block a user