Skip to content

Commit b28edf1

Browse files
gchateletMizux
authored andcommitted
Fix warning 'control reaches end of non-void function' (#4964)
1 parent 0782d13 commit b28edf1

27 files changed

+92
-20
lines changed

ortools/constraint_solver/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ cc_library(
379379
deps = [
380380
":routing_enums_cc_proto",
381381
":routing_ils_cc_proto",
382+
"@abseil-cpp//absl/base:core_headers",
382383
],
383384
)
384385

ortools/constraint_solver/routing_ils_parameters_utils.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ std::string GetRecreateParametersName(
6060
case RecreateParameters::PARAMETERS_NOT_SET:
6161
return "PARAMETERS_NOT_SET";
6262
}
63+
ABSL_UNREACHABLE();
6364
}
6465

6566
} // namespace operations_research

ortools/glop/BUILD.bazel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ cc_library(
225225
"//ortools/lp_data:base",
226226
"//ortools/lp_data:lp_utils",
227227
"//ortools/lp_data:sparse",
228+
"//ortools/lp_data:sparse_column",
229+
"@abseil-cpp//absl/base:core_headers",
230+
"@abseil-cpp//absl/log",
231+
"@abseil-cpp//absl/log:check",
228232
],
229233
)
230234

ortools/glop/initial_basis.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@
2020
#include <queue>
2121
#include <vector>
2222

23+
#include "absl/base/optimization.h"
24+
#include "absl/log/check.h"
25+
#include "absl/log/log.h"
2326
#include "ortools/glop/markowitz.h"
27+
#include "ortools/lp_data/lp_types.h"
2428
#include "ortools/lp_data/lp_utils.h"
29+
#include "ortools/lp_data/sparse.h"
30+
#include "ortools/lp_data/sparse_column.h"
2531

2632
namespace operations_research {
2733
namespace glop {
@@ -219,6 +225,8 @@ int InitialBasis::GetMarosPriority(ColIndex col) const {
219225
case VariableType::FIXED_VARIABLE:
220226
return 0;
221227
}
228+
LOG(FATAL) << "Invalid variable type: "
229+
<< static_cast<int>(variable_type_[col]);
222230
}
223231

224232
int InitialBasis::GetMarosPriority(RowIndex row) const {
@@ -388,6 +396,7 @@ int InitialBasis::GetColumnCategory(ColIndex col) const {
388396
case VariableType::FIXED_VARIABLE:
389397
return 5;
390398
}
399+
ABSL_UNREACHABLE();
391400
}
392401

393402
Fractional InitialBasis::GetColumnPenalty(ColIndex col) const {

ortools/glop/primal_edge_norms.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "ortools/glop/primal_edge_norms.h"
1515

1616
#include <algorithm>
17+
#include <cmath>
1718
#include <cstdlib>
1819

1920
#include "absl/log/check.h"
@@ -68,6 +69,7 @@ DenseRow::ConstView PrimalEdgeNorms::GetSquaredNorms() {
6869
case GlopParameters::DEVEX:
6970
return GetDevexWeights().const_view();
7071
}
72+
LOG(FATAL) << "Invalid pricing rule: " << pricing_rule_;
7173
}
7274

7375
const DenseRow& PrimalEdgeNorms::GetEdgeSquaredNorms() {

ortools/math_opt/core/math_opt_proto_utils.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <optional>
2222
#include <string>
2323

24+
#include "absl/base/optimization.h"
2425
#include "absl/container/flat_hash_set.h"
2526
#include "absl/log/check.h"
2627
#include "absl/log/log.h"
@@ -403,6 +404,7 @@ absl::Status ModelIsSupported(const ModelProto& model,
403404
case SupportType::kSupported:
404405
LOG(FATAL) << "Unexpected call with `kSupported`";
405406
}
407+
ABSL_UNREACHABLE();
406408
};
407409
if (const SupportType support = support_menu.integer_variables;
408410
support != SupportType::kSupported) {

ortools/math_opt/elemental/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ cc_test(
412412
":tagged_id",
413413
"//ortools/base:gmock_main",
414414
"//ortools/math_opt/testing:stream",
415+
"@abseil-cpp//absl/base:core_headers",
415416
"@abseil-cpp//absl/hash:hash_testing",
416417
"@abseil-cpp//absl/strings",
417418
],

ortools/math_opt/elemental/tagged_id_test.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <ostream>
1919
#include <utility>
2020

21+
#include "absl/base/optimization.h"
2122
#include "absl/hash/hash_testing.h"
2223
#include "absl/strings/str_cat.h"
2324
#include "gtest/gtest.h"
@@ -39,6 +40,7 @@ std::ostream& operator<<(std::ostream& ostr, const TestEnum& e) {
3940
ostr << "kValue0";
4041
return ostr;
4142
}
43+
ABSL_UNREACHABLE();
4244
}
4345

4446
using TestEnumId = TaggedId<TestEnum::kValue0>;

ortools/math_opt/solver_tests/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ cc_library(
322322
"//ortools/math_opt/cpp:math_opt",
323323
"//ortools/math_opt/io:mps_converter",
324324
"//ortools/port:proto_utils",
325+
"@abseil-cpp//absl/base:core_headers",
325326
"@abseil-cpp//absl/status",
326327
"@abseil-cpp//absl/status:statusor",
327328
"@abseil-cpp//absl/strings:string_view",

ortools/math_opt/solver_tests/multi_objective_tests.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <ostream>
1818
#include <utility>
1919

20+
#include "absl/base/optimization.h"
2021
#include "absl/status/status.h"
2122
#include "absl/status/statusor.h"
2223
#include "absl/strings/string_view.h"
@@ -210,6 +211,7 @@ absl::StatusOr<SimpleMultiObjectiveSolveResult> SolveWithObjectiveDegradation(
210211
case ObjectiveType::kAuxiliary:
211212
return model.AddMaximizationObjective(x, /*priority=*/0);
212213
}
214+
ABSL_UNREACHABLE();
213215
}();
214216
const Objective priority_1 = [&]() {
215217
switch (priority_1_type) {
@@ -220,6 +222,7 @@ absl::StatusOr<SimpleMultiObjectiveSolveResult> SolveWithObjectiveDegradation(
220222
case ObjectiveType::kAuxiliary:
221223
return model.AddMinimizationObjective(x, /*priority=*/1);
222224
}
225+
ABSL_UNREACHABLE();
223226
}();
224227
ModelSolveParameters model_parameters;
225228
switch (tolerance_type) {

0 commit comments

Comments
 (0)