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 // Constructors
explicit Value(const T &value) : m_value(value) {} 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 // Get type tag
Json::Type type() const override { 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; } const string &string_value() const override { return m_value; }
public: public:
explicit JsonString(const string &value) : Value(value) {} 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> { 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; const Json & operator[](size_t i) const override;
public: public:
explicit JsonArray(const Json::array &value) : Value(value) {} 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> { 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; const Json & operator[](const string &key) const override;
public: public:
explicit JsonObject(const Json::object &value) : Value(value) {} 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> { 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(int value) : m_ptr(make_shared<JsonInt>(value)) {}
Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {} Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {}
Json::Json(const string &value) : m_ptr(make_shared<JsonString>(value)) {} 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 char * value) : m_ptr(make_shared<JsonString>(value)) {}
Json::Json(const Json::array &values) : m_ptr(make_shared<JsonArray>(values)) {} 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(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 * Accessors
@ -360,7 +360,7 @@ struct JsonParser final {
* Mark this parse as failed. * Mark this parse as failed.
*/ */
Json fail(string &&msg) { Json fail(string &&msg) {
return fail(move(msg), Json()); return fail(std::move(msg), Json());
} }
template <typename T> template <typename T>

View File

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

View File

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

View File

@ -917,7 +917,6 @@ class StaticPlacer
{ {
float coord_dist = 0; float coord_dist = 0;
float grad_dist = 0; float grad_dist = 0;
int n = 0;
for (auto &cell : mcells) { 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.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); 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); (cell.ref_total_grad.x - cell.last_total_grad.x) * (cell.ref_total_grad.x - cell.last_total_grad.x);
grad_dist += grad_dist +=
(cell.ref_total_grad.y - cell.last_total_grad.y) * (cell.ref_total_grad.y - cell.last_total_grad.y); (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()))); coord_dist = std::sqrt(coord_dist / (2 * float(mcells.size())));
grad_dist = std::sqrt(grad_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 radius = 0;
int iter = 0; int iter = 0;
int iter_at_radius = 0; int iter_at_radius = 0;
int total_iters_for_cell = 0;
bool placed = false; bool placed = false;
BelId bestBel; BelId bestBel;
int best_inp_len = std::numeric_limits<int>::max(); int best_inp_len = std::numeric_limits<int>::max();
@ -1374,8 +1370,6 @@ class StaticPlacer
break; break;
} }
} }
total_iters_for_cell++;
} }
} }
} }