|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63878 - in sandbox/chrono/libs/chrono: src src/mac src/posix src/win test
From: vicente.botet_at_[hidden]
Date: 2010-07-11 11:34:52
Author: viboes
Date: 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
New Revision: 63878
URL: http://svn.boost.org/trac/boost/changeset/63878
Log:
* Take care of Boost.System break on version 1.44
* Fix "warning C4700: uninitialized local variable 'res' used"
Text files modified:
sandbox/chrono/libs/chrono/src/chrono.cpp | 1 +
sandbox/chrono/libs/chrono/src/mac/chrono.cpp | 16 ++++++++++++++++
sandbox/chrono/libs/chrono/src/mac/process_clock.cpp | 11 ++++++++++-
sandbox/chrono/libs/chrono/src/posix/chrono.cpp | 16 ++++++++++++++++
sandbox/chrono/libs/chrono/src/posix/process_clock.cpp | 8 ++++++++
sandbox/chrono/libs/chrono/src/posix/thread_clock.cpp | 8 ++++++++
sandbox/chrono/libs/chrono/src/process_clock.cpp | 1 +
sandbox/chrono/libs/chrono/src/process_cpu_clocks.cpp | 1 +
sandbox/chrono/libs/chrono/src/run_timer.cpp | 5 +++++
sandbox/chrono/libs/chrono/src/run_timer_static.cpp | 1 +
sandbox/chrono/libs/chrono/src/thread_clock.cpp | 1 +
sandbox/chrono/libs/chrono/src/win/chrono.cpp | 8 ++++++++
sandbox/chrono/libs/chrono/src/win/process_clock.cpp | 4 ++++
sandbox/chrono/libs/chrono/src/win/thread_clock.cpp | 8 ++++++++
sandbox/chrono/libs/chrono/test/run_timer_test.cpp | 2 +-
15 files changed, 89 insertions(+), 2 deletions(-)
Modified: sandbox/chrono/libs/chrono/src/chrono.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/chrono.cpp (original)
+++ sandbox/chrono/libs/chrono/src/chrono.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -10,6 +10,7 @@
// the library is being built (possibly exporting rather than importing code)
#define BOOST_CHRONO_SOURCE
+#include <boost/version.hpp>
#include <boost/chrono/chrono.hpp>
#include <boost/system/system_error.hpp>
#include <boost/throw_exception.hpp>
Modified: sandbox/chrono/libs/chrono/src/mac/chrono.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/mac/chrono.cpp (original)
+++ sandbox/chrono/libs/chrono/src/mac/chrono.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -104,7 +104,11 @@
static const double factor = compute_monotonic_factor(err);
if (err != 0)
boost::throw_exception(
+#if (BOOST_VERSION / 100 % 1000) < 44
system::system_error( err, system::system_category, "chrono::monotonic_clock" ));
+#else
+ system::system_error( err, system::system_category(), "chrono::monotonic_clock" ));
+#endif
return static_cast<monotonic_clock::rep>(mach_absolute_time() * factor);
}
@@ -115,7 +119,11 @@
static kern_return_t err;
static const double factor = compute_monotonic_factor(err);
if (err != 0) {
+#if (BOOST_VERSION / 100 % 1000) < 44
ec.assign( errno, system::system_category );
+#else
+ ec.assign( errno, system::system_category() );
+#endif
return monotonic_clock::rep();
}
ec.clear();
@@ -162,7 +170,11 @@
static kern_return_t err;
static FP fp = init_monotonic_clock(err);
if( err != 0 ) boost::throw_exception(
+#if (BOOST_VERSION / 100 % 1000) < 44
system::system_error( err, system::system_category, "chrono::monotonic_clock" ));
+#else
+ system::system_error( err, system::system_category(), "chrono::monotonic_clock" ));
+#endif
return time_point(duration(fp()));
}
@@ -172,7 +184,11 @@
static kern_return_t err;
static FP_ec fp = init_monotonic_clock(err);
if( err != 0 ) {
+#if (BOOST_VERSION / 100 % 1000) < 44
ec.assign( err, system::system_category );
+#else
+ ec.assign( err, system::system_category() );
+#endif
return time_point();
}
ec.clear();
Modified: sandbox/chrono/libs/chrono/src/mac/process_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/mac/process_clock.cpp (original)
+++ sandbox/chrono/libs/chrono/src/mac/process_clock.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -60,7 +60,11 @@
{
assert( 0 && "error handling not implemented yet" );
- ec.assign( errno, system::system_category );
+#if (BOOST_VERSION / 100 % 1000) < 44
+ ec.assign( errno, system::system_category );
+#else
+ ec.assign( errno, system::system_category() );
+#endif
times_.real = times_.system = times_.user = nanoseconds(-1);
}
else
@@ -78,7 +82,12 @@
else
{
assert( 0 && "error handling not implemented yet" );
+#if (BOOST_VERSION / 100 % 1000) < 44
ec.assign( errno, system::system_category );
+#else
+ ec.assign( errno, system::system_category() );
+#endif
+
times_.real = times_.user = times_.system = nanoseconds(-1);
}
}
Modified: sandbox/chrono/libs/chrono/src/posix/chrono.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/posix/chrono.cpp (original)
+++ sandbox/chrono/libs/chrono/src/posix/chrono.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -24,7 +24,11 @@
if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
{
boost::throw_exception(
+#if (BOOST_VERSION / 100 % 1000) < 44
system::system_error( errno, system::system_category, "chrono::system_clock" ));
+#else
+ system::system_error( errno, system::system_category(), "chrono::system_clock" ));
+#endif
}
return time_point(duration(
@@ -36,7 +40,11 @@
timespec ts;
if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
{
+#if (BOOST_VERSION / 100 % 1000) < 44
ec.assign( errno, system::system_category );
+#else
+ ec.assign( errno, system::system_category() );
+#endif
return time_point();
}
@@ -63,7 +71,11 @@
if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
{
boost::throw_exception(
+#if (BOOST_VERSION / 100 % 1000) < 44
system::system_error( errno, system::system_category, "chrono::monotonic_clock" ));
+#else
+ system::system_error( errno, system::system_category(), "chrono::monotonic_clock" ));
+#endif
}
return time_point(duration(
@@ -75,7 +87,11 @@
timespec ts;
if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
{
+#if (BOOST_VERSION / 100 % 1000) < 44
ec.assign( errno, system::system_category );
+#else
+ ec.assign( errno, system::system_category() );
+#endif
return time_point();
}
Modified: sandbox/chrono/libs/chrono/src/posix/process_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/posix/process_clock.cpp (original)
+++ sandbox/chrono/libs/chrono/src/posix/process_clock.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -51,7 +51,11 @@
if ( c == clock_t(-1) ) // error
{
assert( 0 && "error handling not implemented yet" );
+#if (BOOST_VERSION / 100 % 1000) < 44
ec.assign( errno, system::system_category );
+#else
+ ec.assign( errno, system::system_category() );
+#endif
times_.real = times_.system = times_.user = nanoseconds(-1);
}
else
@@ -68,7 +72,11 @@
else
{
assert( 0 && "error handling not implemented yet" );
+#if (BOOST_VERSION / 100 % 1000) < 44
ec.assign( errno, system::system_category );
+#else
+ ec.assign( errno, system::system_category() );
+#endif
times_.real = times_.user = times_.system = nanoseconds(-1);
}
}
Modified: sandbox/chrono/libs/chrono/src/posix/thread_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/posix/thread_clock.cpp (original)
+++ sandbox/chrono/libs/chrono/src/posix/thread_clock.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -34,7 +34,11 @@
if ( ::clock_gettime( clock_id, &ts ) )
{
boost::throw_exception(
+#if (BOOST_VERSION / 100 % 1000) < 44
system::system_error( errno, system::system_category, "chrono::thread_clock" ));
+#else
+ system::system_error( errno, system::system_category(), "chrono::thread_clock" ));
+#endif
}
// transform to nanoseconds
@@ -52,7 +56,11 @@
struct timespec ts;
if ( ::clock_gettime( clock_id, &ts ) )
{
+#if (BOOST_VERSION / 100 % 1000) < 44
ec.assign( errno, system::system_category );
+#else
+ ec.assign( errno, system::system_category() );
+#endif
return time_point();
}
ec.clear();
Modified: sandbox/chrono/libs/chrono/src/process_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/process_clock.cpp (original)
+++ sandbox/chrono/libs/chrono/src/process_clock.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -15,6 +15,7 @@
#define BOOST_CHRONO_SOURCE
#include <boost/chrono/config.hpp>
+#include <boost/version.hpp>
#include <boost/chrono/process_times.hpp>
#include <cassert>
Modified: sandbox/chrono/libs/chrono/src/process_cpu_clocks.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/process_cpu_clocks.cpp (original)
+++ sandbox/chrono/libs/chrono/src/process_cpu_clocks.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -14,6 +14,7 @@
#define BOOST_CHRONO_SOURCE
#include <boost/chrono/config.hpp>
+#include <boost/version.hpp>
#include <boost/chrono/process_cpu_clocks.hpp>
#include <boost/chrono/process_times.hpp>
#include <cassert>
Modified: sandbox/chrono/libs/chrono/src/run_timer.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/run_timer.cpp (original)
+++ sandbox/chrono/libs/chrono/src/run_timer.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -14,6 +14,7 @@
// the library is being built (possibly exporting rather than importing code)
#define BOOST_CHRONO_SOURCE
+#include <boost/version.hpp>
#include <boost/chrono/process_times.hpp>
#include <boost/system/system_error.hpp>
#include <boost/io/ios_state.hpp>
@@ -153,7 +154,11 @@
catch (...) // eat any exceptions
{
assert( 0 && "error reporting not fully implemented yet" );
+#if (BOOST_VERSION / 100 % 1000) < 44
ec.assign(system::errc::success, system::generic_category);
+#else
+ ec.assign(system::errc::success, system::generic_category());
+#endif
//ec = error_code( EIO, errno_ecat );
}
}
Modified: sandbox/chrono/libs/chrono/src/run_timer_static.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/run_timer_static.cpp (original)
+++ sandbox/chrono/libs/chrono/src/run_timer_static.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -21,6 +21,7 @@
// the library is being built (possibly exporting rather than importing code)
#define BOOST_CHRONO_SOURCE
+#include <boost/version.hpp>
#include <boost/chrono/process_times.hpp>
#include <iostream>
Modified: sandbox/chrono/libs/chrono/src/thread_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/thread_clock.cpp (original)
+++ sandbox/chrono/libs/chrono/src/thread_clock.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -15,6 +15,7 @@
#define BOOST_CHRONO_SOURCE
#include <boost/chrono/config.hpp>
+#include <boost/version.hpp>
#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
#include <boost/chrono/thread_clock.hpp>
#include <cassert>
Modified: sandbox/chrono/libs/chrono/src/win/chrono.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/win/chrono.cpp (original)
+++ sandbox/chrono/libs/chrono/src/win/chrono.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -37,7 +37,11 @@
{
DWORD cause = (nanosecs_per_tic <= 0.0L ? ERROR_NOT_SUPPORTED : ::GetLastError());
boost::throw_exception(
+#if (BOOST_VERSION / 100 % 1000) < 44
system::system_error( cause, system::system_category, "chrono::monotonic_clock" ));
+#else
+ system::system_error( cause, system::system_category(), "chrono::monotonic_clock" ));
+#endif
}
return monotonic_clock::time_point(monotonic_clock::duration(
@@ -52,7 +56,11 @@
if ( (nanosecs_per_tic <= 0.0L) || (!QueryPerformanceCounter( &pcount )) )
{
DWORD cause = ((nanosecs_per_tic <= 0.0L) ? ERROR_NOT_SUPPORTED : ::GetLastError());
+#if (BOOST_VERSION / 100 % 1000) < 44
ec.assign( cause, system::system_category );
+#else
+ ec.assign( cause, system::system_category() );
+#endif
return monotonic_clock::time_point(duration(0));
}
Modified: sandbox/chrono/libs/chrono/src/win/process_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/win/process_clock.cpp (original)
+++ sandbox/chrono/libs/chrono/src/win/process_clock.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -48,7 +48,11 @@
else
{
//~ assert( 0 && "error handling not implemented yet" );
+#if (BOOST_VERSION / 100 % 1000) < 44
ec.assign( ::GetLastError(), system::system_category );
+#else
+ ec.assign( ::GetLastError(), system::system_category() );
+#endif
times_.real = times_.system = times_.user = nanoseconds(-1);
}
Modified: sandbox/chrono/libs/chrono/src/win/thread_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/win/thread_clock.cpp (original)
+++ sandbox/chrono/libs/chrono/src/win/thread_clock.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -48,7 +48,11 @@
else
{
//~ assert( 0 && "error handling not implemented yet" );
+#if (BOOST_VERSION / 100 % 1000) < 44
ec.assign( ::GetLastError(), system::system_category );
+#else
+ ec.assign( ::GetLastError(), system::system_category() );
+#endif
return thread_clock::time_point(duration(0));
}
@@ -79,7 +83,11 @@
{
DWORD cause = ::GetLastError();
boost::throw_exception(
+#if (BOOST_VERSION / 100 % 1000) < 44
system::system_error( ::GetLastError(), system::system_category, "chrono::monotonic_clock" ));
+#else
+ system::system_error( ::GetLastError(), system::system_category(), "chrono::monotonic_clock" ));
+#endif
}
}
Modified: sandbox/chrono/libs/chrono/test/run_timer_test.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/run_timer_test.cpp (original)
+++ sandbox/chrono/libs/chrono/test/run_timer_test.cpp 2010-07-11 11:34:50 EDT (Sun, 11 Jul 2010)
@@ -183,7 +183,7 @@
std::cout << "process_timer_test..." << std::flush;
boost::chrono::process_timer t;
- double res; // avoids optimization
+ double res=0; // avoids optimization
for (long i = 0; i < 10000000L; ++i)
{
res+=std::sqrt( static_cast<double>(i) ); // avoids optimization
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk