Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2007-11-15 04:52:27


Author: johnmaddock
Date: 2007-11-15 04:52:26 EST (Thu, 15 Nov 2007)
New Revision: 41103
URL: http://svn.boost.org/trac/boost/changeset/41103

Log:
Fix some compiler warnings when building with the Intel and aCC compilers.
Text files modified:
   trunk/boost/math/policies/error_handling.hpp | 11 ++++++++++-
   trunk/boost/math/special_functions/fpclassify.hpp | 2 +-
   trunk/boost/math/tools/roots.hpp | 7 ++++++-
   3 files changed, 17 insertions(+), 3 deletions(-)

Modified: trunk/boost/math/policies/error_handling.hpp
==============================================================================
--- trunk/boost/math/policies/error_handling.hpp (original)
+++ trunk/boost/math/policies/error_handling.hpp 2007-11-15 04:52:26 EST (Thu, 15 Nov 2007)
@@ -57,6 +57,15 @@
 
 namespace detail
 {
+//
+// Helper function to avoid binding rvalue to non-const-reference,
+// in other words a warning suppression mechansim:
+//
+template <class Formatter, class Group>
+inline std::string do_format(Formatter f, const Group& g)
+{
+ return (f % g).str();
+}
 
 template <class E, class T>
 void raise_error(const char* function, const char* message)
@@ -89,7 +98,7 @@
   msg += message;
 
   int prec = 2 + (boost::math::policies::digits<T, boost::math::policies::policy<> >() * 30103UL) / 100000UL;
- msg = (boost::format(msg) % boost::io::group(std::setprecision(prec), val)).str();
+ msg = do_format(boost::format(msg), boost::io::group(std::setprecision(prec), val));
 
   E e(msg);
   boost::throw_exception(e);

Modified: trunk/boost/math/special_functions/fpclassify.hpp
==============================================================================
--- trunk/boost/math/special_functions/fpclassify.hpp (original)
+++ trunk/boost/math/special_functions/fpclassify.hpp 2007-11-15 04:52:26 EST (Thu, 15 Nov 2007)
@@ -34,7 +34,7 @@
 #define BOOST_HAS_FPCLASSIFY
 
 #ifndef fpclassify
-# if (defined(__GLIBCPP__) || defined(__GLIBCXX__)) && defined(_GLIBCXX_USE_C99_MATH) && (!_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC)
+# if (defined(__GLIBCPP__) || defined(__GLIBCXX__)) && defined(_GLIBCXX_USE_C99_MATH) && !(defined(_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC) && (_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC != 0))
 # define BOOST_FPCLASSIFY_PREFIX ::std::
 # else
 # undef BOOST_HAS_FPCLASSIFY

Modified: trunk/boost/math/tools/roots.hpp
==============================================================================
--- trunk/boost/math/tools/roots.hpp (original)
+++ trunk/boost/math/tools/roots.hpp 2007-11-15 04:52:26 EST (Thu, 15 Nov 2007)
@@ -32,6 +32,10 @@
 
 namespace detail{
 
+template <class Tuple, class T>
+inline void unpack_0(const Tuple& t, T& val)
+{ val = std::tr1::get<0>(t); }
+
 template <class F, class T>
 void handle_zero_derivative(F f,
                             T& last_f0,
@@ -54,7 +58,8 @@
       {
          guess = min;
       }
- last_f0 = std::tr1::get<0>(f(guess));
+ unpack_0(f(guess), last_f0);
+ //last_f0 = std::tr1::get<0>(f(guess));
       delta = guess - result;
    }
    if(sign(last_f0) * sign(f0) < 0)


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