[Lemon-commits] Alpar Juttner: Merge CPLEX 12.6 support

Lemon HG hg at lemon.cs.elte.hu
Thu Apr 2 14:10:19 CEST 2015


details:   http://lemon.cs.elte.hu/hg/lemon/rev/27d7d232fbcc
changeset: 1333:27d7d232fbcc
user:      Alpar Juttner <alpar [at] cs.elte.hu>
date:      Thu Apr 02 14:09:21 2015 +0200
description:
	Merge CPLEX 12.6 support

diffstat:

 CMakeLists.txt       |   8 ++++++--
 cmake/FindILOG.cmake |   4 ++++
 lemon/arg_parser.h   |   1 +
 lemon/core.h         |  11 +++--------
 lemon/counter.h      |   2 ++
 lemon/elevator.h     |   6 +++---
 lemon/radix_sort.h   |   2 +-
 lemon/random.h       |   4 ++--
 lemon/static_graph.h |   2 +-
 9 files changed, 23 insertions(+), 17 deletions(-)

diffs (171 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -150,10 +150,13 @@
     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 keep it as an example.
-    SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
+    # Still kept as an example.
+
+    # SET(CXX_WARNING "/wd4250 /wd4267 /wd4355 /wd4503 /wd4800 /wd4996")
+
     # Suppressed warnings:
     # C4250: 'class1' : inherits 'class2::member' via dominance
+    # C4267: conversion from 'size_t' to 'type', possible loss of data
     # C4355: 'this' : used in base member initializer list
     # C4503: 'function' : decorated name length exceeded, name was truncated
     # C4800: 'type' : forcing value to bool 'true' or 'false'
@@ -168,6 +171,7 @@
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
 
 IF(MSVC)
+  SET(CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}")
   SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
     "Flags used by the C++ compiler during maintainer builds."
     )
diff --git a/cmake/FindILOG.cmake b/cmake/FindILOG.cmake
--- a/cmake/FindILOG.cmake
+++ b/cmake/FindILOG.cmake
@@ -62,6 +62,8 @@
   ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_sles10_4.1/static_pic
   ${ILOG_CPLEX_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
   ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
+  ${ILOG_CPLEX_ROOT_DIR}/lib/x86_linux/static_pic
+  ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_linux/static_pic
   ${ILOG_CPLEX_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
   NO_DEFAULT_PATH
   )
@@ -72,6 +74,8 @@
   ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_sles10_4.1/static_pic
   ${ILOG_CONCERT_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
   ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
+  ${ILOG_CONCERT_ROOT_DIR}/lib/x86_linux/static_pic
+  ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_linux/static_pic
   ${ILOG_CONCERT_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
   NO_DEFAULT_PATH
   )
diff --git a/lemon/arg_parser.h b/lemon/arg_parser.h
--- a/lemon/arg_parser.h
+++ b/lemon/arg_parser.h
@@ -26,6 +26,7 @@
 #include <iostream>
 #include <sstream>
 #include <algorithm>
+#include <lemon/core.h>
 #include <lemon/assert.h>
 
 ///\ingroup misc
diff --git a/lemon/core.h b/lemon/core.h
--- a/lemon/core.h
+++ b/lemon/core.h
@@ -29,21 +29,16 @@
 
 // Disable the following warnings when compiling with MSVC:
 // C4250: 'class1' : inherits 'class2::member' via dominance
+// C4267: conversion from 'size_t' to 'type', possible loss of data
 // C4355: 'this' : used in base member initializer list
 // 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
 #ifdef _MSC_VER
-#pragma warning( disable : 4250 4355 4503 4800 4996 )
+#pragma warning( disable : 4250 4267 4355 4503 4800 4996 )
 #endif
 
-#ifdef __GNUC__
-#define GCC_VERSION (__GNUC__ * 10000                   \
-                     + __GNUC_MINOR__ * 100             \
-                     + __GNUC_PATCHLEVEL__)
-#endif
-
-#if GCC_VERSION >= 40800
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
 // Needed by the [DI]GRAPH_TYPEDEFS marcos for gcc 4.8
 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
 #endif
diff --git a/lemon/counter.h b/lemon/counter.h
--- a/lemon/counter.h
+++ b/lemon/counter.h
@@ -22,6 +22,8 @@
 #include <string>
 #include <iostream>
 
+#include <lemon/core.h>
+
 ///\ingroup timecount
 ///\file
 ///\brief Tools for counting steps and events
diff --git a/lemon/elevator.h b/lemon/elevator.h
--- a/lemon/elevator.h
+++ b/lemon/elevator.h
@@ -167,7 +167,7 @@
     ///Return the number of items on level \c l.
     int onLevel(int l) const
     {
-      return _first[l+1]-_first[l];
+      return static_cast<int>(_first[l+1]-_first[l]);
     }
     ///Return true if level \c l is empty.
     bool emptyLevel(int l) const
@@ -177,12 +177,12 @@
     ///Return the number of items above level \c l.
     int aboveLevel(int l) const
     {
-      return _first[_max_level+1]-_first[l+1];
+      return static_cast<int>(_first[_max_level+1]-_first[l+1]);
     }
     ///Return the number of active items on level \c l.
     int activesOnLevel(int l) const
     {
-      return _last_active[l]-_first[l]+1;
+      return static_cast<int>(_last_active[l]-_first[l]+1);
     }
     ///Return true if there is no active item on level \c l.
     bool activeFree(int l) const
diff --git a/lemon/radix_sort.h b/lemon/radix_sort.h
--- a/lemon/radix_sort.h
+++ b/lemon/radix_sort.h
@@ -328,7 +328,7 @@
       typedef std::allocator<Key> Allocator;
       Allocator allocator;
 
-      int length = std::distance(first, last);
+      int length = static_cast<int>(std::distance(first, last));
       Key* buffer = allocator.allocate(2 * length);
       try {
         bool dir = true;
diff --git a/lemon/random.h b/lemon/random.h
--- a/lemon/random.h
+++ b/lemon/random.h
@@ -199,7 +199,7 @@
 
         initState(init);
 
-        num = length > end - begin ? length : end - begin;
+        num = static_cast<int>(length > end - begin ? length : end - begin);
         while (num--) {
           curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul1))
             + *it + cnt;
@@ -213,7 +213,7 @@
           --curr;
         }
 
-        num = length - 1; cnt = length - (curr - state) - 1;
+        num = length - 1; cnt = static_cast<int>(length - (curr - state) - 1);
         while (num--) {
           curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul2))
             - cnt;
diff --git a/lemon/static_graph.h b/lemon/static_graph.h
--- a/lemon/static_graph.h
+++ b/lemon/static_graph.h
@@ -203,7 +203,7 @@
       built = true;
 
       node_num = n;
-      arc_num = std::distance(first, last);
+      arc_num = static_cast<int>(std::distance(first, last));
 
       node_first_out = new int[node_num + 1];
       node_first_in = new int[node_num];


More information about the Lemon-commits mailing list