COIN-OR::LEMON - Graph Library

Ticket #615: 9fb966ffce37.patch

File 9fb966ffce37.patch, 9.7 KB (added by Alpar Juttner, 6 years ago)
  • CMakeLists.txt

    # HG changeset patch
    # User Alpar Juttner <alpar@cs.elte.hu>
    # Date 1540981897 -3600
    #      Wed Oct 31 11:31:37 2018 +0100
    # Node ID 9fb966ffce373f2456aa46a0be16f42d2621fdec
    # Parent  3c00344f49c951d5076dd2c4b7a2389603aba66c
    Suppress unused typef warnings (#615)
    
    diff --git a/CMakeLists.txt b/CMakeLists.txt
    a b  
    148148    "Default MIP solver backend (GLPK, CPLEX or CBC)")
    149149ENDIF()
    150150
     151IF( ( ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND
     152      ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER_EQUAL "4.8") )
     153    OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
     154    OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
     155    )
     156  SET(LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS TRUE)
     157ENDIF()
    151158
    152159IF(DEFINED ENV{LEMON_CXX_WARNING})
    153160  SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
    154161ELSE()
    155   IF(CMAKE_COMPILER_IS_GNUCXX)
     162  IF( ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
     163      OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
     164      )
    156165    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")
    157166    SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
    158167    SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
     168  ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
     169    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")
     170    SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
     171    SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
    159172  ELSEIF(MSVC)
    160173    # This part is unnecessary 'casue the same is set by the lemon/core.h.
    161174    # Still kept as an example.
  • lemon/bfs.h

    diff --git a/lemon/bfs.h b/lemon/bfs.h
    a b  
    13771377    struct SetReachedMapTraits : public Traits {
    13781378      typedef T ReachedMap;
    13791379      static ReachedMap *createReachedMap(const Digraph &digraph) {
     1380        ::lemon::ignore_unused_variable_warning(digraph);
    13801381        LEMON_ASSERT(false, "ReachedMap is not initialized");
    13811382        return 0; // ignore warnings
    13821383      }
  • lemon/concepts/graph_components.h

    diff --git a/lemon/concepts/graph_components.h b/lemon/concepts/graph_components.h
    a b  
    103103          _GraphItem i1;
    104104          i1=INVALID;
    105105          _GraphItem i2 = i1;
     106          ::lemon::ignore_unused_variable_warning(i2);
    106107          _GraphItem i3 = INVALID;
    107108
    108109          i1 = i2 = i3;
     
    734735          ++(++it1);
    735736
    736737          Item bi = it1;
     738          ::lemon::ignore_unused_variable_warning(bi);
    737739          bi = it2;
    738740        }
    739741        const GR& g;
     
    824826          ++it2 = it1;
    825827          ++(++it1);
    826828          Item e = it1;
     829          ::lemon::ignore_unused_variable_warning(e);
    827830          e = it2;
    828831        }
    829832        const Base& node;
  • lemon/concepts/path.h

    diff --git a/lemon/concepts/path.h b/lemon/concepts/path.h
    a b  
    7070
    7171      /// \brief Template copy constructor
    7272      template <typename CPath>
    73       Path(const CPath& cpath) {}
     73      Path(const CPath& cpath) {
     74        ::lemon::ignore_unused_variable_warning(cpath);
     75      }
    7476
    7577      /// \brief Template assigment operator
    7678      template <typename CPath>
  • lemon/config.h.in

    diff --git a/lemon/config.h.in b/lemon/config.h.in
    a b  
    22#define LEMON_CONFIG_H
    33
    44#define LEMON_VERSION "@PROJECT_VERSION@"
     5
    56#cmakedefine LEMON_HAVE_LONG_LONG 1
    67
    78#cmakedefine LEMON_WIN32 1
     
    2627#cmakedefine LEMON_USE_PTHREAD 1
    2728#cmakedefine LEMON_USE_WIN32_THREADS 1
    2829
     30#cmakedefine LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS 1
     31
    2932#endif
  • lemon/core.h

    diff --git a/lemon/core.h b/lemon/core.h
    a b  
    3333// C4503: 'function' : decorated name length exceeded, name was truncated
    3434// C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)
    3535// C4996: 'function': was declared deprecated
     36
     37#include <lemon/config.h>
     38
    3639#ifdef _MSC_VER
    3740#pragma warning( disable : 4250 4267 4355 4503 4800 4996 )
    3841#endif
    3942
    40 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
    41 // Needed by the [DI]GRAPH_TYPEDEFS marcos for gcc 4.8
     43#if LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS
     44// Needed by the [DI]GRAPH_TYPEDEFS marcos for gcc >=4.8 and clang
    4245#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
    4346#endif
    4447
    4548#include <vector>
    4649#include <algorithm>
    4750
    48 #include <lemon/config.h>
    4951#include <lemon/bits/enable_if.h>
    5052#include <lemon/bits/traits.h>
    5153#include <lemon/assert.h>
  • lemon/dfs.h

    diff --git a/lemon/dfs.h b/lemon/dfs.h
    a b  
    13191319    struct SetReachedMapTraits : public Traits {
    13201320      typedef T ReachedMap;
    13211321      static ReachedMap *createReachedMap(const Digraph &digraph) {
     1322        ::lemon::ignore_unused_variable_warning(digraph);
    13221323        LEMON_ASSERT(false, "ReachedMap is not initialized");
    13231324        return 0; // ignore warnings
    13241325      }
  • lemon/nagamochi_ibaraki.h

    diff --git a/lemon/nagamochi_ibaraki.h b/lemon/nagamochi_ibaraki.h
    a b  
    175175      typedef CR HeapCrossRef;
    176176      typedef H Heap;
    177177      static HeapCrossRef *createHeapCrossRef(int num) {
     178        ::lemon::ignore_unused_variable_warning(num);
    178179        LEMON_ASSERT(false, "HeapCrossRef is not initialized");
    179180        return 0; // ignore warnings
    180181      }
  • test/adaptors_test.cc

    diff --git a/test/adaptors_test.cc b/test/adaptors_test.cc
    a b  
    145145
    146146  // Check the conversion of nodes and arcs
    147147  Digraph::Node nd = n4;
     148  ::lemon::ignore_unused_variable_warning(nd);
    148149  nd = n4;
    149150  Adaptor::Node na = n1;
     151  ::lemon::ignore_unused_variable_warning(na);
    150152  na = n2;
    151153  Digraph::Arc ad = a4;
     154  ::lemon::ignore_unused_variable_warning(ad);
    152155  ad = a5;
    153156  Adaptor::Arc aa = a1;
     157  ::lemon::ignore_unused_variable_warning(aa);
    154158  aa = a2;
    155159}
    156160
     
    269273
    270274  // Check the conversion of nodes and arcs
    271275  Digraph::Node nd = n3;
     276  ::lemon::ignore_unused_variable_warning(nd);
    272277  nd = n3;
    273278  Adaptor::Node na = n1;
     279  ::lemon::ignore_unused_variable_warning(na);
    274280  na = n2;
    275281  Digraph::Arc ad = a3;
     282  ::lemon::ignore_unused_variable_warning(ad);
    276283  ad = a3;
    277284  Adaptor::Arc aa = a1;
     285  ::lemon::ignore_unused_variable_warning(aa);
    278286  aa = a2;
    279287}
    280288
     
    365373
    366374  // Check the conversion of nodes and arcs
    367375  Digraph::Node nd = n3;
     376  ::lemon::ignore_unused_variable_warning(nd);
    368377  nd = n3;
    369378  Adaptor::Node na = n1;
     379  ::lemon::ignore_unused_variable_warning(na);
    370380  na = n2;
    371381  Digraph::Arc ad = a3;
     382  ::lemon::ignore_unused_variable_warning(ad);
    372383  ad = a3;
    373384  Adaptor::Arc aa = a1;
     385  ::lemon::ignore_unused_variable_warning(aa);
    374386  aa = a2;
    375387}
    376388
     
    463475
    464476  // Check the conversion of nodes and arcs
    465477  Digraph::Node nd = n3;
     478  ::lemon::ignore_unused_variable_warning(nd);
    466479  nd = n3;
    467480  Adaptor::Node na = n1;
     481  ::lemon::ignore_unused_variable_warning(na);
    468482  na = n2;
    469483  Digraph::Arc ad = a3;
     484  ::lemon::ignore_unused_variable_warning(ad);
    470485  ad = a3;
    471486  Adaptor::Arc aa = a1;
     487  ::lemon::ignore_unused_variable_warning(aa);
    472488  aa = a2;
    473489}
    474490
     
    574590
    575591  // Check the conversion of nodes and arcs/edges
    576592  Digraph::Node nd = n3;
     593  ::lemon::ignore_unused_variable_warning(nd);
    577594  nd = n3;
    578595  Adaptor::Node na = n1;
     596  ::lemon::ignore_unused_variable_warning(na);
    579597  na = n2;
    580598  Digraph::Arc ad = e3;
     599  ::lemon::ignore_unused_variable_warning(ad);
    581600  ad = e3;
    582601  Adaptor::Edge ea = a1;
     602  ::lemon::ignore_unused_variable_warning(ea);
    583603  ea = a2;
    584604}
    585605
     
    734754
    735755  // Check the conversion of nodes and arcs
    736756  Digraph::Node nd = Adaptor::NodeIt(adaptor);
     757  ::lemon::ignore_unused_variable_warning(nd);
    737758  nd = ++Adaptor::NodeIt(adaptor);
    738759  Adaptor::Node na = n1;
     760  ::lemon::ignore_unused_variable_warning(na);
    739761  na = n2;
    740762  Digraph::Arc ad = Adaptor::ArcIt(adaptor);
     763  ::lemon::ignore_unused_variable_warning(ad);
    741764  ad = ++Adaptor::ArcIt(adaptor);
    742765}
    743766
     
    9871010
    9881011  // Check the conversion of nodes and edges
    9891012  Graph::Node ng = n3;
     1013  ::lemon::ignore_unused_variable_warning(ng);
    9901014  ng = n4;
    9911015  Adaptor::Node na = n1;
     1016  ::lemon::ignore_unused_variable_warning(na);
    9921017  na = n2;
    9931018  Graph::Edge eg = e3;
     1019  ::lemon::ignore_unused_variable_warning(eg);
    9941020  eg = e4;
    9951021  Adaptor::Edge ea = e1;
     1022  ::lemon::ignore_unused_variable_warning(ea);
    9961023  ea = e2;
    9971024}
    9981025
     
    10921119
    10931120  // Check the conversion of nodes and edges
    10941121  Graph::Node ng = n3;
     1122  ::lemon::ignore_unused_variable_warning(ng);
    10951123  ng = n4;
    10961124  Adaptor::Node na = n1;
     1125  ::lemon::ignore_unused_variable_warning(na);
    10971126  na = n2;
    10981127  Graph::Edge eg = e3;
     1128  ::lemon::ignore_unused_variable_warning(eg);
    10991129  eg = e4;
    11001130  Adaptor::Edge ea = e1;
     1131  ::lemon::ignore_unused_variable_warning(ea);
    11011132  ea = e2;
    11021133}
    11031134
     
    11981229
    11991230  // Check the conversion of nodes and edges
    12001231  Graph::Node ng = n3;
     1232  ::lemon::ignore_unused_variable_warning(ng);
    12011233  ng = n4;
    12021234  Adaptor::Node na = n1;
     1235  ::lemon::ignore_unused_variable_warning(na);
    12031236  na = n2;
    12041237  Graph::Edge eg = e3;
     1238  ::lemon::ignore_unused_variable_warning(eg);
    12051239  eg = e4;
    12061240  Adaptor::Edge ea = e1;
     1241  ::lemon::ignore_unused_variable_warning(ea);
    12071242  ea = e2;
    12081243}
    12091244
     
    13561391
    13571392  // Check the conversion of nodes and arcs/edges
    13581393  Graph::Node ng = n3;
     1394  ::lemon::ignore_unused_variable_warning(ng);
    13591395  ng = n3;
    13601396  Adaptor::Node na = n1;
     1397  ::lemon::ignore_unused_variable_warning(na);
    13611398  na = n2;
    13621399  Graph::Edge eg = e3;
     1400  ::lemon::ignore_unused_variable_warning(eg);
    13631401  eg = e3;
    13641402  Adaptor::Arc aa = e1;
     1403  ::lemon::ignore_unused_variable_warning(aa);
    13651404  aa = e2;
    13661405}
    13671406