# HG changeset patch # User Alpar Juttner # Date 1347529536 -7200 # Node ID 761fe0846f49ded656f1d1e3d40e92c7ea2c89f9 # Parent 157427808b40dfd2f0656084be888e9b481d25f2 Fix clang compilation warnings and errors (#449) diff -r 157427808b40 -r 761fe0846f49 lemon/adaptors.h --- a/lemon/adaptors.h Fri Aug 24 15:37:23 2012 +0200 +++ b/lemon/adaptors.h Thu Sep 13 11:45:36 2012 +0200 @@ -1364,7 +1364,7 @@ /// Creates a subgraph for the given graph with the given node /// and edge filter maps. SubGraph(GR& graph, NF& node_filter, EF& edge_filter) { - initialize(graph, node_filter, edge_filter); + this->initialize(graph, node_filter, edge_filter); } /// \brief Sets the status of the given node @@ -2261,7 +2261,7 @@ /// /// Creates an undirected graph from the given digraph. Undirector(DGR& digraph) { - initialize(digraph); + this->initialize(digraph); } /// \brief Arc map combined from two original arc maps diff -r 157427808b40 -r 761fe0846f49 lemon/bits/bezier.h --- a/lemon/bits/bezier.h Fri Aug 24 15:37:23 2012 +0200 +++ b/lemon/bits/bezier.h Thu Sep 13 11:45:36 2012 +0200 @@ -159,7 +159,7 @@ const Point c=(p3+p4)/2; const Point d=(a+b)/2; const Point e=(b+c)/2; - const Point f=(d+e)/2; + // const Point f=(d+e)/2; R f1=_f(Bezier3(p1,a,d,e),_d); R f2=_f(Bezier3(e,d,c,p4),_d); return _s(f1,f2); diff -r 157427808b40 -r 761fe0846f49 lemon/bits/edge_set_extender.h --- a/lemon/bits/edge_set_extender.h Fri Aug 24 15:37:23 2012 +0200 +++ b/lemon/bits/edge_set_extender.h Thu Sep 13 11:45:36 2012 +0200 @@ -523,13 +523,13 @@ // // Returns the base node of the iterator Node baseNode(const IncEdgeIt &e) const { - return e.direction ? u(e) : v(e); + return e.direction ? this->u(e) : this->v(e); } // Running node of the iterator // // Returns the running node of the iterator Node runningNode(const IncEdgeIt &e) const { - return e.direction ? v(e) : u(e); + return e.direction ? this->v(e) : this->u(e); } diff -r 157427808b40 -r 761fe0846f49 lemon/bits/graph_extender.h --- a/lemon/bits/graph_extender.h Fri Aug 24 15:37:23 2012 +0200 +++ b/lemon/bits/graph_extender.h Thu Sep 13 11:45:36 2012 +0200 @@ -587,13 +587,13 @@ // // Returns the base node of the iterator Node baseNode(const IncEdgeIt &edge) const { - return edge._direction ? u(edge) : v(edge); + return edge._direction ? this->u(edge) : this->v(edge); } // Running node of the iterator // // Returns the running node of the iterator Node runningNode(const IncEdgeIt &edge) const { - return edge._direction ? v(edge) : u(edge); + return edge._direction ? this->v(edge) : this->u(edge); } // Mappable extension diff -r 157427808b40 -r 761fe0846f49 lemon/circulation.h --- a/lemon/circulation.h Fri Aug 24 15:37:23 2012 +0200 +++ b/lemon/circulation.h Thu Sep 13 11:45:36 2012 +0200 @@ -558,8 +558,6 @@ { Node act; - Node bact=INVALID; - Node last_activated=INVALID; while((act=_level->highestActive())!=INVALID) { int actlevel=(*_level)[act]; int mlevel=_node_num; diff -r 157427808b40 -r 761fe0846f49 lemon/concept_check.h --- a/lemon/concept_check.h Fri Aug 24 15:37:23 2012 +0200 +++ b/lemon/concept_check.h Thu Sep 13 11:45:36 2012 +0200 @@ -35,6 +35,22 @@ */ template inline void ignore_unused_variable_warning(const T&) { } + template + inline void ignore_unused_variable_warning(const T1&, const T2&) { } + template + inline void ignore_unused_variable_warning(const T1&, const T2&, + const T3&) { } + template + inline void ignore_unused_variable_warning(const T1&, const T2&, + const T3&, const T4&) { } + template + inline void ignore_unused_variable_warning(const T1&, const T2&, + const T3&, const T4&, + const T5&) { } + template + inline void ignore_unused_variable_warning(const T1&, const T2&, + const T3&, const T4&, + const T5&, const T6&) { } ///\e template diff -r 157427808b40 -r 761fe0846f49 lemon/concepts/graph_components.h --- a/lemon/concepts/graph_components.h Fri Aug 24 15:37:23 2012 +0200 +++ b/lemon/concepts/graph_components.h Thu Sep 13 11:45:36 2012 +0200 @@ -494,6 +494,8 @@ _GraphItemIt it2; _GraphItemIt it3 = it1; _GraphItemIt it4 = INVALID; + ignore_unused_variable_warning(it3); + ignore_unused_variable_warning(it4); it2 = ++it1; ++it2 = it1; @@ -583,6 +585,8 @@ _GraphIncIt it2; _GraphIncIt it3 = it1; _GraphIncIt it4 = INVALID; + ignore_unused_variable_warning(it3); + ignore_unused_variable_warning(it4); it2 = ++it1; ++it2 = it1; diff -r 157427808b40 -r 761fe0846f49 lemon/concepts/maps.h --- a/lemon/concepts/maps.h Fri Aug 24 15:37:23 2012 +0200 +++ b/lemon/concepts/maps.h Thu Sep 13 11:45:36 2012 +0200 @@ -49,7 +49,7 @@ /// Returns the value associated with the given key. Value operator[](const Key &) const { - return *static_cast(0); + return *(static_cast(0)+1); } template diff -r 157427808b40 -r 761fe0846f49 lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h Fri Aug 24 15:37:23 2012 +0200 +++ b/lemon/graph_to_eps.h Thu Sep 13 11:45:36 2012 +0200 @@ -222,7 +222,7 @@ using T::_title; using T::_copyright; - using T::NodeTextColorType; + using typename T::NodeTextColorType; using T::CUST_COL; using T::DIST_COL; using T::DIST_BW; diff -r 157427808b40 -r 761fe0846f49 test/adaptors_test.cc --- a/test/adaptors_test.cc Fri Aug 24 15:37:23 2012 +0200 +++ b/test/adaptors_test.cc Thu Sep 13 11:45:36 2012 +0200 @@ -65,6 +65,7 @@ Digraph::Arc a1 = digraph.addArc(n1, n2); Digraph::Arc a2 = digraph.addArc(n1, n3); Digraph::Arc a3 = digraph.addArc(n2, n3); + ignore_unused_variable_warning(a3); // Check the adaptor checkGraphNodeList(adaptor, 3); @@ -99,6 +100,7 @@ Adaptor::Arc a6 = adaptor.addArc(n2, n4); Adaptor::Arc a7 = adaptor.addArc(n1, n4); Adaptor::Arc a8 = adaptor.addArc(n1, n2); + ignore_unused_variable_warning(a6,a7,a8); adaptor.erase(a1); adaptor.erase(n3); @@ -758,6 +760,7 @@ Digraph::Arc a1 = digraph.addArc(n1, n2); Digraph::Arc a2 = digraph.addArc(n1, n3); Digraph::Arc a3 = digraph.addArc(n2, n3); + ignore_unused_variable_warning(a1,a2,a3); checkGraphNodeList(adaptor, 6); checkGraphArcList(adaptor, 6); diff -r 157427808b40 -r 761fe0846f49 test/connectivity_test.cc --- a/test/connectivity_test.cc Fri Aug 24 15:37:23 2012 +0200 +++ b/test/connectivity_test.cc Thu Sep 13 11:45:36 2012 +0200 @@ -68,6 +68,7 @@ Digraph::NodeMap order(d); Graph g(d); Digraph::Node n = d.addNode(); + ignore_unused_variable_warning(n); check(stronglyConnected(d), "This digraph is strongly connected"); check(countStronglyConnectedComponents(d) == 1, @@ -245,6 +246,7 @@ Digraph::Node shoe = d.addNode(); Digraph::Node watch = d.addNode(); Digraph::Node pants = d.addNode(); + ignore_unused_variable_warning(watch); d.addArc(socks, shoe); d.addArc(pants, shoe); diff -r 157427808b40 -r 761fe0846f49 test/digraph_test.cc --- a/test/digraph_test.cc Fri Aug 24 15:37:23 2012 +0200 +++ b/test/digraph_test.cc Thu Sep 13 11:45:36 2012 +0200 @@ -60,6 +60,7 @@ Arc a2 = G.addArc(n2, n1), a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3); + ignore_unused_variable_warning(a2,a3,a4); checkGraphNodeList(G, 3); checkGraphArcList(G, 4); @@ -88,6 +89,7 @@ Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode(); Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1), a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3); + ignore_unused_variable_warning(a1,a2,a3,a4); Node n4 = G.split(n2); @@ -121,6 +123,7 @@ Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1), a3 = G.addArc(n4, n3), a4 = G.addArc(n4, n3), a5 = G.addArc(n2, n4); + ignore_unused_variable_warning(a1,a2,a3,a5); checkGraphNodeList(G, 4); checkGraphArcList(G, 5); @@ -200,6 +203,7 @@ Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1), a3 = G.addArc(n4, n3), a4 = G.addArc(n3, n1), a5 = G.addArc(n2, n4); + ignore_unused_variable_warning(a2,a3,a4,a5); // Check arc deletion G.erase(a1); @@ -247,6 +251,7 @@ Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode(); Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1), a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3); + ignore_unused_variable_warning(a1,a2,a3,a4); typename Digraph::Snapshot snapshot(G); @@ -335,6 +340,7 @@ Arc e1 = g.addArc(n1, n2), e2 = g.addArc(n2, n3); + ignore_unused_variable_warning(e2); check(g.valid(n1), "Wrong validity check"); check(g.valid(e1), "Wrong validity check"); diff -r 157427808b40 -r 761fe0846f49 test/edge_set_test.cc --- a/test/edge_set_test.cc Fri Aug 24 15:37:23 2012 +0200 +++ b/test/edge_set_test.cc Thu Sep 13 11:45:36 2012 +0200 @@ -44,10 +44,12 @@ n2 = digraph.addNode(); Digraph::Arc ga1 = digraph.addArc(n1, n2); + ignore_unused_variable_warning(ga1); ArcSet arc_set(digraph); Digraph::Arc ga2 = digraph.addArc(n2, n1); + ignore_unused_variable_warning(ga2); checkGraphNodeList(arc_set, 2); checkGraphArcList(arc_set, 0); @@ -75,6 +77,8 @@ ArcSet::Arc a2 = arc_set.addArc(n2, n1), a3 = arc_set.addArc(n2, n3), a4 = arc_set.addArc(n2, n3); + ignore_unused_variable_warning(a2,a3,a4); + checkGraphNodeList(arc_set, 3); checkGraphArcList(arc_set, 4); @@ -110,10 +114,12 @@ n2 = digraph.addNode(); Digraph::Arc ga1 = digraph.addArc(n1, n2); + ignore_unused_variable_warning(ga1); ArcSet arc_set(digraph); Digraph::Arc ga2 = digraph.addArc(n2, n1); + ignore_unused_variable_warning(ga2); checkGraphNodeList(arc_set, 2); checkGraphArcList(arc_set, 0); @@ -141,6 +147,8 @@ ArcSet::Arc a2 = arc_set.addArc(n2, n1), a3 = arc_set.addArc(n2, n3), a4 = arc_set.addArc(n2, n3); + ignore_unused_variable_warning(a2,a3,a4); + checkGraphNodeList(arc_set, 3); checkGraphArcList(arc_set, 4); @@ -190,10 +198,12 @@ n2 = digraph.addNode(); Digraph::Arc ga1 = digraph.addArc(n1, n2); + ignore_unused_variable_warning(ga1); EdgeSet edge_set(digraph); Digraph::Arc ga2 = digraph.addArc(n2, n1); + ignore_unused_variable_warning(ga2); checkGraphNodeList(edge_set, 2); checkGraphArcList(edge_set, 0); @@ -230,6 +240,8 @@ EdgeSet::Edge e2 = edge_set.addEdge(n2, n1), e3 = edge_set.addEdge(n2, n3), e4 = edge_set.addEdge(n2, n3); + ignore_unused_variable_warning(e2,e3,e4); + checkGraphNodeList(edge_set, 3); checkGraphEdgeList(edge_set, 4); @@ -274,10 +286,12 @@ n2 = digraph.addNode(); Digraph::Arc ga1 = digraph.addArc(n1, n2); + ignore_unused_variable_warning(ga1); EdgeSet edge_set(digraph); Digraph::Arc ga2 = digraph.addArc(n2, n1); + ignore_unused_variable_warning(ga2); checkGraphNodeList(edge_set, 2); checkGraphArcList(edge_set, 0); @@ -314,6 +328,8 @@ EdgeSet::Edge e2 = edge_set.addEdge(n2, n1), e3 = edge_set.addEdge(n2, n3), e4 = edge_set.addEdge(n2, n3); + ignore_unused_variable_warning(e2,e3,e4); + checkGraphNodeList(edge_set, 3); checkGraphEdgeList(edge_set, 4); diff -r 157427808b40 -r 761fe0846f49 test/euler_test.cc --- a/test/euler_test.cc Fri Aug 24 15:37:23 2012 +0200 +++ b/test/euler_test.cc Thu Sep 13 11:45:36 2012 +0200 @@ -101,7 +101,8 @@ Digraph d; Graph g(d); Digraph::Node n = d.addNode(); - + ignore_unused_variable_warning(n); + checkDiEulerIt(d); checkDiEulerIt(g); checkEulerIt(g); @@ -189,7 +190,8 @@ Digraph::Node n3 = d.addNode(); Digraph::Node n4 = d.addNode(); Digraph::Node n5 = d.addNode(); - + ignore_unused_variable_warning(n0,n4,n5); + d.addArc(n1, n2); d.addArc(n2, n3); d.addArc(n3, n1); diff -r 157427808b40 -r 761fe0846f49 test/graph_test.cc --- a/test/graph_test.cc Fri Aug 24 15:37:23 2012 +0200 +++ b/test/graph_test.cc Thu Sep 13 11:45:36 2012 +0200 @@ -63,6 +63,7 @@ Edge e2 = G.addEdge(n2, n1), e3 = G.addEdge(n2, n3); + ignore_unused_variable_warning(e2,e3); checkGraphNodeList(G, 3); checkGraphEdgeList(G, 3); @@ -95,6 +96,7 @@ Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1), e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4), e5 = G.addEdge(n4, n3); + ignore_unused_variable_warning(e1,e3,e4,e5); checkGraphNodeList(G, 4); checkGraphEdgeList(G, 5); @@ -174,6 +176,7 @@ Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1), e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4), e5 = G.addEdge(n4, n3); + ignore_unused_variable_warning(e1,e3,e4,e5); // Check edge deletion G.erase(e2); @@ -214,6 +217,7 @@ Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode(); Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1), e3 = G.addEdge(n2, n3); + ignore_unused_variable_warning(e1,e2,e3); checkGraphNodeList(G, 3); checkGraphEdgeList(G, 3); @@ -362,6 +366,7 @@ Edge e1 = g.addEdge(n1, n2), e2 = g.addEdge(n2, n3); + ignore_unused_variable_warning(e2); check(g.valid(n1), "Wrong validity check"); check(g.valid(e1), "Wrong validity check"); @@ -491,6 +496,7 @@ checkGraphArcList(G, dim * (1 << dim)); Node n = G.nodeFromId(dim); + ignore_unused_variable_warning(n); for (NodeIt n(G); n != INVALID; ++n) { checkGraphIncEdgeList(G, n, dim); diff -r 157427808b40 -r 761fe0846f49 test/maps_test.cc --- a/test/maps_test.cc Fri Aug 24 15:37:23 2012 +0200 +++ b/test/maps_test.cc Thu Sep 13 11:45:36 2012 +0200 @@ -78,6 +78,7 @@ checkConcept, NullMap >(); NullMap map1; NullMap map2 = map1; + ignore_unused_variable_warning(map2); map1 = nullMap(); } @@ -88,11 +89,15 @@ ConstMap map1; ConstMap map2 = B(); ConstMap map3 = map1; + ignore_unused_variable_warning(map2,map3); + map1 = constMap(B()); map1 = constMap(); map1.setAll(B()); ConstMap map4(C(1)); ConstMap map5 = map4; + ignore_unused_variable_warning(map5); + map4 = constMap(C(2)); map4.setAll(C(3)); @@ -113,6 +118,8 @@ checkConcept, IdentityMap >(); IdentityMap map1; IdentityMap map2 = map1; + ignore_unused_variable_warning(map2); + map1 = identityMap(); checkConcept, IdentityMap >(); @@ -172,7 +179,9 @@ typedef ComposeMap > CompMap; checkConcept, CompMap>(); CompMap map1 = CompMap(DoubleMap(),ReadMap()); + ignore_unused_variable_warning(map1); CompMap map2 = composeMap(DoubleMap(), ReadMap()); + ignore_unused_variable_warning(map2); SparseMap m1(false); m1[3.14] = true; RangeMap m2(2); m2[0] = 3.0; m2[1] = 3.14; @@ -185,7 +194,9 @@ typedef CombineMap > CombMap; checkConcept, CombMap>(); CombMap map1 = CombMap(DoubleMap(), DoubleMap()); + ignore_unused_variable_warning(map1); CombMap map2 = combineMap(DoubleMap(), DoubleMap(), std::plus()); + ignore_unused_variable_warning(map2); check(combineMap(constMap(), identityMap(), &binc)[B()] == 3, "Something is wrong with CombineMap"); @@ -197,10 +208,15 @@ checkConcept, FunctorToMap >(); FunctorToMap map1; FunctorToMap map2 = FunctorToMap(F()); + ignore_unused_variable_warning(map2); + B b = functorToMap(F())[A()]; + ignore_unused_variable_warning(b); checkConcept, MapToFunctor > >(); - MapToFunctor > map = MapToFunctor >(ReadMap()); + MapToFunctor > map = + MapToFunctor >(ReadMap()); + ignore_unused_variable_warning(map); check(functorToMap(&func)[A()] == 3, "Something is wrong with FunctorToMap"); @@ -218,7 +234,10 @@ checkConcept, ConvertMap, double> >(); ConvertMap, int> map1(rangeMap(1, true)); + ignore_unused_variable_warning(map1); ConvertMap, int> map2 = convertMap(rangeMap(2, false)); + ignore_unused_variable_warning(map2); + } // ForkMap diff -r 157427808b40 -r 761fe0846f49 test/time_measure_test.cc --- a/test/time_measure_test.cc Fri Aug 24 15:37:23 2012 +0200 +++ b/test/time_measure_test.cc Thu Sep 13 11:45:36 2012 +0200 @@ -17,6 +17,7 @@ */ #include +#include using namespace lemon; @@ -32,7 +33,10 @@ static Timer T; for(int i=0;i<1000;i++) - TimeStamp x(T); + { + TimeStamp x(T); + ignore_unused_variable_warning(x); + } } int main()