Merge #615
authorAlpar Juttner <alpar@cs.elte.hu>
Thu, 01 Nov 2018 19:49:51 +0100
changeset 14172236d00ca778
parent 1415 959d78f3fe0e
parent 1416 f179aa1045a4
child 1418 15282595e6f4
Merge #615
CMakeLists.txt
lemon/concepts/path.h
lemon/config.h.in
     1.1 --- a/CMakeLists.txt	Wed Oct 17 22:56:43 2018 +0200
     1.2 +++ b/CMakeLists.txt	Thu Nov 01 19:49:51 2018 +0100
     1.3 @@ -152,14 +152,27 @@
     1.4      "Default MIP solver backend (GLPK, CPLEX or CBC)")
     1.5  ENDIF()
     1.6  
     1.7 +IF( ( ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND
     1.8 +      ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER_EQUAL "4.8") )
     1.9 +    OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    1.10 +    OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
    1.11 +    )
    1.12 +  SET(LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS TRUE)
    1.13 +ENDIF()
    1.14  
    1.15  IF(DEFINED ENV{LEMON_CXX_WARNING})
    1.16    SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
    1.17  ELSE()
    1.18 -  IF(CMAKE_COMPILER_IS_GNUCXX)
    1.19 +  IF( ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
    1.20 +      OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    1.21 +      )
    1.22      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")
    1.23      SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
    1.24      SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
    1.25 +  ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
    1.26 +    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")
    1.27 +    SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
    1.28 +    SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
    1.29    ELSEIF(MSVC)
    1.30      # This part is unnecessary 'casue the same is set by the lemon/core.h.
    1.31      # Still kept as an example.
     2.1 --- a/lemon/bfs.h	Wed Oct 17 22:56:43 2018 +0200
     2.2 +++ b/lemon/bfs.h	Thu Nov 01 19:49:51 2018 +0100
     2.3 @@ -1376,7 +1376,7 @@
     2.4      template <class T>
     2.5      struct SetReachedMapTraits : public Traits {
     2.6        typedef T ReachedMap;
     2.7 -      static ReachedMap *createReachedMap(const Digraph &digraph) {
     2.8 +      static ReachedMap *createReachedMap(const Digraph &) {
     2.9          LEMON_ASSERT(false, "ReachedMap is not initialized");
    2.10          return 0; // ignore warnings
    2.11        }
     3.1 --- a/lemon/concepts/graph_components.h	Wed Oct 17 22:56:43 2018 +0200
     3.2 +++ b/lemon/concepts/graph_components.h	Thu Nov 01 19:49:51 2018 +0100
     3.3 @@ -103,6 +103,7 @@
     3.4            _GraphItem i1;
     3.5            i1=INVALID;
     3.6            _GraphItem i2 = i1;
     3.7 +          ::lemon::ignore_unused_variable_warning(i2);
     3.8            _GraphItem i3 = INVALID;
     3.9  
    3.10            i1 = i2 = i3;
    3.11 @@ -734,6 +735,7 @@
    3.12            ++(++it1);
    3.13  
    3.14            Item bi = it1;
    3.15 +          ::lemon::ignore_unused_variable_warning(bi);
    3.16            bi = it2;
    3.17          }
    3.18          const GR& g;
    3.19 @@ -824,6 +826,7 @@
    3.20            ++it2 = it1;
    3.21            ++(++it1);
    3.22            Item e = it1;
    3.23 +          ::lemon::ignore_unused_variable_warning(e);
    3.24            e = it2;
    3.25          }
    3.26          const Base& node;
     4.1 --- a/lemon/concepts/path.h	Wed Oct 17 22:56:43 2018 +0200
     4.2 +++ b/lemon/concepts/path.h	Thu Nov 01 19:49:51 2018 +0100
     4.3 @@ -71,7 +71,9 @@
     4.4  
     4.5        /// \brief Template copy constructor
     4.6        template <typename CPath>
     4.7 -      Path(const CPath& cpath) {}
     4.8 +      Path(const CPath& cpath) {
     4.9 +        ::lemon::ignore_unused_variable_warning(cpath);
    4.10 +      }
    4.11  
    4.12        /// \brief Template assigment operator
    4.13        template <typename CPath>
     5.1 --- a/lemon/config.h.in	Wed Oct 17 22:56:43 2018 +0200
     5.2 +++ b/lemon/config.h.in	Thu Nov 01 19:49:51 2018 +0100
     5.3 @@ -2,6 +2,7 @@
     5.4  #define LEMON_CONFIG_H
     5.5  
     5.6  #define LEMON_VERSION "@PROJECT_VERSION@"
     5.7 +
     5.8  #cmakedefine LEMON_HAVE_LONG_LONG 1
     5.9  
    5.10  #cmakedefine LEMON_CXX11 1
    5.11 @@ -28,4 +29,6 @@
    5.12  #cmakedefine LEMON_USE_PTHREAD 1
    5.13  #cmakedefine LEMON_USE_WIN32_THREADS 1
    5.14  
    5.15 +#cmakedefine LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS 1
    5.16 +
    5.17  #endif
     6.1 --- a/lemon/core.h	Wed Oct 17 22:56:43 2018 +0200
     6.2 +++ b/lemon/core.h	Thu Nov 01 19:49:51 2018 +0100
     6.3 @@ -33,19 +33,21 @@
     6.4  // C4503: 'function' : decorated name length exceeded, name was truncated
     6.5  // C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)
     6.6  // C4996: 'function': was declared deprecated
     6.7 +
     6.8 +#include <lemon/config.h>
     6.9 +
    6.10  #ifdef _MSC_VER
    6.11  #pragma warning( disable : 4250 4267 4355 4503 4800 4996 )
    6.12  #endif
    6.13  
    6.14 -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
    6.15 -// Needed by the [DI]GRAPH_TYPEDEFS marcos for gcc 4.8
    6.16 +#if LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS
    6.17 +// Needed by the [DI]GRAPH_TYPEDEFS marcos for gcc >=4.8 and clang
    6.18  #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
    6.19  #endif
    6.20  
    6.21  #include <vector>
    6.22  #include <algorithm>
    6.23  
    6.24 -#include <lemon/config.h>
    6.25  #include <lemon/bits/enable_if.h>
    6.26  #include <lemon/bits/traits.h>
    6.27  #include <lemon/assert.h>
     7.1 --- a/lemon/dfs.h	Wed Oct 17 22:56:43 2018 +0200
     7.2 +++ b/lemon/dfs.h	Thu Nov 01 19:49:51 2018 +0100
     7.3 @@ -1318,7 +1318,7 @@
     7.4      template <class T>
     7.5      struct SetReachedMapTraits : public Traits {
     7.6        typedef T ReachedMap;
     7.7 -      static ReachedMap *createReachedMap(const Digraph &digraph) {
     7.8 +      static ReachedMap *createReachedMap(const Digraph &) {
     7.9          LEMON_ASSERT(false, "ReachedMap is not initialized");
    7.10          return 0; // ignore warnings
    7.11        }
     8.1 --- a/lemon/nagamochi_ibaraki.h	Wed Oct 17 22:56:43 2018 +0200
     8.2 +++ b/lemon/nagamochi_ibaraki.h	Thu Nov 01 19:49:51 2018 +0100
     8.3 @@ -174,7 +174,7 @@
     8.4      struct SetHeapTraits : public Traits {
     8.5        typedef CR HeapCrossRef;
     8.6        typedef H Heap;
     8.7 -      static HeapCrossRef *createHeapCrossRef(int num) {
     8.8 +      static HeapCrossRef *createHeapCrossRef(int) {
     8.9          LEMON_ASSERT(false, "HeapCrossRef is not initialized");
    8.10          return 0; // ignore warnings
    8.11        }
     9.1 --- a/test/adaptors_test.cc	Wed Oct 17 22:56:43 2018 +0200
     9.2 +++ b/test/adaptors_test.cc	Thu Nov 01 19:49:51 2018 +0100
     9.3 @@ -145,12 +145,16 @@
     9.4  
     9.5    // Check the conversion of nodes and arcs
     9.6    Digraph::Node nd = n4;
     9.7 +  ::lemon::ignore_unused_variable_warning(nd);
     9.8    nd = n4;
     9.9    Adaptor::Node na = n1;
    9.10 +  ::lemon::ignore_unused_variable_warning(na);
    9.11    na = n2;
    9.12    Digraph::Arc ad = a4;
    9.13 +  ::lemon::ignore_unused_variable_warning(ad);
    9.14    ad = a5;
    9.15    Adaptor::Arc aa = a1;
    9.16 +  ::lemon::ignore_unused_variable_warning(aa);
    9.17    aa = a2;
    9.18  }
    9.19  
    9.20 @@ -269,12 +273,16 @@
    9.21  
    9.22    // Check the conversion of nodes and arcs
    9.23    Digraph::Node nd = n3;
    9.24 +  ::lemon::ignore_unused_variable_warning(nd);
    9.25    nd = n3;
    9.26    Adaptor::Node na = n1;
    9.27 +  ::lemon::ignore_unused_variable_warning(na);
    9.28    na = n2;
    9.29    Digraph::Arc ad = a3;
    9.30 +  ::lemon::ignore_unused_variable_warning(ad);
    9.31    ad = a3;
    9.32    Adaptor::Arc aa = a1;
    9.33 +  ::lemon::ignore_unused_variable_warning(aa);
    9.34    aa = a2;
    9.35  }
    9.36  
    9.37 @@ -365,12 +373,16 @@
    9.38  
    9.39    // Check the conversion of nodes and arcs
    9.40    Digraph::Node nd = n3;
    9.41 +  ::lemon::ignore_unused_variable_warning(nd);
    9.42    nd = n3;
    9.43    Adaptor::Node na = n1;
    9.44 +  ::lemon::ignore_unused_variable_warning(na);
    9.45    na = n2;
    9.46    Digraph::Arc ad = a3;
    9.47 +  ::lemon::ignore_unused_variable_warning(ad);
    9.48    ad = a3;
    9.49    Adaptor::Arc aa = a1;
    9.50 +  ::lemon::ignore_unused_variable_warning(aa);
    9.51    aa = a2;
    9.52  }
    9.53  
    9.54 @@ -463,12 +475,16 @@
    9.55  
    9.56    // Check the conversion of nodes and arcs
    9.57    Digraph::Node nd = n3;
    9.58 +  ::lemon::ignore_unused_variable_warning(nd);
    9.59    nd = n3;
    9.60    Adaptor::Node na = n1;
    9.61 +  ::lemon::ignore_unused_variable_warning(na);
    9.62    na = n2;
    9.63    Digraph::Arc ad = a3;
    9.64 +  ::lemon::ignore_unused_variable_warning(ad);
    9.65    ad = a3;
    9.66    Adaptor::Arc aa = a1;
    9.67 +  ::lemon::ignore_unused_variable_warning(aa);
    9.68    aa = a2;
    9.69  }
    9.70  
    9.71 @@ -574,12 +590,16 @@
    9.72  
    9.73    // Check the conversion of nodes and arcs/edges
    9.74    Digraph::Node nd = n3;
    9.75 +  ::lemon::ignore_unused_variable_warning(nd);
    9.76    nd = n3;
    9.77    Adaptor::Node na = n1;
    9.78 +  ::lemon::ignore_unused_variable_warning(na);
    9.79    na = n2;
    9.80    Digraph::Arc ad = e3;
    9.81 +  ::lemon::ignore_unused_variable_warning(ad);
    9.82    ad = e3;
    9.83    Adaptor::Edge ea = a1;
    9.84 +  ::lemon::ignore_unused_variable_warning(ea);
    9.85    ea = a2;
    9.86  }
    9.87  
    9.88 @@ -734,10 +754,13 @@
    9.89  
    9.90    // Check the conversion of nodes and arcs
    9.91    Digraph::Node nd = Adaptor::NodeIt(adaptor);
    9.92 +  ::lemon::ignore_unused_variable_warning(nd);
    9.93    nd = ++Adaptor::NodeIt(adaptor);
    9.94    Adaptor::Node na = n1;
    9.95 +  ::lemon::ignore_unused_variable_warning(na);
    9.96    na = n2;
    9.97    Digraph::Arc ad = Adaptor::ArcIt(adaptor);
    9.98 +  ::lemon::ignore_unused_variable_warning(ad);
    9.99    ad = ++Adaptor::ArcIt(adaptor);
   9.100  }
   9.101  
   9.102 @@ -987,12 +1010,16 @@
   9.103  
   9.104    // Check the conversion of nodes and edges
   9.105    Graph::Node ng = n3;
   9.106 +  ::lemon::ignore_unused_variable_warning(ng);
   9.107    ng = n4;
   9.108    Adaptor::Node na = n1;
   9.109 +  ::lemon::ignore_unused_variable_warning(na);
   9.110    na = n2;
   9.111    Graph::Edge eg = e3;
   9.112 +  ::lemon::ignore_unused_variable_warning(eg);
   9.113    eg = e4;
   9.114    Adaptor::Edge ea = e1;
   9.115 +  ::lemon::ignore_unused_variable_warning(ea);
   9.116    ea = e2;
   9.117  }
   9.118  
   9.119 @@ -1092,12 +1119,16 @@
   9.120  
   9.121    // Check the conversion of nodes and edges
   9.122    Graph::Node ng = n3;
   9.123 +  ::lemon::ignore_unused_variable_warning(ng);
   9.124    ng = n4;
   9.125    Adaptor::Node na = n1;
   9.126 +  ::lemon::ignore_unused_variable_warning(na);
   9.127    na = n2;
   9.128    Graph::Edge eg = e3;
   9.129 +  ::lemon::ignore_unused_variable_warning(eg);
   9.130    eg = e4;
   9.131    Adaptor::Edge ea = e1;
   9.132 +  ::lemon::ignore_unused_variable_warning(ea);
   9.133    ea = e2;
   9.134  }
   9.135  
   9.136 @@ -1198,12 +1229,16 @@
   9.137  
   9.138    // Check the conversion of nodes and edges
   9.139    Graph::Node ng = n3;
   9.140 +  ::lemon::ignore_unused_variable_warning(ng);
   9.141    ng = n4;
   9.142    Adaptor::Node na = n1;
   9.143 +  ::lemon::ignore_unused_variable_warning(na);
   9.144    na = n2;
   9.145    Graph::Edge eg = e3;
   9.146 +  ::lemon::ignore_unused_variable_warning(eg);
   9.147    eg = e4;
   9.148    Adaptor::Edge ea = e1;
   9.149 +  ::lemon::ignore_unused_variable_warning(ea);
   9.150    ea = e2;
   9.151  }
   9.152  
   9.153 @@ -1356,12 +1391,16 @@
   9.154  
   9.155    // Check the conversion of nodes and arcs/edges
   9.156    Graph::Node ng = n3;
   9.157 +  ::lemon::ignore_unused_variable_warning(ng);
   9.158    ng = n3;
   9.159    Adaptor::Node na = n1;
   9.160 +  ::lemon::ignore_unused_variable_warning(na);
   9.161    na = n2;
   9.162    Graph::Edge eg = e3;
   9.163 +  ::lemon::ignore_unused_variable_warning(eg);
   9.164    eg = e3;
   9.165    Adaptor::Arc aa = e1;
   9.166 +  ::lemon::ignore_unused_variable_warning(aa);
   9.167    aa = e2;
   9.168  }
   9.169