Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81197 - in trunk/boost/test: impl utils
From: gennadiy.rozental_at_[hidden]
Date: 2012-11-05 05:27:21


Author: rogeeff
Date: 2012-11-05 05:27:19 EST (Mon, 05 Nov 2012)
New Revision: 81197
URL: http://svn.boost.org/trac/boost/changeset/81197

Log:
eliminating msvc-10 warnings in release mode; Fixes #6074
Text files modified:
   trunk/boost/test/impl/execution_monitor.ipp | 17 +++++------------
   trunk/boost/test/utils/named_params.hpp | 17 +++++++++--------
   2 files changed, 14 insertions(+), 20 deletions(-)

Modified: trunk/boost/test/impl/execution_monitor.ipp
==============================================================================
--- trunk/boost/test/impl/execution_monitor.ipp (original)
+++ trunk/boost/test/impl/execution_monitor.ipp 2012-11-05 05:27:19 EST (Mon, 05 Nov 2012)
@@ -1062,18 +1062,11 @@
 int BOOST_TEST_CALL_DECL
 assert_reporting_function( int reportType, char* userMessage, int* )
 {
- switch( reportType ) {
- case BOOST_TEST_CRT_ASSERT:
- detail::report_error( execution_exception::user_error, userMessage );
-
- return 1; // return value and retVal are not important since we never reach this line
- case BOOST_TEST_CRT_ERROR:
- detail::report_error( execution_exception::system_error, userMessage );
-
- return 1; // return value and retVal are not important since we never reach this line
- default:
- return 0; // use usual reporting method
- }
+ // write this way instead of switch to avoid unreachable statements
+ if( reportType == BOOST_TEST_CRT_ASSERT || reportType == BOOST_TEST_CRT_ERROR )
+ detail::report_error( reportType == BOOST_TEST_CRT_ASSERT ? execution_exception::user_error : execution_exception::system_error, userMessage );
+
+ return 0;
 } // assert_reporting_function
 
 //____________________________________________________________________________//

Modified: trunk/boost/test/utils/named_params.hpp
==============================================================================
--- trunk/boost/test/utils/named_params.hpp (original)
+++ trunk/boost/test/utils/named_params.hpp 2012-11-05 05:27:19 EST (Mon, 05 Nov 2012)
@@ -53,9 +53,10 @@
 //____________________________________________________________________________//
 
 inline void
-report_access_to_invalid_parameter()
+report_access_to_invalid_parameter(bool v)
 {
- throw access_to_invalid_parameter();
+ if(v)
+ throw access_to_invalid_parameter();
 }
 
 //____________________________________________________________________________//
@@ -71,23 +72,23 @@
 #else
     operator T const&() const
 #endif
- { report_access_to_invalid_parameter(); static T* v = 0; return *v; }
+ { report_access_to_invalid_parameter(true); static T* v = 0; return *v; }
 
     template<typename T>
     T any_cast() const
- { report_access_to_invalid_parameter(); static typename remove_reference<T>::type* v = 0; return *v; }
+ { report_access_to_invalid_parameter(true); static typename remove_reference<T>::type* v = 0; return *v; }
 
     template<typename Arg1>
     nil operator()( Arg1 const& )
- { report_access_to_invalid_parameter(); return nil(); }
+ { report_access_to_invalid_parameter(true); return nil(); }
 
     template<typename Arg1,typename Arg2>
     nil operator()( Arg1 const&, Arg2 const& )
- { report_access_to_invalid_parameter(); return nil(); }
+ { report_access_to_invalid_parameter(true); return nil(); }
 
     template<typename Arg1,typename Arg2,typename Arg3>
     nil operator()( Arg1 const&, Arg2 const&, Arg3 const& )
- { report_access_to_invalid_parameter(); return nil(); }
+ { report_access_to_invalid_parameter(true); return nil(); }
 
     // Visitation support
     template<typename Visitor>
@@ -288,7 +289,7 @@
 inline void
 optionally_assign( T&, nfp_detail::nil )
 {
- nfp_detail::report_access_to_invalid_parameter();
+ nfp_detail::report_access_to_invalid_parameter(true);
 }
 
 //____________________________________________________________________________//


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