# HG changeset patch # User Alpar Juttner # Date 1541098148 -3600 # Node ID 332eab7995feb21bda0f335e7038e48b15eeeaef # Parent e5af35e6c93ff93f73cbe6ab3eef8e6750518457# Parent f179aa1045a4a179215d017a324f5177d72d7b2c Merge #615 to branch 1.3 diff -r e5af35e6c93f -r 332eab7995fe CMakeLists.txt --- a/CMakeLists.txt Wed Oct 17 19:18:04 2018 +0200 +++ b/CMakeLists.txt Thu Nov 01 19:49:08 2018 +0100 @@ -148,14 +148,27 @@ "Default MIP solver backend (GLPK, CPLEX or CBC)") ENDIF() +IF( ( ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND + ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER_EQUAL "4.8") ) + OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + ) + SET(LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS TRUE) +ENDIF() IF(DEFINED ENV{LEMON_CXX_WARNING}) SET(CXX_WARNING $ENV{LEMON_CXX_WARNING}) ELSE() - IF(CMAKE_COMPILER_IS_GNUCXX) + IF( ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + ) SET(CXX_WARNING "-Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas") SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb") SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb") + ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + SET(CXX_WARNING "-Wall -W -Wunused -Wformat=2 -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wsign-promo -Woverloaded-virtual -fno-strict-aliasing -Wno-unknown-pragmas") + SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb") + SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb") ELSEIF(MSVC) # This part is unnecessary 'casue the same is set by the lemon/core.h. # Still kept as an example. diff -r e5af35e6c93f -r 332eab7995fe lemon/bfs.h --- a/lemon/bfs.h Wed Oct 17 19:18:04 2018 +0200 +++ b/lemon/bfs.h Thu Nov 01 19:49:08 2018 +0100 @@ -1376,7 +1376,7 @@ template struct SetReachedMapTraits : public Traits { typedef T ReachedMap; - static ReachedMap *createReachedMap(const Digraph &digraph) { + static ReachedMap *createReachedMap(const Digraph &) { LEMON_ASSERT(false, "ReachedMap is not initialized"); return 0; // ignore warnings } diff -r e5af35e6c93f -r 332eab7995fe lemon/concepts/graph_components.h --- a/lemon/concepts/graph_components.h Wed Oct 17 19:18:04 2018 +0200 +++ b/lemon/concepts/graph_components.h Thu Nov 01 19:49:08 2018 +0100 @@ -103,6 +103,7 @@ _GraphItem i1; i1=INVALID; _GraphItem i2 = i1; + ::lemon::ignore_unused_variable_warning(i2); _GraphItem i3 = INVALID; i1 = i2 = i3; @@ -734,6 +735,7 @@ ++(++it1); Item bi = it1; + ::lemon::ignore_unused_variable_warning(bi); bi = it2; } const GR& g; @@ -824,6 +826,7 @@ ++it2 = it1; ++(++it1); Item e = it1; + ::lemon::ignore_unused_variable_warning(e); e = it2; } const Base& node; diff -r e5af35e6c93f -r 332eab7995fe lemon/concepts/path.h --- a/lemon/concepts/path.h Wed Oct 17 19:18:04 2018 +0200 +++ b/lemon/concepts/path.h Thu Nov 01 19:49:08 2018 +0100 @@ -70,7 +70,9 @@ /// \brief Template copy constructor template - Path(const CPath& cpath) {} + Path(const CPath& cpath) { + ::lemon::ignore_unused_variable_warning(cpath); + } /// \brief Template assigment operator template diff -r e5af35e6c93f -r 332eab7995fe lemon/config.h.in --- a/lemon/config.h.in Wed Oct 17 19:18:04 2018 +0200 +++ b/lemon/config.h.in Thu Nov 01 19:49:08 2018 +0100 @@ -2,6 +2,7 @@ #define LEMON_CONFIG_H #define LEMON_VERSION "@PROJECT_VERSION@" + #cmakedefine LEMON_HAVE_LONG_LONG 1 #cmakedefine LEMON_WIN32 1 @@ -26,4 +27,6 @@ #cmakedefine LEMON_USE_PTHREAD 1 #cmakedefine LEMON_USE_WIN32_THREADS 1 +#cmakedefine LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS 1 + #endif diff -r e5af35e6c93f -r 332eab7995fe lemon/core.h --- a/lemon/core.h Wed Oct 17 19:18:04 2018 +0200 +++ b/lemon/core.h Thu Nov 01 19:49:08 2018 +0100 @@ -33,19 +33,21 @@ // C4503: 'function' : decorated name length exceeded, name was truncated // C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning) // C4996: 'function': was declared deprecated + +#include + #ifdef _MSC_VER #pragma warning( disable : 4250 4267 4355 4503 4800 4996 ) #endif -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) -// Needed by the [DI]GRAPH_TYPEDEFS marcos for gcc 4.8 +#if LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS +// Needed by the [DI]GRAPH_TYPEDEFS marcos for gcc >=4.8 and clang #pragma GCC diagnostic ignored "-Wunused-local-typedefs" #endif #include #include -#include #include #include #include diff -r e5af35e6c93f -r 332eab7995fe lemon/dfs.h --- a/lemon/dfs.h Wed Oct 17 19:18:04 2018 +0200 +++ b/lemon/dfs.h Thu Nov 01 19:49:08 2018 +0100 @@ -1318,7 +1318,7 @@ template struct SetReachedMapTraits : public Traits { typedef T ReachedMap; - static ReachedMap *createReachedMap(const Digraph &digraph) { + static ReachedMap *createReachedMap(const Digraph &) { LEMON_ASSERT(false, "ReachedMap is not initialized"); return 0; // ignore warnings } diff -r e5af35e6c93f -r 332eab7995fe lemon/nagamochi_ibaraki.h --- a/lemon/nagamochi_ibaraki.h Wed Oct 17 19:18:04 2018 +0200 +++ b/lemon/nagamochi_ibaraki.h Thu Nov 01 19:49:08 2018 +0100 @@ -174,7 +174,7 @@ struct SetHeapTraits : public Traits { typedef CR HeapCrossRef; typedef H Heap; - static HeapCrossRef *createHeapCrossRef(int num) { + static HeapCrossRef *createHeapCrossRef(int) { LEMON_ASSERT(false, "HeapCrossRef is not initialized"); return 0; // ignore warnings } diff -r e5af35e6c93f -r 332eab7995fe test/adaptors_test.cc --- a/test/adaptors_test.cc Wed Oct 17 19:18:04 2018 +0200 +++ b/test/adaptors_test.cc Thu Nov 01 19:49:08 2018 +0100 @@ -145,12 +145,16 @@ // Check the conversion of nodes and arcs Digraph::Node nd = n4; + ::lemon::ignore_unused_variable_warning(nd); nd = n4; Adaptor::Node na = n1; + ::lemon::ignore_unused_variable_warning(na); na = n2; Digraph::Arc ad = a4; + ::lemon::ignore_unused_variable_warning(ad); ad = a5; Adaptor::Arc aa = a1; + ::lemon::ignore_unused_variable_warning(aa); aa = a2; } @@ -269,12 +273,16 @@ // Check the conversion of nodes and arcs Digraph::Node nd = n3; + ::lemon::ignore_unused_variable_warning(nd); nd = n3; Adaptor::Node na = n1; + ::lemon::ignore_unused_variable_warning(na); na = n2; Digraph::Arc ad = a3; + ::lemon::ignore_unused_variable_warning(ad); ad = a3; Adaptor::Arc aa = a1; + ::lemon::ignore_unused_variable_warning(aa); aa = a2; } @@ -365,12 +373,16 @@ // Check the conversion of nodes and arcs Digraph::Node nd = n3; + ::lemon::ignore_unused_variable_warning(nd); nd = n3; Adaptor::Node na = n1; + ::lemon::ignore_unused_variable_warning(na); na = n2; Digraph::Arc ad = a3; + ::lemon::ignore_unused_variable_warning(ad); ad = a3; Adaptor::Arc aa = a1; + ::lemon::ignore_unused_variable_warning(aa); aa = a2; } @@ -463,12 +475,16 @@ // Check the conversion of nodes and arcs Digraph::Node nd = n3; + ::lemon::ignore_unused_variable_warning(nd); nd = n3; Adaptor::Node na = n1; + ::lemon::ignore_unused_variable_warning(na); na = n2; Digraph::Arc ad = a3; + ::lemon::ignore_unused_variable_warning(ad); ad = a3; Adaptor::Arc aa = a1; + ::lemon::ignore_unused_variable_warning(aa); aa = a2; } @@ -574,12 +590,16 @@ // Check the conversion of nodes and arcs/edges Digraph::Node nd = n3; + ::lemon::ignore_unused_variable_warning(nd); nd = n3; Adaptor::Node na = n1; + ::lemon::ignore_unused_variable_warning(na); na = n2; Digraph::Arc ad = e3; + ::lemon::ignore_unused_variable_warning(ad); ad = e3; Adaptor::Edge ea = a1; + ::lemon::ignore_unused_variable_warning(ea); ea = a2; } @@ -734,10 +754,13 @@ // Check the conversion of nodes and arcs Digraph::Node nd = Adaptor::NodeIt(adaptor); + ::lemon::ignore_unused_variable_warning(nd); nd = ++Adaptor::NodeIt(adaptor); Adaptor::Node na = n1; + ::lemon::ignore_unused_variable_warning(na); na = n2; Digraph::Arc ad = Adaptor::ArcIt(adaptor); + ::lemon::ignore_unused_variable_warning(ad); ad = ++Adaptor::ArcIt(adaptor); } @@ -987,12 +1010,16 @@ // Check the conversion of nodes and edges Graph::Node ng = n3; + ::lemon::ignore_unused_variable_warning(ng); ng = n4; Adaptor::Node na = n1; + ::lemon::ignore_unused_variable_warning(na); na = n2; Graph::Edge eg = e3; + ::lemon::ignore_unused_variable_warning(eg); eg = e4; Adaptor::Edge ea = e1; + ::lemon::ignore_unused_variable_warning(ea); ea = e2; } @@ -1092,12 +1119,16 @@ // Check the conversion of nodes and edges Graph::Node ng = n3; + ::lemon::ignore_unused_variable_warning(ng); ng = n4; Adaptor::Node na = n1; + ::lemon::ignore_unused_variable_warning(na); na = n2; Graph::Edge eg = e3; + ::lemon::ignore_unused_variable_warning(eg); eg = e4; Adaptor::Edge ea = e1; + ::lemon::ignore_unused_variable_warning(ea); ea = e2; } @@ -1198,12 +1229,16 @@ // Check the conversion of nodes and edges Graph::Node ng = n3; + ::lemon::ignore_unused_variable_warning(ng); ng = n4; Adaptor::Node na = n1; + ::lemon::ignore_unused_variable_warning(na); na = n2; Graph::Edge eg = e3; + ::lemon::ignore_unused_variable_warning(eg); eg = e4; Adaptor::Edge ea = e1; + ::lemon::ignore_unused_variable_warning(ea); ea = e2; } @@ -1356,12 +1391,16 @@ // Check the conversion of nodes and arcs/edges Graph::Node ng = n3; + ::lemon::ignore_unused_variable_warning(ng); ng = n3; Adaptor::Node na = n1; + ::lemon::ignore_unused_variable_warning(na); na = n2; Graph::Edge eg = e3; + ::lemon::ignore_unused_variable_warning(eg); eg = e3; Adaptor::Arc aa = e1; + ::lemon::ignore_unused_variable_warning(aa); aa = e2; }