diff --git a/include/engine/guidance/collapse_turns.hpp b/include/engine/guidance/collapse_turns.hpp index 6d0b1fe7d..bfd1140f2 100644 --- a/include/engine/guidance/collapse_turns.hpp +++ b/include/engine/guidance/collapse_turns.hpp @@ -1,7 +1,6 @@ #ifndef OSRM_ENGINE_GUIDANCE_COLLAPSE_HPP #include "engine/guidance/route_step.hpp" -#include "util/attributes.hpp" #include #include @@ -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 collapseTurnInstructions(std::vector steps); +[[nodiscard]] std::vector collapseTurnInstructions(std::vector 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 collapseSegregatedTurnInstructions(std::vector steps); +[[nodiscard]] std::vector +collapseSegregatedTurnInstructions(std::vector 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 diff --git a/include/engine/guidance/collapsing_utility.hpp b/include/engine/guidance/collapsing_utility.hpp index c0a012198..9177ef8d4 100644 --- a/include/engine/guidance/collapsing_utility.hpp +++ b/include/engine/guidance/collapsing_utility.hpp @@ -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 removeNoTurnInstructions(std::vector steps) +[[nodiscard]] inline std::vector removeNoTurnInstructions(std::vector steps) { // finally clean up the post-processed instructions. // Remove all invalid instructions from the set of instructions. diff --git a/include/engine/guidance/lane_processing.hpp b/include/engine/guidance/lane_processing.hpp index f42567279..0448151cb 100644 --- a/include/engine/guidance/lane_processing.hpp +++ b/include/engine/guidance/lane_processing.hpp @@ -1,10 +1,9 @@ #ifndef OSRM_ENGINE_GUIDANCE_LANE_PROCESSING_HPP_ #define OSRM_ENGINE_GUIDANCE_LANE_PROCESSING_HPP_ -#include - #include "engine/guidance/route_step.hpp" -#include "util/attributes.hpp" + +#include 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 anticipateLaneChange(std::vector steps, - const double min_distance_needed_for_lane_change = 200); +[[nodiscard]] std::vector +anticipateLaneChange(std::vector steps, + const double min_distance_needed_for_lane_change = 200); } // namespace osrm::engine::guidance diff --git a/include/engine/guidance/post_processing.hpp b/include/engine/guidance/post_processing.hpp index b489de07a..22ed7aae2 100644 --- a/include/engine/guidance/post_processing.hpp +++ b/include/engine/guidance/post_processing.hpp @@ -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 @@ -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 handleRoundabouts(std::vector steps); +[[nodiscard]] std::vector handleRoundabouts(std::vector 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 handleRoundabouts(std::vector steps); void trimShortSegments(std::vector &steps, LegGeometry &geometry); // assign relative locations to depart/arrive instructions -OSRM_ATTR_WARN_UNUSED -std::vector assignRelativeLocations(std::vector steps, - const LegGeometry &geometry, - const PhantomNode &source_node, - const PhantomNode &target_node); +[[nodiscard]] std::vector assignRelativeLocations(std::vector 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 buildIntersections(std::vector steps); +[[nodiscard]] std::vector buildIntersections(std::vector 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 &steps); +[[nodiscard]] LegGeometry resyncGeometry(LegGeometry leg_geometry, + const std::vector &steps); /** * Apply maneuver override relations to the selected route. diff --git a/include/engine/guidance/verbosity_reduction.hpp b/include/engine/guidance/verbosity_reduction.hpp index 3ad6d26be..ae5dca97c 100644 --- a/include/engine/guidance/verbosity_reduction.hpp +++ b/include/engine/guidance/verbosity_reduction.hpp @@ -2,7 +2,6 @@ #define OSRM_ENGINE_GUIDANCE_VERBOSITY_REDUCTION_HPP_ #include "engine/guidance/route_step.hpp" -#include "util/attributes.hpp" #include @@ -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 suppressShortNameSegments(std::vector steps); +[[nodiscard]] std::vector suppressShortNameSegments(std::vector steps); } // namespace osrm::engine::guidance diff --git a/include/extractor/intersection/coordinate_extractor.hpp b/include/extractor/intersection/coordinate_extractor.hpp index 376ea10d5..8e9a527b6 100644 --- a/include/extractor/intersection/coordinate_extractor.hpp +++ b/include/extractor/intersection/coordinate_extractor.hpp @@ -1,16 +1,15 @@ #ifndef OSRM_EXTRACTOR_INTERSECTION_COORDINATE_EXTRACTOR_HPP_ #define OSRM_EXTRACTOR_INTERSECTION_COORDINATE_EXTRACTOR_HPP_ -#include -#include - #include "extractor/compressed_edge_container.hpp" #include "extractor/query_node.hpp" -#include "util/attributes.hpp" #include "util/coordinate.hpp" #include "util/node_based_graph.hpp" +#include +#include + namespace osrm::extractor::intersection { @@ -27,17 +26,16 @@ class CoordinateExtractor * Note: The segment between intersection and turn coordinate can be zero, if the OSM modelling * is unfortunate. See https://github.com/Project-OSRM/osrm-backend/issues/3470 */ - OSRM_ATTR_WARN_UNUSED - util::Coordinate GetCoordinateAlongRoad(const NodeID intersection_node, - const EdgeID turn_edge, - const bool traversed_in_reverse, - const NodeID to_node, - const std::uint8_t number_of_in_lanes) const; + [[nodiscard]] util::Coordinate + GetCoordinateAlongRoad(const NodeID intersection_node, + const EdgeID turn_edge, + const bool traversed_in_reverse, + const NodeID to_node, + const std::uint8_t number_of_in_lanes) const; // Given a set of precomputed coordinates, select the representative coordinate along the road // that best describes the turn - OSRM_ATTR_WARN_UNUSED - util::Coordinate + [[nodiscard]] util::Coordinate ExtractRepresentativeCoordinate(const NodeID intersection_node, const EdgeID turn_edge, const bool traversed_in_reverse, @@ -47,7 +45,7 @@ class CoordinateExtractor // instead of finding only a single coordinate, we can also list all coordinates along a // road. - OSRM_ATTR_WARN_UNUSED std::vector + [[nodiscard]] std::vector GetCoordinatesAlongRoad(const NodeID intersection_node, const EdgeID turn_edge, const bool traversed_in_reverse, @@ -55,20 +53,18 @@ class CoordinateExtractor // wrapper in case of normal forward edges (traversed_in_reverse = false, to_node = // node_based_graph.GetTarget(turn_edge) - OSRM_ATTR_WARN_UNUSED - std::vector GetForwardCoordinatesAlongRoad(const NodeID from, - const EdgeID turn_edge) const; + [[nodiscard]] std::vector + GetForwardCoordinatesAlongRoad(const NodeID from, const EdgeID turn_edge) const; // a less precise way to compute coordinates along a route. Due to the heavy interaction of // graph traversal and turn instructions, we often don't care for high precision. We only want // to check for available connections in order, or find (with room for error) the straightmost // turn. This function will offer a bit more error potential but allow for much higher // performance - OSRM_ATTR_WARN_UNUSED - util::Coordinate GetCoordinateCloseToTurn(const NodeID from_node, - const EdgeID turn_edge, - const bool traversed_in_reverse, - const NodeID to_node) const; + [[nodiscard]] util::Coordinate GetCoordinateCloseToTurn(const NodeID from_node, + const EdgeID turn_edge, + const bool traversed_in_reverse, + const NodeID to_node) const; /* When extracting the coordinates, we first extract all coordinates. We don't care about most * of them, though. @@ -90,22 +86,19 @@ class CoordinateExtractor * The optional length cache needs to store the accumulated distance up to the respective * coordinate index [0,d(0,1),...] */ - OSRM_ATTR_WARN_UNUSED - std::vector + [[nodiscard]] std::vector TrimCoordinatesToLength(std::vector coordinates, const double desired_length, const std::vector &length_cache = {}) const; - OSRM_ATTR_WARN_UNUSED - std::vector PrepareLengthCache(const std::vector &coordinates, - const double limit) const; + [[nodiscard]] std::vector + PrepareLengthCache(const std::vector &coordinates, const double limit) const; /* when looking at a set of coordinates, this function allows trimming the vector to a smaller, * only containing coordinates up to a given distance along the path. The last coordinate might * be interpolated */ - OSRM_ATTR_WARN_UNUSED - std::vector + [[nodiscard]] std::vector TrimCoordinatesByLengthFront(std::vector coordinates, const double desired_length) const; @@ -130,10 +123,9 @@ class CoordinateExtractor * * for fixpoint `b`, vector_base `d` and vector_head `e` */ - OSRM_ATTR_WARN_UNUSED - util::Coordinate GetCorrectedCoordinate(const util::Coordinate fixpoint, - const util::Coordinate vector_base, - const util::Coordinate vector_head) const; + [[nodiscard]] util::Coordinate GetCorrectedCoordinate(const util::Coordinate fixpoint, + const util::Coordinate vector_base, + const util::Coordinate vector_head) const; /* generate a uniform vector of coordinates in same range distances * @@ -143,8 +135,7 @@ class CoordinateExtractor * Into: * x -- x -- x -- x -- x - x */ - OSRM_ATTR_WARN_UNUSED - std::vector + [[nodiscard]] std::vector SampleCoordinates(const std::vector &coordinates, const double length, const double rate) const; diff --git a/include/guidance/motorway_handler.hpp b/include/guidance/motorway_handler.hpp index 6b390d6a3..8f399156d 100644 --- a/include/guidance/motorway_handler.hpp +++ b/include/guidance/motorway_handler.hpp @@ -7,7 +7,6 @@ #include "guidance/intersection_handler.hpp" #include "guidance/is_through_street.hpp" -#include "util/attributes.hpp" #include "util/node_based_graph.hpp" #include @@ -42,18 +41,14 @@ class MotorwayHandler final : public IntersectionHandler Intersection intersection) const override final; private: - OSRM_ATTR_WARN_UNUSED - Intersection handleSliproads(const NodeID intersection_node_id, - Intersection intersection) const; + [[nodiscard]] Intersection handleSliproads(const NodeID intersection_node_id, + Intersection intersection) const; - OSRM_ATTR_WARN_UNUSED - Intersection fromMotorway(const EdgeID via_edge, Intersection intersection) const; + [[nodiscard]] Intersection fromMotorway(const EdgeID via_edge, Intersection intersection) const; - OSRM_ATTR_WARN_UNUSED - Intersection fromRamp(const EdgeID via_edge, Intersection intersection) const; + [[nodiscard]] Intersection fromRamp(const EdgeID via_edge, Intersection intersection) const; - OSRM_ATTR_WARN_UNUSED - Intersection fallback(Intersection intersection) const; + [[nodiscard]] Intersection fallback(Intersection intersection) const; }; } // namespace osrm::guidance diff --git a/include/guidance/parsing_toolkit.hpp b/include/guidance/parsing_toolkit.hpp index f402430bd..56cbb5fae 100644 --- a/include/guidance/parsing_toolkit.hpp +++ b/include/guidance/parsing_toolkit.hpp @@ -7,8 +7,6 @@ #include #include -#include "util/attributes.hpp" - namespace osrm::extractor::guidance { @@ -21,8 +19,7 @@ namespace osrm::extractor::guidance // will be corrected to left|throught, since the final lane is not drivable. // This is in contrast to a situation with lanes:psv:forward=0 (or not set) where left|through| // represents left|through|through -OSRM_ATTR_WARN_UNUSED -inline std::string +[[nodiscard]] inline std::string trimLaneString(std::string lane_string, std::int32_t count_left, std::int32_t count_right) { if (count_left) @@ -68,8 +65,8 @@ trimLaneString(std::string lane_string, std::int32_t count_left, std::int32_t co // turn:lanes=left|through|through|right // vehicle:lanes=yes|yes|no|yes // bicycle:lanes=yes|no|designated|yes -OSRM_ATTR_WARN_UNUSED -inline std::string applyAccessTokens(std::string lane_string, const std::string &access_tokens) +[[nodiscard]] inline std::string applyAccessTokens(std::string lane_string, + const std::string &access_tokens) { using tokenizer = boost::tokenizer>; boost::char_separator sep("|", "", boost::keep_empty_tokens); diff --git a/include/guidance/turn_analysis.hpp b/include/guidance/turn_analysis.hpp index c2e6f947c..d17ea0c03 100644 --- a/include/guidance/turn_analysis.hpp +++ b/include/guidance/turn_analysis.hpp @@ -17,7 +17,6 @@ #include "guidance/turn_classification.hpp" #include "guidance/turn_handler.hpp" -#include "util/attributes.hpp" #include "util/node_based_graph.hpp" #include @@ -47,13 +46,11 @@ class TurnAnalysis /* Full Analysis Process for a single node/edge combination. Use with caution, as the process is * relatively expensive */ - OSRM_ATTR_WARN_UNUSED - Intersection operator()(const NodeID node_prior_to_intersection, - const EdgeID entering_via_edge) const; + [[nodiscard]] Intersection operator()(const NodeID node_prior_to_intersection, + const EdgeID entering_via_edge) const; // Select turn types based on the intersection shape - OSRM_ATTR_WARN_UNUSED - Intersection + [[nodiscard]] Intersection AssignTurnTypes(const NodeID from_node, const EdgeID via_eid, const extractor::intersection::IntersectionView &intersection) const; diff --git a/include/guidance/turn_handler.hpp b/include/guidance/turn_handler.hpp index 6a5210992..88b9daae0 100644 --- a/include/guidance/turn_handler.hpp +++ b/include/guidance/turn_handler.hpp @@ -8,7 +8,6 @@ #include "guidance/intersection_handler.hpp" #include "guidance/is_through_street.hpp" -#include "util/attributes.hpp" #include "util/node_based_graph.hpp" #include @@ -76,20 +75,19 @@ class TurnHandler final : public IntersectionHandler bool isCompatibleByRoadClass(const Intersection &intersection, const Fork fork) const; // Dead end. - OSRM_ATTR_WARN_UNUSED - Intersection handleOneWayTurn(Intersection intersection) const; + [[nodiscard]] Intersection handleOneWayTurn(Intersection intersection) const; // Mode Changes, new names... - OSRM_ATTR_WARN_UNUSED - Intersection handleTwoWayTurn(const EdgeID via_edge, Intersection intersection) const; + [[nodiscard]] Intersection handleTwoWayTurn(const EdgeID via_edge, + Intersection intersection) const; // Forks, T intersections and similar - OSRM_ATTR_WARN_UNUSED - Intersection handleThreeWayTurn(const EdgeID via_edge, Intersection intersection) const; + [[nodiscard]] Intersection handleThreeWayTurn(const EdgeID via_edge, + Intersection intersection) const; // Handling of turns larger then degree three - OSRM_ATTR_WARN_UNUSED - Intersection handleComplexTurn(const EdgeID via_edge, Intersection intersection) const; + [[nodiscard]] Intersection handleComplexTurn(const EdgeID via_edge, + Intersection intersection) const; void handleDistinctConflict(const EdgeID via_edge, ConnectedRoad &left, ConnectedRoad &right) const; @@ -97,15 +95,13 @@ class TurnHandler final : public IntersectionHandler // Classification std::optional findFork(const EdgeID via_edge, Intersection &intersection) const; - OSRM_ATTR_WARN_UNUSED - Intersection assignLeftTurns(const EdgeID via_edge, - Intersection intersection, - const std::size_t starting_at) const; + [[nodiscard]] Intersection assignLeftTurns(const EdgeID via_edge, + Intersection intersection, + const std::size_t starting_at) const; - OSRM_ATTR_WARN_UNUSED - Intersection assignRightTurns(const EdgeID via_edge, - Intersection intersection, - const std::size_t up_to) const; + [[nodiscard]] Intersection assignRightTurns(const EdgeID via_edge, + Intersection intersection, + const std::size_t up_to) const; }; } // namespace osrm::guidance diff --git a/include/guidance/turn_instruction.hpp b/include/guidance/turn_instruction.hpp index ce7bb7bc0..83132ac24 100644 --- a/include/guidance/turn_instruction.hpp +++ b/include/guidance/turn_instruction.hpp @@ -2,7 +2,6 @@ #define OSRM_GUIDANCE_TURN_INSTRUCTION_HPP_ #include "guidance/roundabout_type.hpp" -#include "util/attributes.hpp" #include "util/typedefs.hpp" #include @@ -243,8 +242,7 @@ inline guidance::DirectionModifier::Enum getTurnDirection(const double angle) } // swaps left <-> right modifier types -OSRM_ATTR_WARN_UNUSED -inline guidance::DirectionModifier::Enum +[[nodiscard]] inline guidance::DirectionModifier::Enum mirrorDirectionModifier(const guidance::DirectionModifier::Enum modifier) { const constexpr guidance::DirectionModifier::Enum results[] = { diff --git a/include/guidance/turn_lane_augmentation.hpp b/include/guidance/turn_lane_augmentation.hpp index 53ecd9d7f..81ec3abe9 100644 --- a/include/guidance/turn_lane_augmentation.hpp +++ b/include/guidance/turn_lane_augmentation.hpp @@ -3,14 +3,12 @@ #include "guidance/intersection.hpp" #include "guidance/turn_lane_data.hpp" -#include "util/attributes.hpp" namespace osrm::guidance::lanes { -OSRM_ATTR_WARN_UNUSED -LaneDataVector handleNoneValueAtSimpleTurn(LaneDataVector lane_data, - const Intersection &intersection); +[[nodiscard]] LaneDataVector handleNoneValueAtSimpleTurn(LaneDataVector lane_data, + const Intersection &intersection); } // namespace osrm::guidance::lanes diff --git a/include/guidance/turn_lane_data.hpp b/include/guidance/turn_lane_data.hpp index 384172306..53635d014 100644 --- a/include/guidance/turn_lane_data.hpp +++ b/include/guidance/turn_lane_data.hpp @@ -2,7 +2,6 @@ #define OSRM_GUIDANCE_TURN_LANE_DATA_HPP_ #include "extractor/turn_lane_types.hpp" -#include "util/attributes.hpp" #include "util/typedefs.hpp" #include @@ -23,8 +22,8 @@ struct TurnLaneData using LaneDataVector = std::vector; // convertes a string given in the OSM format into a TurnLaneData vector -OSRM_ATTR_WARN_UNUSED -LaneDataVector laneDataFromDescription(const extractor::TurnLaneDescription &turn_lane_description); +[[nodiscard]] LaneDataVector +laneDataFromDescription(const extractor::TurnLaneDescription &turn_lane_description); // Locate A Tag in a lane data vector (if multiple tags are set, the first one found is returned) LaneDataVector::const_iterator findTag(const extractor::TurnLaneType::Mask tag, diff --git a/include/guidance/turn_lane_handler.hpp b/include/guidance/turn_lane_handler.hpp index de39a22cf..9994867a3 100644 --- a/include/guidance/turn_lane_handler.hpp +++ b/include/guidance/turn_lane_handler.hpp @@ -9,7 +9,6 @@ #include "guidance/turn_analysis.hpp" #include "guidance/turn_lane_data.hpp" -#include "util/attributes.hpp" #include "util/guidance/turn_lanes.hpp" #include "util/node_based_graph.hpp" #include "util/typedefs.hpp" @@ -68,8 +67,8 @@ class TurnLaneHandler ~TurnLaneHandler(); - OSRM_ATTR_WARN_UNUSED - Intersection assignTurnLanes(const NodeID at, const EdgeID via_edge, Intersection intersection); + [[nodiscard]] Intersection + assignTurnLanes(const NodeID at, const EdgeID via_edge, Intersection intersection); private: mutable std::atomic count_handled; @@ -108,24 +107,23 @@ class TurnLaneHandler const Intersection &intersection) const; // in case of a simple intersection, assign the lane entries - OSRM_ATTR_WARN_UNUSED - Intersection simpleMatchTuplesToTurns(Intersection intersection, - const LaneDataVector &lane_data, - const LaneDescriptionID lane_string_id); + [[nodiscard]] Intersection simpleMatchTuplesToTurns(Intersection intersection, + const LaneDataVector &lane_data, + const LaneDescriptionID lane_string_id); // partition lane data into lane data relevant at current turn and at next turn - OSRM_ATTR_WARN_UNUSED - std::pair partitionLaneData( - const NodeID at, LaneDataVector turn_lane_data, const Intersection &intersection) const; + [[nodiscard]] std::pair + partitionLaneData(const NodeID at, + LaneDataVector turn_lane_data, + const Intersection &intersection) const; // Sliproad turns have a separated lane to the right/left of other depicted lanes. These lanes // are not necessarily separated clearly from the rest of the way. As a result, we combine both // lane entries for our output, while performing the matching with the separated lanes only. - OSRM_ATTR_WARN_UNUSED - Intersection handleSliproadTurn(Intersection intersection, - const LaneDescriptionID lane_description_id, - LaneDataVector lane_data, - const Intersection &previous_intersection); + [[nodiscard]] Intersection handleSliproadTurn(Intersection intersection, + const LaneDescriptionID lane_description_id, + LaneDataVector lane_data, + const Intersection &previous_intersection); // get the lane data for an intersection void extractLaneData(const EdgeID via_edge, diff --git a/include/guidance/turn_lane_matcher.hpp b/include/guidance/turn_lane_matcher.hpp index b336dde8d..df1965535 100644 --- a/include/guidance/turn_lane_matcher.hpp +++ b/include/guidance/turn_lane_matcher.hpp @@ -5,7 +5,6 @@ #include "guidance/turn_instruction.hpp" #include "guidance/turn_lane_data.hpp" -#include "util/attributes.hpp" #include "util/guidance/turn_lanes.hpp" #include "util/node_based_graph.hpp" @@ -34,12 +33,12 @@ findBestMatchForReverse(const extractor::TurnLaneType::Mask leftmost_tag, bool canMatchTrivially(const Intersection &intersection, const LaneDataVector &lane_data); // perform a trivial match on the turn lanes -OSRM_ATTR_WARN_UNUSED -Intersection triviallyMatchLanesToTurns(Intersection intersection, - const LaneDataVector &lane_data, - const util::NodeBasedDynamicGraph &node_based_graph, - const LaneDescriptionID lane_string_id, - util::guidance::LaneDataIdMap &lane_data_to_id); +[[nodiscard]] Intersection +triviallyMatchLanesToTurns(Intersection intersection, + const LaneDataVector &lane_data, + const util::NodeBasedDynamicGraph &node_based_graph, + const LaneDescriptionID lane_string_id, + util::guidance::LaneDataIdMap &lane_data_to_id); } // namespace osrm::guidance::lanes diff --git a/include/util/alias.hpp b/include/util/alias.hpp index f335f4742..da6ab0e17 100644 --- a/include/util/alias.hpp +++ b/include/util/alias.hpp @@ -28,9 +28,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef OSRM_UTIL_ALIAS_HPP #define OSRM_UTIL_ALIAS_HPP -#include +#include #include -#include +#include #include namespace osrm diff --git a/include/util/attributes.hpp b/include/util/attributes.hpp deleted file mode 100644 index 667d933bf..000000000 --- a/include/util/attributes.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef OSRM_ATTRIBUTES_HPP_ -#define OSRM_ATTRIBUTES_HPP_ - -// OSRM_ATTR_WARN_UNUSED - caller has to use function's return value -// https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html - -#if defined(__GNUC__) && (__GNUC__ >= 4) -#define OSRM_ATTR_WARN_UNUSED __attribute__((warn_unused_result)) -#else -#define OSRM_ATTR_WARN_UNUSED -#endif - -#endif diff --git a/include/util/guidance/name_announcements.hpp b/include/util/guidance/name_announcements.hpp index 52f435750..7cdd3a76d 100644 --- a/include/util/guidance/name_announcements.hpp +++ b/include/util/guidance/name_announcements.hpp @@ -6,18 +6,16 @@ #include "extractor/name_table.hpp" #include "extractor/suffix_table.hpp" -#include "util/attributes.hpp" #include "util/typedefs.hpp" +#include + #include #include #include #include #include -#include -#include - namespace osrm::util::guidance { // Name Change Logic diff --git a/src/benchmarks/alias.cpp b/src/benchmarks/alias.cpp index f2eab6af8..e847d3e0e 100644 --- a/src/benchmarks/alias.cpp +++ b/src/benchmarks/alias.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include diff --git a/src/engine/guidance/collapse_turns.cpp b/src/engine/guidance/collapse_turns.cpp index 7f40c7c51..535a7539b 100644 --- a/src/engine/guidance/collapse_turns.cpp +++ b/src/engine/guidance/collapse_turns.cpp @@ -433,8 +433,7 @@ void suppressStep(RouteStep &step_at_turn_location, RouteStep &step_after_turn_l } // OTHER IMPLEMENTATIONS -OSRM_ATTR_WARN_UNUSED -RouteSteps collapseTurnInstructions(RouteSteps steps) +[[nodiscard]] RouteSteps collapseTurnInstructions(RouteSteps steps) { // make sure we can safely iterate over all steps (has depart/arrive with TurnType::NoTurn) BOOST_ASSERT(!hasTurnType(steps.front()) && !hasTurnType(steps.back())); @@ -589,8 +588,7 @@ RouteSteps collapseTurnInstructions(RouteSteps steps) } // OTHER IMPLEMENTATIONS -OSRM_ATTR_WARN_UNUSED -RouteSteps collapseSegregatedTurnInstructions(RouteSteps steps) +[[nodiscard]] RouteSteps collapseSegregatedTurnInstructions(RouteSteps steps) { // make sure we can safely iterate over all steps (has depart/arrive with TurnType::NoTurn) BOOST_ASSERT(!hasTurnType(steps.front()) && !hasTurnType(steps.back()));