Fix some compilation issues on modern macOS systems (#6709)

* Fix various compiler warnings generated by Apple clang 15, and workaround some boost 1.8 bugs

* Fix formatting.
This commit is contained in:
Daniel Patterson
2023-10-12 14:04:39 -07:00
committed by GitHub
parent b437ce5b33
commit 31e31a63d0
5 changed files with 29 additions and 18 deletions
@@ -887,19 +887,21 @@ CoordinateExtractor::PrepareLengthCache(const std::vector<util::Coordinate> &coo
segment_distances.push_back(0);
// sentinel
// NOLINTNEXTLINE(bugprone-unused-return-value)
std::find_if(std::next(std::begin(coordinates)),
std::end(coordinates),
[last_coordinate = coordinates.front(),
limit,
&segment_distances,
accumulated_distance = 0.](const util::Coordinate current_coordinate) mutable {
const auto distance = util::coordinate_calculation::greatCircleDistance(
last_coordinate, current_coordinate);
accumulated_distance += distance;
last_coordinate = current_coordinate;
segment_distances.push_back(distance);
return accumulated_distance >= limit;
});
// We're only interested in the side effect of the lambda, not the return value
[[maybe_unused]] auto _ = std::find_if(
std::next(std::begin(coordinates)),
std::end(coordinates),
[last_coordinate = coordinates.front(),
limit,
&segment_distances,
accumulated_distance = 0.](const util::Coordinate current_coordinate) mutable {
const auto distance = util::coordinate_calculation::greatCircleDistance(
last_coordinate, current_coordinate);
accumulated_distance += distance;
last_coordinate = current_coordinate;
segment_distances.push_back(distance);
return accumulated_distance >= limit;
});
return segment_distances;
}
@@ -1090,7 +1092,8 @@ CoordinateExtractor::SampleCoordinates(const std::vector<util::Coordinate> &coor
};
// misuse of adjacent_find. Loop over coordinates, until a total sample length is reached
std::adjacent_find(coordinates.begin(), coordinates.end(), add_samples_until_length_limit);
[[maybe_unused]] auto _ =
std::adjacent_find(coordinates.begin(), coordinates.end(), add_samples_until_length_limit);
return sampled_coordinates;
}
+3 -1
View File
@@ -195,7 +195,9 @@ std::size_t DinicMaxFlow::BlockingFlow(FlowEdges &flow,
};
// augment all adjacent edges
std::adjacent_find(path.begin(), path.end(), augment_one);
// We're only interested in the side-effect of the augment_one function, the return
// value is ignored
[[maybe_unused]] auto _ = std::adjacent_find(path.begin(), path.end(), augment_one);
};
const auto augment_all_paths = [&](const NodeID sink_node_id) {
+2 -1
View File
@@ -323,7 +323,8 @@ double findClosestDistance(const std::vector<Coordinate> &lhs, const std::vector
return false;
};
// NOLINTNEXTLINE(bugprone-unused-return-value)
std::find_if(std::begin(lhs), std::end(lhs), compute_minimum_distance_in_rhs);
[[maybe_unused]] auto _ =
std::find_if(std::begin(lhs), std::end(lhs), compute_minimum_distance_in_rhs);
return current_min;
}