[Lemon-commits] Alpar Juttner: Merge #615 to branch 1.3
Lemon HG
hg at lemon.cs.elte.hu
Mon Nov 5 17:50:24 CET 2018
details: http://lemon.cs.elte.hu/hg/lemon/rev/332eab7995fe
changeset: 1422:332eab7995fe
user: Alpar Juttner <alpar [at] cs.elte.hu>
date: Thu Nov 01 19:49:08 2018 +0100
description:
Merge #615 to branch 1.3
diffstat:
CMakeLists.txt | 15 ++++++++++++++-
lemon/bfs.h | 2 +-
lemon/concepts/graph_components.h | 3 +++
lemon/concepts/path.h | 4 +++-
lemon/config.h.in | 3 +++
lemon/core.h | 8 +++++---
lemon/dfs.h | 2 +-
lemon/nagamochi_ibaraki.h | 2 +-
test/adaptors_test.cc | 39 +++++++++++++++++++++++++++++++++++++++
9 files changed, 70 insertions(+), 8 deletions(-)
diffs (truncated from 325 to 300 lines):
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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 --git a/lemon/bfs.h b/lemon/bfs.h
--- a/lemon/bfs.h
+++ b/lemon/bfs.h
@@ -1376,7 +1376,7 @@
template <class T>
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 --git a/lemon/concepts/graph_components.h b/lemon/concepts/graph_components.h
--- a/lemon/concepts/graph_components.h
+++ b/lemon/concepts/graph_components.h
@@ -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 --git a/lemon/concepts/path.h b/lemon/concepts/path.h
--- a/lemon/concepts/path.h
+++ b/lemon/concepts/path.h
@@ -70,7 +70,9 @@
/// \brief Template copy constructor
template <typename CPath>
- Path(const CPath& cpath) {}
+ Path(const CPath& cpath) {
+ ::lemon::ignore_unused_variable_warning(cpath);
+ }
/// \brief Template assigment operator
template <typename CPath>
diff --git a/lemon/config.h.in b/lemon/config.h.in
--- a/lemon/config.h.in
+++ b/lemon/config.h.in
@@ -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 --git a/lemon/core.h b/lemon/core.h
--- a/lemon/core.h
+++ b/lemon/core.h
@@ -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 <lemon/config.h>
+
#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 <vector>
#include <algorithm>
-#include <lemon/config.h>
#include <lemon/bits/enable_if.h>
#include <lemon/bits/traits.h>
#include <lemon/assert.h>
diff --git a/lemon/dfs.h b/lemon/dfs.h
--- a/lemon/dfs.h
+++ b/lemon/dfs.h
@@ -1318,7 +1318,7 @@
template <class T>
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 --git a/lemon/nagamochi_ibaraki.h b/lemon/nagamochi_ibaraki.h
--- a/lemon/nagamochi_ibaraki.h
+++ b/lemon/nagamochi_ibaraki.h
@@ -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 --git a/test/adaptors_test.cc b/test/adaptors_test.cc
--- a/test/adaptors_test.cc
+++ b/test/adaptors_test.cc
@@ -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;
More information about the Lemon-commits
mailing list