Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75649 - trunk/boost/chrono/io
From: vicente.botet_at_[hidden]
Date: 2011-11-24 16:56:34


Author: viboes
Date: 2011-11-24 16:56:33 EST (Thu, 24 Nov 2011)
New Revision: 75649
URL: http://svn.boost.org/trac/boost/changeset/75649

Log:
Chrono: added traces to try to catch sun issue in time_point input
Text files modified:
   trunk/boost/chrono/io/duration_get.hpp | 15 +++++++++++++++
   trunk/boost/chrono/io/time_point_io.hpp | 11 +++++++++++
   2 files changed, 26 insertions(+), 0 deletions(-)

Modified: trunk/boost/chrono/io/duration_get.hpp
==============================================================================
--- trunk/boost/chrono/io/duration_get.hpp (original)
+++ trunk/boost/chrono/io/duration_get.hpp 2011-11-24 16:56:33 EST (Thu, 24 Nov 2011)
@@ -191,11 +191,14 @@
         intermediate_type r;
         rt_ratio rt;
         bool value_found = false, unit_found = false;
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
 
         const std::ctype<char_type>& ct = std::use_facet<std::ctype<char_type> >(ios.getloc());
         //err = std::ios_base::goodbit;
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         while (pattern != pat_end && err == std::ios_base::goodbit)
         {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
           if (s == end)
           {
             err |= std::ios_base::eofbit;
@@ -205,6 +208,7 @@
           {
             if (++pattern == pat_end)
             {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
               err |= std::ios_base::failbit;
               return s;
             }
@@ -215,6 +219,7 @@
             {
               if (value_found)
               {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 err |= std::ios_base::failbit;
                 return s;
               }
@@ -222,6 +227,7 @@
               s = get_value(s, end, ios, err, r);
               if (err & (std::ios_base::badbit | std::ios_base::failbit))
               {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 return s;
               }
               break;
@@ -230,6 +236,7 @@
             {
               if (unit_found)
               {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 err |= std::ios_base::failbit;
                 return s;
               }
@@ -237,11 +244,13 @@
               s = get_unit(facet, s, end, ios, err, rt);
               if (err & (std::ios_base::badbit | std::ios_base::failbit))
               {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 return s;
               }
               break;
             }
             default:
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
               BOOST_ASSERT(false && "Boost::Chrono internal error.");
               break;
             }
@@ -268,6 +277,7 @@
 
         }
 
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         unsigned long long num = rt.num;
         unsigned long long den = rt.den;
 
@@ -283,6 +293,7 @@
> (std::numeric_limits<unsigned long long>::max)() / n2)
         {
           // (num/den) / Period overflows
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
           err |= std::ios_base::failbit;
           return s;
         }
@@ -292,6 +303,7 @@
         typedef typename common_type<intermediate_type, unsigned long long>::type common_type_t;
 
         // num / den is now factor to multiply by r
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         if (!detail::reduce(r, den, err)) return s;
 
         if (chrono::detail::gt(r, ( (duration_values<common_type_t>::max)() / num)))
@@ -300,6 +312,7 @@
           err |= std::ios_base::failbit;
           return s;
         }
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         common_type_t t = r * num;
         t /= den;
         if (t > 0)
@@ -307,6 +320,7 @@
           Rep pt = t;
           if ( (duration_values<Rep>::max)() < pt)
           {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
             // Conversion to Period overflowed
             err |= std::ios_base::failbit;
             return s;
@@ -316,6 +330,7 @@
         r = Rep(t);
         d = duration<Rep, Period> (r);
 
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         return s;
       }
 

Modified: trunk/boost/chrono/io/time_point_io.hpp
==============================================================================
--- trunk/boost/chrono/io/time_point_io.hpp (original)
+++ trunk/boost/chrono/io/time_point_io.hpp 2011-11-24 16:56:33 EST (Thu, 24 Nov 2011)
@@ -269,19 +269,24 @@
     std::basic_istream<CharT, Traits>&
     operator>>(std::basic_istream<CharT, Traits>& is, time_point<Clock, Duration>& tp)
     {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
       std::ios_base::iostate err = std::ios_base::goodbit;
 
       try
       {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         typename std::basic_istream<CharT, Traits>::sentry ipfx(is);
         if (ipfx)
         {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
           if (!std::has_facet<time_point_get<CharT> >(is.getloc()))
           {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
             time_point_get<CharT> () .get(is, std::istreambuf_iterator<CharT, Traits>(), is, err, tp);
           }
           else
           {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
             std::use_facet<time_point_get<CharT> >(is.getloc()) .get(is, std::istreambuf_iterator<CharT, Traits>(), is,
                 err, tp);
           }
@@ -289,18 +294,24 @@
       }
       catch (...)
       {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         bool flag = false;
         try
         {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
           is.setstate(std::ios_base::failbit);
         }
         catch (std::ios_base::failure )
         {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
           flag = true;
         }
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         if (flag) throw;
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
       }
       if (err) is.setstate(err);
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
       return is;
     }
 


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