Skip to content

Commit

Permalink
Fix all compiler warnings, except sign-compare
Browse files Browse the repository at this point in the history
  • Loading branch information
Coloquinte committed Oct 16, 2023
1 parent 9b872a8 commit 1010cc8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/place_detailed/abacus_legalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void AbacusLegalizer::run() {
for (int i = 0; i < nbRows(); ++i) {
std::vector<int> 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;
Expand Down Expand Up @@ -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<long long>::max();

Expand Down Expand Up @@ -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]) {
Expand Down
2 changes: 2 additions & 0 deletions src/place_detailed/place_detailed.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "place_detailed.hpp"

#define LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS 1
#include <lemon/network_simplex.h>
#include <lemon/smart_graph.h>
#undef LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS

#include <chrono>
#include <iomanip>
Expand Down
2 changes: 1 addition & 1 deletion src/place_detailed/row_legalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ std::vector<int> RowLegalizer::getPlacement() const {
[](int a, int b) -> int { return std::min(a, b); });

std::vector<int> 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_);
Expand Down
4 changes: 2 additions & 2 deletions src/place_global/density_grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
5 changes: 3 additions & 2 deletions src/place_global/density_legalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ DensityLegalizer::Parameters::Parameters() {
DensityLegalizer::DensityLegalizer(DensityGrid grid,
std::vector<int> cellDemand,
const Parameters &params)
: 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 &params)
: HierarchicalDensityPlacement(std::move(pl)) {
: HierarchicalDensityPlacement(std::move(pl)), params_(params) {
cellTargetX_.assign(nbCells(), 0.0f);
cellTargetY_.assign(nbCells(), 0.0f);
}
Expand Down

0 comments on commit 1010cc8

Please sign in to comment.