Fix warning 'control reaches end of non-void function' (#4964)

This commit is contained in:
Guillaume Chatelet
2025-12-24 14:11:17 +01:00
committed by Corentin Le Molgat
parent 0782d13065
commit b28edf1d04
27 changed files with 92 additions and 20 deletions

View File

@@ -318,6 +318,7 @@ struct Edge {
.y_start = rectangle.y_min,
.size = rectangle.SizeY()};
}
LOG(FATAL) << "Invalid edge position: " << static_cast<int>(pos);
}
template <typename H>
@@ -598,6 +599,7 @@ IntegerValue GetClockwiseStart(EdgePosition edge, const Rectangle& rectangle) {
case EdgePosition::TOP:
return rectangle.x_min;
}
LOG(FATAL) << "Invalid edge position: " << static_cast<int>(edge);
}
IntegerValue GetClockwiseEnd(EdgePosition edge, const Rectangle& rectangle) {
@@ -611,6 +613,7 @@ IntegerValue GetClockwiseEnd(EdgePosition edge, const Rectangle& rectangle) {
case EdgePosition::TOP:
return rectangle.x_max;
}
LOG(FATAL) << "Invalid edge position: " << static_cast<int>(edge);
}
// Given a list of rectangles and their neighbours graph, find the list of

View File

@@ -21,6 +21,7 @@
#include "absl/algorithm/container.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/inlined_vector.h"
#include "absl/log/log.h"
#include "absl/types/span.h"
#include "ortools/sat/diffn_util.h"
#include "ortools/sat/integer_base.h"
@@ -180,6 +181,7 @@ class Neighbours {
case EdgePosition::RIGHT:
return std::tie(a.y_min, a.y_max) > std::tie(b.y_min, b.y_max);
}
LOG(FATAL) << "Invalid edge position: " << static_cast<int>(edge_);
}
EdgePosition edge_;
};

View File

@@ -426,6 +426,7 @@ cc_library(
"//ortools/util:bitset",
"//ortools/util:saturated_arithmetic",
"//ortools/util:sorted_interval_list",
"@abseil-cpp//absl/base:core_headers",
"@abseil-cpp//absl/container:flat_hash_map",
"@abseil-cpp//absl/container:flat_hash_set",
"@abseil-cpp//absl/flags:flag",
@@ -2308,6 +2309,7 @@ cc_library(
":sat_base",
":scheduling_helpers",
":util",
"@abseil-cpp//absl/base:core_headers",
"@abseil-cpp//absl/base:log_severity",
"@abseil-cpp//absl/log",
"@abseil-cpp//absl/log:check",
@@ -3684,14 +3686,12 @@ cc_library(
":integer_base",
":scheduling_helpers",
":util",
"//ortools/base:logging",
"//ortools/base:stl_util",
"//ortools/base:strong_vector",
"//ortools/graph:connected_components",
"//ortools/graph:strongly_connected_components",
"//ortools/util:fixed_shape_binary_tree",
"//ortools/util:integer_pq",
"//ortools/util:saturated_arithmetic",
"//ortools/util:strong_integers",
"@abseil-cpp//absl/algorithm:container",
"@abseil-cpp//absl/container:btree",
@@ -3703,7 +3703,6 @@ cc_library(
"@abseil-cpp//absl/log:vlog_is_on",
"@abseil-cpp//absl/random:bit_gen_ref",
"@abseil-cpp//absl/strings:str_format",
"@abseil-cpp//absl/types:optional",
"@abseil-cpp//absl/types:span",
],
)

View File

@@ -22,6 +22,7 @@
#include <utility>
#include <vector>
#include "absl/base/optimization.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "absl/flags/flag.h"
@@ -547,6 +548,7 @@ absl::string_view ConstraintCaseName(
case ConstraintProto::ConstraintCase::CONSTRAINT_NOT_SET:
return "kEmpty";
}
ABSL_UNREACHABLE();
}
std::vector<int> UsedVariables(const ConstraintProto& ct) {

View File

@@ -41,7 +41,6 @@
#include "absl/log/vlog_is_on.h"
#include "absl/random/bit_gen_ref.h"
#include "absl/types/span.h"
#include "ortools/base/logging.h"
#include "ortools/base/stl_util.h"
#include "ortools/base/strong_vector.h"
#include "ortools/graph/connected_components.h"
@@ -1114,6 +1113,7 @@ constexpr const EdgeInfo& GetEdgeInfo(ProbingRectangle::Edge edge) {
case Edge::TOP:
return EdgeInfoHolder::kTop;
}
LOG(FATAL) << "Invalid edge: " << static_cast<int>(edge);
}
IntegerValue GetSmallest1DIntersection(ProbingRectangle::Direction direction,
@@ -1129,6 +1129,7 @@ IntegerValue GetSmallest1DIntersection(ProbingRectangle::Direction direction,
range.bounding_area.y_max, range.y_size,
rectangle.y_min, rectangle.y_max);
}
LOG(FATAL) << "Invalid direction: " << static_cast<int>(direction);
}
} // namespace
@@ -1391,6 +1392,7 @@ IntegerValue ProbingRectangle::GetShrinkDeltaArea(Edge edge) const {
case Edge::TOP:
return (current_rectangle.y_max - coordinate) * current_rectangle.SizeX();
}
LOG(FATAL) << "Invalid edge: " << static_cast<int>(edge);
}
void ProbingRectangle::CacheShrinkDeltaEnergy(int dimension) {
@@ -1493,6 +1495,7 @@ bool ProbingRectangle::CanShrink(Edge edge) const {
case Edge::TOP:
return (indexes_[Edge::TOP] > next_indexes_[Edge::BOTTOM]);
}
LOG(FATAL) << "Invalid edge: " << static_cast<int>(edge);
}
namespace {

View File

@@ -28,14 +28,13 @@
#include "absl/container/flat_hash_set.h"
#include "absl/container/inlined_vector.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/random/bit_gen_ref.h"
#include "absl/strings/str_format.h"
#include "absl/types/optional.h"
#include "absl/types/span.h"
#include "ortools/sat/integer_base.h"
#include "ortools/sat/scheduling_helpers.h"
#include "ortools/sat/util.h"
#include "ortools/util/saturated_arithmetic.h"
#include "ortools/util/strong_integers.h"
namespace operations_research {
@@ -471,6 +470,7 @@ struct RectangleInRange {
.y_min = bounding_area.y_max - y_size,
.y_max = bounding_area.y_max};
}
LOG(FATAL) << "Invalid corner: " << static_cast<int>(p);
}
Rectangle GetBoudingBox() const { return bounding_area; }

View File

@@ -19,6 +19,7 @@
#include <vector>
#include "absl/base/log_severity.h"
#include "absl/base/optimization.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/types/span.h"
@@ -188,6 +189,7 @@ bool NoOverlap2DConstraintHelper::PropagateRelativePosition(
return LeftBoxBeforeRightBoxOnFirstDimension(
second, first, y_helper_.get(), x_helper_.get());
}
ABSL_UNREACHABLE();
}
void NoOverlap2DConstraintHelper::Reset(