Warn on unused return values in guidance code, resolves #2686.
https://github.com/Project-OSRM/osrm-backend/pull/2685/files fixes an issue where we did elongate(fstStep, sndStep); instead of newStep = elongate(fstStep, sndStep); we didn't get any warnings. The only way to trigger a warning here is to use ```cpp __attribute__((warn_unused_result)) ``` This changeset does exactly that: for the new guidance code prone to these kind of issue we add such an attribute to the declaration.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "engine/guidance/lane_processing.hpp"
|
||||
#include "engine/guidance/toolkit.hpp"
|
||||
|
||||
#include "util/attributes.hpp"
|
||||
#include "util/guidance/toolkit.hpp"
|
||||
#include "util/guidance/turn_lanes.hpp"
|
||||
|
||||
@@ -127,6 +128,7 @@ double turn_angle(const double entry_bearing, const double exit_bearing)
|
||||
return angle > 360 ? angle - 360 : angle;
|
||||
}
|
||||
|
||||
OSRM_ATTR_WARN_UNUSED
|
||||
RouteStep forwardInto(RouteStep destination, const RouteStep &source)
|
||||
{
|
||||
// Merge a turn into a silent turn
|
||||
@@ -325,6 +327,7 @@ void closeOffRoundabout(const bool on_roundabout,
|
||||
}
|
||||
|
||||
// elongate a step by another. the data is added either at the front, or the back
|
||||
OSRM_ATTR_WARN_UNUSED
|
||||
RouteStep elongate(RouteStep step, const RouteStep &by_step)
|
||||
{
|
||||
BOOST_ASSERT(step.mode == by_step.mode);
|
||||
|
||||
Reference in New Issue
Block a user