From 1010cc8daec367949c4cf0fa5548eccdf0fa8391 Mon Sep 17 00:00:00 2001 From: Gabriel Gouvine Date: Mon, 16 Oct 2023 11:35:42 +0200 Subject: [PATCH] Fix all compiler warnings, except sign-compare --- src/parameters.cpp | 7 ++++--- src/place_detailed/abacus_legalizer.cpp | 5 ++--- src/place_detailed/place_detailed.cpp | 2 ++ src/place_detailed/row_legalizer.cpp | 2 +- src/place_global/density_grid.hpp | 4 ++-- src/place_global/density_legalizer.cpp | 5 +++-- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/parameters.cpp b/src/parameters.cpp index c2d92d45..24f8197c 100644 --- a/src/parameters.cpp +++ b/src/parameters.cpp @@ -181,7 +181,7 @@ double interpolateLogEffort(double minVal, double maxVal, int effort, } // namespace ColoquinteParameters::ColoquinteParameters(int effort, int seed) - : seed(seed), global(effort), legalization(effort), detailed(effort) { + : global(effort), legalization(effort), detailed(effort), seed(seed) { if (effort < 1 || effort > 9) { throw std::runtime_error("Placement effort must be between 1 and 9"); } @@ -222,7 +222,8 @@ PenaltyParameters::PenaltyParameters(int effort) { updateFactor = updateFactorArray[effort - 1]; } -ContinuousModelParameters::ContinuousModelParameters(int effort) { +ContinuousModelParameters::ContinuousModelParameters( + [[maybe_unused]] int effort) { netModel = NetModelOption::BoundToBound; approximationDistance = 2.0; approximationDistanceUpdateFactor = 1.0; @@ -275,7 +276,7 @@ DetailedPlacerParameters::DetailedPlacerParameters(int effort) { check(); } -LegalizationParameters::LegalizationParameters(int effort) { +LegalizationParameters::LegalizationParameters([[maybe_unused]] int effort) { costModel = LegalizationModel::L1; orderingHeight = -1.0; // TODO: find best parameter diff --git a/src/place_detailed/abacus_legalizer.cpp b/src/place_detailed/abacus_legalizer.cpp index 2228d399..f8110dc2 100644 --- a/src/place_detailed/abacus_legalizer.cpp +++ b/src/place_detailed/abacus_legalizer.cpp @@ -27,7 +27,7 @@ void AbacusLegalizer::run() { for (int i = 0; i < nbRows(); ++i) { std::vector pl = rowLegalizers_[i].getPlacement(); assert(pl.size() == rowToCells_[i].size()); - for (int j = 0; j < pl.size(); ++j) { + for (size_t j = 0; j < pl.size(); ++j) { int cell = rowToCells_[i][j]; cellToX_[cell] = pl[j]; cellToY_[cell] = rows_[i].minY; @@ -56,7 +56,6 @@ void AbacusLegalizer::placeCell(int cell) { */ int targetX = cellTargetX_[cell]; int targetY = cellTargetY_[cell]; - int bestX = 0; int bestRow = -1; long long bestDist = std::numeric_limits::max(); @@ -123,7 +122,7 @@ void AbacusLegalizer::check() const { } } for (int i = 0; i < nbRows(); ++i) { - for (int j = 0; j + 1 < rowToCells_[i].size(); ++j) { + for (size_t j = 0; j + 1 < rowToCells_[i].size(); ++j) { int c1 = rowToCells_[i][j]; int c2 = rowToCells_[i][j + 1]; if (cellToX_[c1] + cellWidth_[c1] > cellToX_[c2]) { diff --git a/src/place_detailed/place_detailed.cpp b/src/place_detailed/place_detailed.cpp index 3b8c265f..3e6137cb 100644 --- a/src/place_detailed/place_detailed.cpp +++ b/src/place_detailed/place_detailed.cpp @@ -1,7 +1,9 @@ #include "place_detailed.hpp" +#define LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS 1 #include #include +#undef LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS #include #include diff --git a/src/place_detailed/row_legalizer.cpp b/src/place_detailed/row_legalizer.cpp index f8ba52d4..28e7bdc9 100644 --- a/src/place_detailed/row_legalizer.cpp +++ b/src/place_detailed/row_legalizer.cpp @@ -88,7 +88,7 @@ std::vector RowLegalizer::getPlacement() const { [](int a, int b) -> int { return std::min(a, b); }); std::vector ret(finalAbsPos.size()); - for (int i = 0; i < finalAbsPos.size(); ++i) { + for (size_t i = 0; i < finalAbsPos.size(); ++i) { ret[i] = finalAbsPos[i] + cumWidth_[i]; assert(finalAbsPos[i] >= begin_); diff --git a/src/place_global/density_grid.hpp b/src/place_global/density_grid.hpp index 22df9825..a36dc30f 100644 --- a/src/place_global/density_grid.hpp +++ b/src/place_global/density_grid.hpp @@ -351,14 +351,14 @@ class HierarchicalDensityPlacement { /** * @brief Get the x center of a given bin in the current view */ - float binX(int x, int y) const { + float binX(int x, [[maybe_unused]] int y) const { return 0.5 * (binLimitX(x + 1) + binLimitX(x)); } /** * @brief Get the y center of a given bin in the current view */ - float binY(int x, int y) const { + float binY([[maybe_unused]] int x, int y) const { return 0.5 * (binLimitY(y + 1) + binLimitY(y)); } diff --git a/src/place_global/density_legalizer.cpp b/src/place_global/density_legalizer.cpp index 09c4789c..37b5ab78 100644 --- a/src/place_global/density_legalizer.cpp +++ b/src/place_global/density_legalizer.cpp @@ -30,14 +30,15 @@ DensityLegalizer::Parameters::Parameters() { DensityLegalizer::DensityLegalizer(DensityGrid grid, std::vector cellDemand, const Parameters ¶ms) - : HierarchicalDensityPlacement(std::move(grid), std::move(cellDemand)) { + : HierarchicalDensityPlacement(std::move(grid), std::move(cellDemand)), + params_(params) { cellTargetX_.assign(nbCells(), 0.0f); cellTargetY_.assign(nbCells(), 0.0f); } DensityLegalizer::DensityLegalizer(HierarchicalDensityPlacement pl, const Parameters ¶ms) - : HierarchicalDensityPlacement(std::move(pl)) { + : HierarchicalDensityPlacement(std::move(pl)), params_(params) { cellTargetX_.assign(nbCells(), 0.0f); cellTargetY_.assign(nbCells(), 0.0f); }