Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to version 14 of clang-format #895

Merged
merged 3 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Update GitHub Actions (#857)
- Improve error messages (#848)
- Add running `apt-get update` in CI jobs (#863)
- Update formatting script to use `clang-format` 14 (#894)

## [v1.13.0] - 2023-01-31

Expand Down
11 changes: 5 additions & 6 deletions scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,17 @@ elif [[ ${OS} = "Darwin" ]] ; then
fi

# Discover clang-format
if type clang-format-10 2> /dev/null ; then
CLANG_FORMAT=clang-format-10
if type clang-format-14 2> /dev/null ; then
CLANG_FORMAT=clang-format-14
elif type clang-format 2> /dev/null ; then
# Clang format found, but need to check version
CLANG_FORMAT=clang-format
V=$(clang-format --version)
if [[ $V != *10.0* ]] ; then
echo "clang-format is not 10.0 (returned ${V})"
if [[ $V != *14.0* ]] ; then
echo "clang-format is not 14.0 (returned ${V})"
exit 1
fi
else
echo "No appropriate clang-format found (expected clang-format-10, or clang-format)"
echo "No appropriate clang-format found (expected clang-format-14, or clang-format)"
exit 1
fi

Expand Down
9 changes: 4 additions & 5 deletions src/problems/vrp.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ class VRP {
const std::vector<HeuristicParameters>& heterogeneous_parameters) const {
// Use vector of parameters when passed for debugging, else use
// predefined parameter set.
const auto& parameters = (!h_param.empty())
? h_param
: (_input.has_homogeneous_locations())
? homogeneous_parameters
: heterogeneous_parameters;
const auto& parameters = (!h_param.empty()) ? h_param
: (_input.has_homogeneous_locations())
? homogeneous_parameters
: heterogeneous_parameters;
unsigned max_nb_jobs_removal = exploration_level;
unsigned nb_init_solutions = h_param.size();

Expand Down
5 changes: 2 additions & 3 deletions src/utils/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,8 @@ inline Route format_route(const Input& input,
Duration remaining_travel_time =
(r < tw_r.route.size())
? v.duration(previous_job.index(), input.jobs[tw_r.route[r]].index())
: (v.has_end())
? v.duration(previous_job.index(), v.end.value().index())
: 0;
: (v.has_end()) ? v.duration(previous_job.index(), v.end.value().index())
: 0;

// Take into account timing constraints for breaks before current
// job.
Expand Down