[Lemon-commits] Alpar Juttner: Merge bugfix #595 to branch 1.3

Lemon HG hg at lemon.cs.elte.hu
Tue Apr 28 18:14:01 CEST 2015


details:   http://lemon.cs.elte.hu/hg/lemon/rev/5c247b4dc708
changeset: 1342:5c247b4dc708
user:      Alpar Juttner <alpar [at] cs.elte.hu>
date:      Tue Apr 28 18:12:39 2015 +0200
description:
	Merge bugfix #595 to branch 1.3

diffstat:

 CMakeLists.txt          |   4 ++++
 lemon/bits/windows.cc   |  24 ++++++++++++++----------
 lemon/bits/windows.h    |   3 ++-
 lemon/config.h.in       |  21 ++++++++++++++-------
 lemon/core.h            |  28 +++++++++++++++-------------
 lemon/graph_to_eps.h    |   4 ++--
 lemon/lp.h              |  32 ++++++++++++++++----------------
 lemon/random.h          |  10 ++++++----
 lemon/time_measure.h    |   6 ++++--
 test/radix_sort_test.cc |   2 ++
 10 files changed, 79 insertions(+), 55 deletions(-)

diffs (truncated from 392 to 300 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,6 +66,10 @@
 FIND_PACKAGE(Doxygen)
 FIND_PACKAGE(Ghostscript)
 
+IF(WIN32)
+  SET(LEMON_WIN32 TRUE)
+ENDIF(WIN32)
+
 SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.")
 SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.")
 SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.")
diff --git a/lemon/bits/windows.cc b/lemon/bits/windows.cc
--- a/lemon/bits/windows.cc
+++ b/lemon/bits/windows.cc
@@ -21,7 +21,11 @@
 
 #include<lemon/bits/windows.h>
 
-#ifdef WIN32
+#if defined(LEMON_WIN32) && defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+#endif
+
+#ifdef LEMON_WIN32
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
 #endif
@@ -40,7 +44,7 @@
 #else
 #include <unistd.h>
 #include <ctime>
-#ifndef WIN32
+#ifndef LEMON_WIN32
 #include <sys/times.h>
 #endif
 #include <sys/time.h>
@@ -55,7 +59,7 @@
                          double &utime, double &stime,
                          double &cutime, double &cstime)
     {
-#ifdef WIN32
+#ifdef LEMON_WIN32
       static const double ch = 4294967296.0e-7;
       static const double cl = 1.0e-7;
 
@@ -94,11 +98,11 @@
     std::string getWinFormattedDate()
     {
       std::ostringstream os;
-#ifdef WIN32
+#ifdef LEMON_WIN32
       SYSTEMTIME time;
       GetSystemTime(&time);
       char buf1[11], buf2[9], buf3[5];
-          if (GetDateFormat(MY_LOCALE, 0, &time,
+      if (GetDateFormat(MY_LOCALE, 0, &time,
                         ("ddd MMM dd"), buf1, 11) &&
           GetTimeFormat(MY_LOCALE, 0, &time,
                         ("HH':'mm':'ss"), buf2, 9) &&
@@ -120,7 +124,7 @@
 
     int getWinRndSeed()
     {
-#ifdef WIN32
+#ifdef LEMON_WIN32
       FILETIME time;
       GetSystemTimeAsFileTime(&time);
       return GetCurrentProcessId() + time.dwHighDateTime + time.dwLowDateTime;
@@ -132,7 +136,7 @@
     }
 
     WinLock::WinLock() {
-#ifdef WIN32
+#ifdef LEMON_WIN32
       CRITICAL_SECTION *lock = new CRITICAL_SECTION;
       InitializeCriticalSection(lock);
       _repr = lock;
@@ -142,7 +146,7 @@
     }
 
     WinLock::~WinLock() {
-#ifdef WIN32
+#ifdef LEMON_WIN32
       CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
       DeleteCriticalSection(lock);
       delete lock;
@@ -150,14 +154,14 @@
     }
 
     void WinLock::lock() {
-#ifdef WIN32
+#ifdef LEMON_WIN32
       CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
       EnterCriticalSection(lock);
 #endif
     }
 
     void WinLock::unlock() {
-#ifdef WIN32
+#ifdef LEMON_WIN32
       CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
       LeaveCriticalSection(lock);
 #endif
diff --git a/lemon/bits/windows.h b/lemon/bits/windows.h
--- a/lemon/bits/windows.h
+++ b/lemon/bits/windows.h
@@ -19,6 +19,7 @@
 #ifndef LEMON_BITS_WINDOWS_H
 #define LEMON_BITS_WINDOWS_H
 
+#include <lemon/config.h>
 #include <string>
 
 namespace lemon {
@@ -34,7 +35,7 @@
       WinLock();
       ~WinLock();
       void lock();
-      void unlock();
+      void unlock();\
     private:
       void *_repr;
     };
diff --git a/lemon/config.h.in b/lemon/config.h.in
--- a/lemon/config.h.in
+++ b/lemon/config.h.in
@@ -1,6 +1,11 @@
+#ifndef LEMON_CONFIG_H
+#define LEMON_CONFIG_H
+
 #define LEMON_VERSION "@PROJECT_VERSION@"
 #cmakedefine LEMON_HAVE_LONG_LONG 1
 
+#cmakedefine LEMON_WIN32 1
+
 #cmakedefine LEMON_HAVE_LP 1
 #cmakedefine LEMON_HAVE_MIP 1
 #cmakedefine LEMON_HAVE_GLPK 1
@@ -9,14 +14,16 @@
 #cmakedefine LEMON_HAVE_CLP 1
 #cmakedefine LEMON_HAVE_CBC 1
 
-#define _LEMON_CPLEX 1
-#define _LEMON_CLP 2
-#define _LEMON_GLPK 3
-#define _LEMON_SOPLEX 4
-#define _LEMON_CBC 5
+#define LEMON_CPLEX_ 1
+#define LEMON_CLP_ 2
+#define LEMON_GLPK_ 3
+#define LEMON_SOPLEX_ 4
+#define LEMON_CBC_ 5
 
-#cmakedefine LEMON_DEFAULT_LP _LEMON_ at LEMON_DEFAULT_LP@
-#cmakedefine LEMON_DEFAULT_MIP _LEMON_ at LEMON_DEFAULT_MIP@
+#cmakedefine LEMON_DEFAULT_LP LEMON_ at LEMON_DEFAULT_LP@_
+#cmakedefine LEMON_DEFAULT_MIP LEMON_ at LEMON_DEFAULT_MIP@_
 
 #cmakedefine LEMON_USE_PTHREAD 1
 #cmakedefine LEMON_USE_WIN32_THREADS 1
+
+#endif
diff --git a/lemon/core.h b/lemon/core.h
--- a/lemon/core.h
+++ b/lemon/core.h
@@ -19,13 +19,12 @@
 #ifndef LEMON_CORE_H
 #define LEMON_CORE_H
 
-#include <vector>
-#include <algorithm>
-
-#include <lemon/config.h>
-#include <lemon/bits/enable_if.h>
-#include <lemon/bits/traits.h>
-#include <lemon/assert.h>
+///\file
+///\brief LEMON core utilities.
+///
+///This header file contains core utilities for LEMON.
+///It is automatically included by all graph types, therefore it usually
+///do not have to be included directly.
 
 // Disable the following warnings when compiling with MSVC:
 // C4250: 'class1' : inherits 'class2::member' via dominance
@@ -43,12 +42,15 @@
 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
 #endif
 
-///\file
-///\brief LEMON core utilities.
-///
-///This header file contains core utilities for LEMON.
-///It is automatically included by all graph types, therefore it usually
-///do not have to be included directly.
+#include <vector>
+#include <algorithm>
+
+#include <lemon/config.h>
+#include <lemon/bits/enable_if.h>
+#include <lemon/bits/traits.h>
+#include <lemon/assert.h>
+
+
 
 namespace lemon {
 
diff --git a/lemon/graph_to_eps.h b/lemon/graph_to_eps.h
--- a/lemon/graph_to_eps.h
+++ b/lemon/graph_to_eps.h
@@ -25,7 +25,7 @@
 #include<algorithm>
 #include<vector>
 
-#ifndef WIN32
+#ifndef LEMON_WIN32
 #include<sys/time.h>
 #include<ctime>
 #else
@@ -674,7 +674,7 @@
 
     {
       os << "%%CreationDate: ";
-#ifndef WIN32
+#ifndef LEMON_WIN32
       timeval tv;
       gettimeofday(&tv, 0);
 
diff --git a/lemon/lp.h b/lemon/lp.h
--- a/lemon/lp.h
+++ b/lemon/lp.h
@@ -22,19 +22,19 @@
 #include<lemon/config.h>
 
 
-#if LEMON_DEFAULT_LP == _LEMON_GLPK || LEMON_DEFAULT_MIP == _LEMON_GLPK
+#if LEMON_DEFAULT_LP == LEMON_GLPK_ || LEMON_DEFAULT_MIP == LEMON_GLPK_
 #include <lemon/glpk.h>
 #endif
-#if LEMON_DEFAULT_LP == _LEMON_CPLEX || LEMON_DEFAULT_MIP == _LEMON_CPLEX 
+#if LEMON_DEFAULT_LP == LEMON_CPLEX_ || LEMON_DEFAULT_MIP == LEMON_CPLEX_
 #include <lemon/cplex.h>
 #endif
-#if LEMON_DEFAULT_LP == _LEMON_SOPLEX
+#if LEMON_DEFAULT_LP == LEMON_SOPLEX_
 #include <lemon/soplex.h>
 #endif
-#if LEMON_DEFAULT_LP == _LEMON_CLP
+#if LEMON_DEFAULT_LP == LEMON_CLP_
 #include <lemon/clp.h>
 #endif
-#if LEMON_DEFAULT_MIP == _LEMON_CBC
+#if LEMON_DEFAULT_MIP == LEMON_CBC_
 #include <lemon/cbc.h>
 #endif
 
@@ -49,8 +49,8 @@
   ///The default LP solver identifier.
   ///\ingroup lp_group
   ///
-  ///Currently, the possible values are \c _LEMON_GLPK, \c LEMON__CPLEX,
-  ///\c _LEMON_SOPLEX or \c LEMON__CLP
+  ///Currently, the possible values are \c LEMON_GLPK_, \c LEMON_CPLEX_,
+  ///\c LEMON_SOPLEX_ or \c LEMON_CLP_
 #define LEMON_DEFAULT_LP SOLVER
   ///The default LP solver
 
@@ -65,8 +65,8 @@
   ///The default MIP solver identifier.
   ///\ingroup lp_group
   ///
-  ///Currently, the possible values are \c _LEMON_GLPK, \c LEMON__CPLEX
-  ///or \c _LEMON_CBC
+  ///Currently, the possible values are \c LEMON_GLPK_, \c LEMON_CPLEX_
+  ///or \c LEMON_CBC_
 #define LEMON_DEFAULT_MIP SOLVER
   ///The default MIP solver.
 
@@ -76,20 +76,20 @@
   ///Currently, it is either \c GlpkMip, \c CplexMip , \c CbcMip
   typedef GlpkMip Mip;
 #else
-#if LEMON_DEFAULT_LP == _LEMON_GLPK
+#if LEMON_DEFAULT_LP == LEMON_GLPK_
   typedef GlpkLp Lp;
-#elif LEMON_DEFAULT_LP == _LEMON_CPLEX
+#elif LEMON_DEFAULT_LP == LEMON_CPLEX_
   typedef CplexLp Lp;
-#elif LEMON_DEFAULT_LP == _LEMON_SOPLEX
+#elif LEMON_DEFAULT_LP == LEMON_SOPLEX_
   typedef SoplexLp Lp;
-#elif LEMON_DEFAULT_LP == _LEMON_CLP
+#elif LEMON_DEFAULT_LP == LEMON_CLP_
   typedef ClpLp Lp;
 #endif
-#if LEMON_DEFAULT_MIP == _LEMON_GLPK
+#if LEMON_DEFAULT_MIP == LEMON_GLPK_


More information about the Lemon-commits mailing list