Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation clean up warning gnu++11 #71

Merged
merged 24 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
70e7d05
rectangle.cpp|401 col 14| warning: this statement may fall through [-…
Thomasb81 Feb 4, 2024
cc9c448
connected_components.cpp|54 col 60| warning: implicitly-declared 'vps…
Thomasb81 Feb 4, 2024
bcfd6ec
Remove previous code
Thomasb81 Feb 4, 2024
e50ab67
cc_nonoverlapconstraints.cpp|202 col 40| warning: comparison of integ…
Thomasb81 Feb 4, 2024
01f1a06
libdialect/util.h|99 col 30| warning: '%2d' directive writing between…
Thomasb81 Feb 4, 2024
be448d9
Optimization : just what we need
Thomasb81 Feb 4, 2024
76ddec1
constraints.cpp|76 col 1| warning: control reaches end of non-void fu…
Thomasb81 Feb 4, 2024
f94e824
Missing one byte for nul terminal caractere
Thomasb81 Feb 4, 2024
a34d17f
constraints.cpp|326 col 53| warning: catching polymorphic type 'class…
Thomasb81 Feb 4, 2024
a78290a
Revert code change
Thomasb81 Feb 4, 2024
4b2a96f
graphs.cpp|114 col 1| warning: control reaches end of non-void functi…
Thomasb81 Feb 5, 2024
0e14af5
graphs.cpp|1080 col 24| warning: 'lastStress' may be used uninitializ…
Thomasb81 Feb 5, 2024
fea7443
ortho.cpp|155 col 1| warning: control reaches end of non-void functio…
Thomasb81 Feb 5, 2024
8e1293b
quadaction.cpp|112 col 19| warning: comparison of unsigned expression…
Thomasb81 Feb 5, 2024
d748672
Typo
Thomasb81 Feb 5, 2024
b5cc581
Fix return function and unsigned/sign comparaison
Thomasb81 Feb 5, 2024
4a4c649
Remove unnecessary return in libdialect/constraints.cpp
Thomasb81 Feb 11, 2024
beca71b
Add variable initialiszation and remove default assignement
Thomasb81 Feb 11, 2024
9aaf15d
Simplify assertion test
Thomasb81 Feb 11, 2024
6759af3
Solve compilation warning according to maintener wish
Thomasb81 Feb 11, 2024
411de67
increase the buffer size to support eventually arch where int would be
Thomasb81 Feb 11, 2024
e48c7f4
Remove useless return statement
Thomasb81 Feb 12, 2024
b950228
remove useless return
Thomasb81 Feb 12, 2024
2a423a5
remove useless comment
Thomasb81 Feb 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cola/libcola/cc_nonoverlapconstraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ void NonOverlapConstraints::computeOverlapForShapePairInfo(ShapePairInfo& info,
{
COLA_ASSERT(shape1.halfDim[0] == 0);
COLA_ASSERT(shape1.halfDim[1] == 0);
COLA_ASSERT(info.varIndex1 + 1 < vs[0].size());
COLA_ASSERT(info.varIndex1 + 1U < vs[0].size());
right1 = vs[0][info.varIndex1 + 1]->finalPosition;
COLA_ASSERT(info.varIndex1 + 1 < vs[1].size());
COLA_ASSERT(info.varIndex1 + 1U < vs[1].size());
top1 = vs[1][info.varIndex1 + 1]->finalPosition;
left1 -= shape1.rectPadding.min(XDIM);
bottom1 -= shape1.rectPadding.min(YDIM);
Expand All @@ -218,9 +218,9 @@ void NonOverlapConstraints::computeOverlapForShapePairInfo(ShapePairInfo& info,
{
COLA_ASSERT(shape2.halfDim[0] == 0);
COLA_ASSERT(shape2.halfDim[1] == 0);
COLA_ASSERT(info.varIndex2 + 1 < vs[0].size());
COLA_ASSERT(info.varIndex2 + 1U < vs[0].size());
right2 = vs[0][info.varIndex2 + 1]->finalPosition;
COLA_ASSERT(info.varIndex2 + 1 < vs[1].size());
COLA_ASSERT(info.varIndex2 + 1U < vs[1].size());
top2 = vs[1][info.varIndex2 + 1]->finalPosition;
left2 -= shape2.rectPadding.min(XDIM);
bottom2 -= shape2.rectPadding.min(YDIM);
Expand Down
4 changes: 2 additions & 2 deletions cola/libdialect/chains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ BendSequences Chain::computePossibleBendSequences(void) const {
try {
CardinalDir dIn = m_graph->getSepMatrix().getCardinalDir(A->id(), b->id());
inDirs.push_back(dIn);
} catch (std::runtime_error) {
} catch (std::runtime_error const&) {
// In this case the left anchor edge is not yet aligned, so we get to consider
// both possible non-aggressive alignments of it.
inDirs = possibleCardinalDirections(A, b);
Expand All @@ -438,7 +438,7 @@ BendSequences Chain::computePossibleBendSequences(void) const {
try {
CardinalDir dOut = m_graph->getSepMatrix().getCardinalDir(y->id(), Z->id());
outDirs.push_back(dOut);
} catch (std::runtime_error) {
} catch (std::runtime_error const&) {
outDirs = possibleCardinalDirections(y, Z);
}
// Now we can look up the possible bend sequences.
Expand Down
8 changes: 6 additions & 2 deletions cola/libdialect/constraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ SepDir dialect::negateSepDir(SepDir sd) {
return SepDir::RIGHT;
case SepDir::UP:
return SepDir::DOWN;
default :
COLA_ASSERT(false);
}
}

Expand Down Expand Up @@ -112,6 +114,8 @@ SepDir dialect::cardinalDirToSepDir(CardinalDir dir) {
return SepDir::WEST;
case CardinalDir::NORTH:
return SepDir::NORTH;
default:
COLA_ASSERT(false);
}
}

Expand Down Expand Up @@ -317,8 +321,8 @@ string SepPair::writeTglf(std::map<id_type, unsigned> id2ext, const SepMatrix &m
ygtStr = ygt == GapType::BDRY ? "B" : "C";
// Prepare indices.
unsigned src, tgt;
try { src = id2ext.at(this->src); } catch (std::out_of_range) { src = this->src; }
try { tgt = id2ext.at(this->tgt); } catch (std::out_of_range) { tgt = this->tgt; }
try { src = id2ext.at(this->src); } catch (std::out_of_range const&) { src = this->src; }
try { tgt = id2ext.at(this->tgt); } catch (std::out_of_range const&) { tgt = this->tgt; }
std::ostringstream ss;
// Vertically aligned
if (xgt == GapType::CENTRE && xst == SepType::EQ && xgap == 0) {
Expand Down
8 changes: 6 additions & 2 deletions cola/libdialect/graphs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ LineSegment_SP BoundingBox::buildSideSegment(CardinalDir side) const {
return std::make_shared<LineSegment>(Point(x, Y), Point(X, Y));
case CardinalDir::NORTH:
return std::make_shared<LineSegment>(Point(x, y), Point(X, y));
default:
COLA_ASSERT(false);
return std::make_shared<LineSegment>(Point(0, 0), Point(0, 0));
Thomasb81 marked this conversation as resolved.
Show resolved Hide resolved

}
}

Expand Down Expand Up @@ -826,7 +830,7 @@ bool Graph::hasSameLayoutAs(const Graph &other, double tol, id_map *idMap) const
++it; ++jt;
}
}
} catch (std::out_of_range) {
} catch (std::out_of_range const&) {
// We invoke the .at() method of various maps, above.
// If any of these fails, the two Graphs do not have the same layout.
return false;
Expand Down Expand Up @@ -1055,7 +1059,7 @@ bool Graph::applyProjSeq(const ColaOptions &opts, ProjSeq &ps, int accept) {
double iel = opts.idealEdgeLength;
if (iel == 0) iel = getIEL();
// Do stress computations iff iel >= 0.
double lastStress;
double lastStress = 0.0;
if (iel >= 0) lastStress = computeStress();
// We will check whether all projections work.
bool allOK = true;
Expand Down
15 changes: 9 additions & 6 deletions cola/libdialect/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,14 @@ Graph_SP dialect::buildGraphFromTglf(istream &in) {
COLA_ASSERT(iss >> i1 >> i2 >> gtc >> dir >> rel1 >> rel2 >> gap);
id_type j1 = nodesByExternalId[i1]->id(),
j2 = nodesByExternalId[i2]->id();
GapType gt;
SepDir sd;
SepType st;
GapType gt{};
SepDir sd{};
SepType st{};
switch(gtc) {
case 'B': gt=GapType::BDRY; break;
case 'C': gt=GapType::CENTRE; break;
COLA_ASSERT(false);
default:
COLA_ASSERT(false);
}
switch(dir) {
case 'E': sd=SepDir::EAST; break;
Expand All @@ -127,12 +128,14 @@ Graph_SP dialect::buildGraphFromTglf(istream &in) {
case 'U': sd=SepDir::UP; break;
case 'X': sd=SepDir::RIGHT; break;
case 'Y': sd=SepDir::DOWN; break;
COLA_ASSERT(false);
default:
COLA_ASSERT(false);
}
switch(rel1) {
case '=': st=SepType::EQ; break;
case '>': st=SepType::INEQ; break;
COLA_ASSERT(false);
default:
COLA_ASSERT(false);
}
graph->getSepMatrix().addSep(j1, j2, gt, sd, st, gap);
break;
Expand Down
9 changes: 9 additions & 0 deletions cola/libdialect/ortho.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ Point Compass::vectorSigns(CompassDir d) {
case CompassDir::NW: return Point(-1, -1);
case CompassDir::NORTH: return Point( 0, -1);
case CompassDir::NE: return Point( 1, -1);
default:
COLA_ASSERT(false);
return Point( 0, 0);
Thomasb81 marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -249,6 +252,9 @@ std::string Compass::dirToString(CompassDir d) {
case CompassDir::SW: return "SW";
case CompassDir::NW: return "NW";
case CompassDir::NE: return "NE";
default :
COLA_ASSERT(false);
return "EAST";
Thomasb81 marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand All @@ -258,6 +264,9 @@ std::string Compass::cardToString(CardinalDir d) {
case CardinalDir::SOUTH: return "SOUTH";
case CardinalDir::WEST: return "WEST";
case CardinalDir::NORTH: return "NORTH";
default:
COLA_ASSERT(false);
return "EAST";
Thomasb81 marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
4 changes: 2 additions & 2 deletions cola/libdialect/quadaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ string Assignment::toString() const {
return s;
}

Quad::Quad(unsigned num) : num(num) {
Quad::Quad(unsigned int num) : num(num) {
// The only valid num's for quadrants are 0, 1, 2, 3.
COLA_ASSERT(0 <= num && num <= 3);
COLA_ASSERT(num <= 3);
}

void Quad::sortAndComputeCosts() {
Expand Down
2 changes: 1 addition & 1 deletion cola/libdialect/quadaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ struct Quad {
//! @brief Standard constructor.
//!
//! @param[in] num The number of this quadrant in {0, 1, 2, 3}
Quad(unsigned num);
Quad(unsigned int num);

//! @brief Add a neighbour.
void addNbr(const Nbr_SP &nbr) { nbrs.push_back(nbr); }
Expand Down
7 changes: 5 additions & 2 deletions cola/libdialect/routing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,12 @@ void RoutingAdapter::recordRoutes(bool refine) {
// in the window are within epsilon of one another (in both dimensions),
// we will skip both.
vector<Point> refined_pts;
size_t N = pts.size() - 2; // the number of interior points
size_t M = pts.size();
// We expect that there are at least two route points.
COLA_ASSERT( M >= 2);
// the number of interior points:
size_t N = M - 2;
// We expect that there are at least two route points.
Thomasb81 marked this conversation as resolved.
Show resolved Hide resolved
COLA_ASSERT(N >= 0);
size_t i = 0;
// We always keep the first route point.
refined_pts.push_back(pts[0]);
Expand Down
2 changes: 1 addition & 1 deletion cola/libdialect/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct Matrix2d {
std::string toString() const {
std::string s = "";
s += "\n ";
char buffer [10];
char buffer [21];
for (int j=0; j<cols; j++) {
sprintf(buffer," %2d",j);
s += std::string(buffer);
Expand Down
1 change: 1 addition & 0 deletions cola/libvpsc/rectangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ inline bool checkIntersection(
ri.intersects=side=true;
sideX=intersection.x_;
sideY=intersection.y_;
return true;
case LineSegment::PARALLEL:
case LineSegment::NOT_INTERSECTING:
return true;
Expand Down
9 changes: 3 additions & 6 deletions cola/libvpsc/rectangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,10 @@ class Rectangle {
*/
Rectangle(double x, double X, double y, double Y,
bool allowOverlap = false);
Rectangle(Rectangle const &Other)
: minX(Other.minX)
, maxX(Other.maxX)
, minY(Other.minY)
, maxY(Other.maxY)
, overlap(Other.overlap) { }
Rectangle(const Rectangle &Other) = default;
Rectangle();
~Rectangle() {}

bool isValid(void) const;
Rectangle unionWith(const Rectangle& rhs) const;
/*
Expand Down