Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80897 - in trunk: boost/chrono libs/chrono/doc libs/chrono/test/duration libs/chrono/test/time_point
From: vicente.botet_at_[hidden]
Date: 2012-10-07 10:11:00


Author: viboes
Date: 2012-10-07 10:10:59 EDT (Sun, 07 Oct 2012)
New Revision: 80897
URL: http://svn.boost.org/trac/boost/changeset/80897

Log:
Chrono: try to fix 7479
Text files modified:
   trunk/boost/chrono/config.hpp | 17 +++++++++++++++++
   trunk/boost/chrono/duration.hpp | 18 +++++++++---------
   trunk/boost/chrono/time_point.hpp | 4 ++--
   trunk/libs/chrono/doc/chrono.qbk | 3 ++-
   trunk/libs/chrono/test/duration/duration_values_pass.cpp | 6 +++---
   trunk/libs/chrono/test/time_point/min_max_pass.cpp | 2 +-
   6 files changed, 34 insertions(+), 16 deletions(-)

Modified: trunk/boost/chrono/config.hpp
==============================================================================
--- trunk/boost/chrono/config.hpp (original)
+++ trunk/boost/chrono/config.hpp 2012-10-07 10:10:59 EDT (Sun, 07 Oct 2012)
@@ -114,6 +114,23 @@
 #endif
 #endif
 
+#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS )
+#define BOOST_CHRONO_LIB_CONSTEXPR
+#else
+#define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR
+#endif
+
+#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS )
+# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw()
+#else
+#ifdef BOOST_NO_NOEXCEPT
+# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw()
+#else
+# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept
+#endif
+#endif
+
+
 #if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \
  && defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 #error "BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING && BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING defined"

Modified: trunk/boost/chrono/duration.hpp
==============================================================================
--- trunk/boost/chrono/duration.hpp (original)
+++ trunk/boost/chrono/duration.hpp 2012-10-07 10:10:59 EDT (Sun, 07 Oct 2012)
@@ -340,17 +340,17 @@
 namespace detail {
     template <class T, bool = is_arithmetic<T>::value>
     struct chrono_numeric_limits {
- static BOOST_CONSTEXPR T lowest() throw() {return (std::numeric_limits<T>::min) ();}
+ static BOOST_CHRONO_LIB_CONSTEXPR T lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW {return (std::numeric_limits<T>::min) ();}
     };
 
     template <class T>
     struct chrono_numeric_limits<T,true> {
- static BOOST_CONSTEXPR T lowest() throw() {return (std::numeric_limits<T>::min) ();}
+ static BOOST_CHRONO_LIB_CONSTEXPR T lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW {return (std::numeric_limits<T>::min) ();}
     };
 
     template <>
     struct chrono_numeric_limits<float,true> {
- static BOOST_CONSTEXPR float lowest() throw()
+ static BOOST_CHRONO_LIB_CONSTEXPR float lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW
         {
             return -(std::numeric_limits<float>::max) ();
         }
@@ -358,7 +358,7 @@
 
     template <>
     struct chrono_numeric_limits<double,true> {
- static BOOST_CONSTEXPR double lowest() throw()
+ static BOOST_CHRONO_LIB_CONSTEXPR double lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW
         {
             return -(std::numeric_limits<double>::max) ();
         }
@@ -366,7 +366,7 @@
 
     template <>
     struct chrono_numeric_limits<long double,true> {
- static BOOST_CONSTEXPR long double lowest() throw()
+ static BOOST_CHRONO_LIB_CONSTEXPR long double lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW
         {
             return -(std::numeric_limits<long double>::max)();
         }
@@ -381,12 +381,12 @@
 struct duration_values
 {
     static BOOST_CONSTEXPR Rep zero() {return Rep(0);}
- static BOOST_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ static BOOST_CHRONO_LIB_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION ()
     {
         return (std::numeric_limits<Rep>::max)();
     }
 
- static BOOST_CONSTEXPR Rep min BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ static BOOST_CHRONO_LIB_CONSTEXPR Rep min BOOST_PREVENT_MACRO_SUBSTITUTION ()
     {
         return detail::numeric_limits<Rep>::lowest();
     }
@@ -513,11 +513,11 @@
         {
             return duration(duration_values<rep>::zero());
         }
- static BOOST_CONSTEXPR duration min BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ static BOOST_CHRONO_LIB_CONSTEXPR duration min BOOST_PREVENT_MACRO_SUBSTITUTION ()
         {
             return duration((duration_values<rep>::min)());
         }
- static BOOST_CONSTEXPR duration max BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ static BOOST_CHRONO_LIB_CONSTEXPR duration max BOOST_PREVENT_MACRO_SUBSTITUTION ()
         {
             return duration((duration_values<rep>::max)());
         }

Modified: trunk/boost/chrono/time_point.hpp
==============================================================================
--- trunk/boost/chrono/time_point.hpp (original)
+++ trunk/boost/chrono/time_point.hpp 2012-10-07 10:10:59 EDT (Sun, 07 Oct 2012)
@@ -217,12 +217,12 @@
 
         // special values
 
- static BOOST_CONSTEXPR time_point
+ static BOOST_CHRONO_LIB_CONSTEXPR time_point
         min BOOST_PREVENT_MACRO_SUBSTITUTION ()
         {
             return time_point((duration::min)());
         }
- static BOOST_CONSTEXPR time_point
+ static BOOST_CHRONO_LIB_CONSTEXPR time_point
         max BOOST_PREVENT_MACRO_SUBSTITUTION ()
         {
             return time_point((duration::max)());

Modified: trunk/libs/chrono/doc/chrono.qbk
==============================================================================
--- trunk/libs/chrono/doc/chrono.qbk (original)
+++ trunk/libs/chrono/doc/chrono.qbk 2012-10-07 10:10:59 EDT (Sun, 07 Oct 2012)
@@ -2573,7 +2573,7 @@
 
 * Breaking change `BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 `
 
-The default value for `BOOST_THREAD_VERSION` will be changed to 2 since Boost 1.55.
+The default value for `BOOST_CHRONO_VERSION` will be changed to 2 since Boost 1.55.
 
 [endsect]
 
@@ -7273,6 +7273,7 @@
 [*Fixes:]
 
 * [@http://svn.boost.org/trac/boost/ticket/7381 #7381] C++11 compliance: unresolved symbol when assigning a constexpr duration to a non-const local variable.
+* [@http://svn.boost.org/trac/boost/ticket/7479 #7479] Compiles fails with compilers supporting constexpr fails if the standard library doesn't provides the constexpr interface
 
 [*Would not fix:]
 

Modified: trunk/libs/chrono/test/duration/duration_values_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/duration/duration_values_pass.cpp (original)
+++ trunk/libs/chrono/test/duration/duration_values_pass.cpp 2012-10-07 10:10:59 EDT (Sun, 07 Oct 2012)
@@ -15,7 +15,7 @@
 #include <boost/detail/lightweight_test.hpp>
 
 #include "../rep.h"
-#ifdef BOOST_NO_CONSTEXPR
+#if defined BOOST_NO_CXX11_NUMERIC_LIMITS || defined BOOST_NO_CXX11_CONSTEXPR
 #define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
 #else
 #include <boost/static_assert.hpp>
@@ -30,7 +30,7 @@
     BOOST_TEST((D::max)().count() == max_rep);
     {
       typedef typename D::rep Rep;
- BOOST_CONSTEXPR Rep max_rep = (boost::chrono::duration_values<Rep>::max)();
+ BOOST_CHRONO_LIB_CONSTEXPR Rep max_rep = (boost::chrono::duration_values<Rep>::max)();
       BOOST_CONSTEXPR_ASSERT((D::max)().count() == max_rep);
     }
 }
@@ -43,7 +43,7 @@
     BOOST_TEST((D::min)().count() == min_rep);
     {
       typedef typename D::rep Rep;
- BOOST_CONSTEXPR Rep min_rep = (boost::chrono::duration_values<Rep>::min)();
+ BOOST_CHRONO_LIB_CONSTEXPR Rep min_rep = (boost::chrono::duration_values<Rep>::min)();
       BOOST_CONSTEXPR_ASSERT((D::min)().count() == min_rep);
 
     }

Modified: trunk/libs/chrono/test/time_point/min_max_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/time_point/min_max_pass.cpp (original)
+++ trunk/libs/chrono/test/time_point/min_max_pass.cpp 2012-10-07 10:10:59 EDT (Sun, 07 Oct 2012)
@@ -14,7 +14,7 @@
 #include <boost/chrono/chrono.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
-#ifdef BOOST_NO_CONSTEXPR
+#if defined BOOST_NO_CXX11_NUMERIC_LIMITS || defined BOOST_NO_CXX11_CONSTEXPR
 #define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
 #else
 #include <boost/static_assert.hpp>


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