Eliminate gcc13 warnings.

This commit is contained in:
Andrew Bell 2024-03-19 14:25:07 -04:00 committed by myrtle
parent 5ecb669a41
commit 693058abb7
4 changed files with 8 additions and 18 deletions

View File

@ -152,7 +152,7 @@ protected:
// Constructors
explicit Value(const T &value) : m_value(value) {}
explicit Value(T &&value) : m_value(move(value)) {}
explicit Value(T &&value) : m_value(std::move(value)) {}
// Get type tag
Json::Type type() const override {
@ -199,7 +199,7 @@ class JsonString final : public Value<Json::STRING, string> {
const string &string_value() const override { return m_value; }
public:
explicit JsonString(const string &value) : Value(value) {}
explicit JsonString(string &&value) : Value(move(value)) {}
explicit JsonString(string &&value) : Value(std::move(value)) {}
};
class JsonArray final : public Value<Json::ARRAY, Json::array> {
@ -207,7 +207,7 @@ class JsonArray final : public Value<Json::ARRAY, Json::array> {
const Json & operator[](size_t i) const override;
public:
explicit JsonArray(const Json::array &value) : Value(value) {}
explicit JsonArray(Json::array &&value) : Value(move(value)) {}
explicit JsonArray(Json::array &&value) : Value(std::move(value)) {}
};
class JsonObject final : public Value<Json::OBJECT, Json::object> {
@ -215,7 +215,7 @@ class JsonObject final : public Value<Json::OBJECT, Json::object> {
const Json & operator[](const string &key) const override;
public:
explicit JsonObject(const Json::object &value) : Value(value) {}
explicit JsonObject(Json::object &&value) : Value(move(value)) {}
explicit JsonObject(Json::object &&value) : Value(std::move(value)) {}
};
class JsonNull final : public Value<Json::NUL, NullStruct> {
@ -257,12 +257,12 @@ Json::Json(double value) : m_ptr(make_shared<JsonDouble>(value)) {
Json::Json(int value) : m_ptr(make_shared<JsonInt>(value)) {}
Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {}
Json::Json(const string &value) : m_ptr(make_shared<JsonString>(value)) {}
Json::Json(string &&value) : m_ptr(make_shared<JsonString>(move(value))) {}
Json::Json(string &&value) : m_ptr(make_shared<JsonString>(std::move(value))) {}
Json::Json(const char * value) : m_ptr(make_shared<JsonString>(value)) {}
Json::Json(const Json::array &values) : m_ptr(make_shared<JsonArray>(values)) {}
Json::Json(Json::array &&values) : m_ptr(make_shared<JsonArray>(move(values))) {}
Json::Json(Json::array &&values) : m_ptr(make_shared<JsonArray>(std::move(values))) {}
Json::Json(const Json::object &values) : m_ptr(make_shared<JsonObject>(values)) {}
Json::Json(Json::object &&values) : m_ptr(make_shared<JsonObject>(move(values))) {}
Json::Json(Json::object &&values) : m_ptr(make_shared<JsonObject>(std::move(values))) {}
/* * * * * * * * * * * * * * * * * * * *
* Accessors
@ -360,7 +360,7 @@ struct JsonParser final {
* Mark this parse as failed.
*/
Json fail(string &&msg) {
return fail(move(msg), Json());
return fail(std::move(msg), Json());
}
template <typename T>

View File

@ -177,7 +177,6 @@ struct ThreadState : DetailPlacerThreadState
{
IdString targetType = cell->type;
Loc curr_loc = ctx->getBelLocation(cell->bel);
int count = 0;
int dx = g.radius, dy = g.radius;
if (cell->region != nullptr && cell->region->constr_bels) {
@ -217,7 +216,6 @@ struct ThreadState : DetailPlacerThreadState
}
if (!cell->testRegion(bel))
continue;
count++;
return bel;
}
}

View File

@ -732,7 +732,6 @@ class SAPlacer
{
IdString targetType = cell->type;
Loc curr_loc = ctx->getBelLocation(cell->bel);
int count = 0;
int dx = diameter, dy = diameter;
if (cell->region != nullptr && cell->region->constr_bels) {
@ -772,7 +771,6 @@ class SAPlacer
continue;
if (locked_bels.find(bel) != locked_bels.end())
continue;
count++;
return bel;
}
}

View File

@ -917,7 +917,6 @@ class StaticPlacer
{
float coord_dist = 0;
float grad_dist = 0;
int n = 0;
for (auto &cell : mcells) {
coord_dist += (cell.ref_pos.x - cell.last_ref_pos.x) * (cell.ref_pos.x - cell.last_ref_pos.x);
coord_dist += (cell.ref_pos.y - cell.last_ref_pos.y) * (cell.ref_pos.y - cell.last_ref_pos.y);
@ -925,8 +924,6 @@ class StaticPlacer
(cell.ref_total_grad.x - cell.last_total_grad.x) * (cell.ref_total_grad.x - cell.last_total_grad.x);
grad_dist +=
(cell.ref_total_grad.y - cell.last_total_grad.y) * (cell.ref_total_grad.y - cell.last_total_grad.y);
// keep track of N separately, because we might exclude some cells
++n;
}
coord_dist = std::sqrt(coord_dist / (2 * float(mcells.size())));
grad_dist = std::sqrt(grad_dist / (2 * float(mcells.size())));
@ -1155,7 +1152,6 @@ class StaticPlacer
int radius = 0;
int iter = 0;
int iter_at_radius = 0;
int total_iters_for_cell = 0;
bool placed = false;
BelId bestBel;
int best_inp_len = std::numeric_limits<int>::max();
@ -1374,8 +1370,6 @@ class StaticPlacer
break;
}
}
total_iters_for_cell++;
}
}
}