Boost logo

Boost :

From: David Deakins (ddeakins_at_[hidden])
Date: 2007-10-23 18:41:40


Attached is a small patch for execution_monitor.ipp to fix Windows
CE-related problems in the new test library code. The changes are
mostly just a few #ifdef blocks to account for the following:

- The Windows CE CRT does not support _set_se_translator or
_set_invalid_parameter_handler.

- The Windows CE CRT supplies _vsnprintf instead of vsnprintf.

- The Windows CE CRT does not support errno.

Thanks,
-Dave

Index: execution_monitor.ipp
===================================================================
--- execution_monitor.ipp (revision 40282)
+++ execution_monitor.ipp (working copy)
@@ -141,7 +141,9 @@
 
 #endif
 
+#ifndef UNDER_CE
 #include <errno.h>
+#endif
 
 #include <boost/test/detail/suppress_warnings.hpp>
 
@@ -158,7 +160,8 @@
 #ifdef __BORLANDC__
 # define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) std::vsnprintf( (a1), (a2), (a3), (a4) )
 #elif BOOST_WORKAROUND(_MSC_VER, <= 1310) || \
- BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3000))
+ BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3000)) || \
+ defined(UNDER_CE)
 # define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) _vsnprintf( (a1), (a2), (a3), (a4) )
 #else
 # define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) vsnprintf( (a1), (a2), (a3), (a4) )
@@ -905,6 +908,8 @@
 
 //____________________________________________________________________________//
 
+#ifndef UNDER_CE
+
 void BOOST_TEST_CALL_DECL
 invalid_param_handler( wchar_t const* /* expr */,
                        wchar_t const* /* func */,
@@ -916,6 +921,8 @@
                           "Invalid parameter detected by C runtime library" );
 }
 
+#endif
+
 //____________________________________________________________________________//
 
 void BOOST_TEST_CALL_DECL
@@ -951,11 +958,14 @@
 int
 execution_monitor::catch_signals( unit_test::callback0<int> const& F )
 {
+#ifndef UNDER_CE
     _invalid_parameter_handler old_iph;
 
     if( !p_catch_system_errors )
         _set_se_translator( &detail::system_signal_exception::seh_catch_preventer );
- else {
+ else
+#endif
+ {
         if( !!p_detect_fp_exceptions )
             detail::switch_fp_exceptions( true );
 
@@ -963,15 +973,19 @@
        _CrtSetReportHook( &detail::assert_reporting_function );
 #endif
 
+#ifndef UNDER_CE
        old_iph = _set_invalid_parameter_handler(
            reinterpret_cast<_invalid_parameter_handler>( &detail::invalid_param_handler ) );
+#endif
     }
 
     detail::system_signal_exception SSE( this );
+
+ int ret_val = 0;
 
     __try {
         __try {
- return detail::do_invoke( m_custom_translators , F );
+ ret_val = detail::do_invoke( m_custom_translators , F );
         }
         __except( SSE( GetExceptionCode(), GetExceptionInformation() ) ) {
             throw SSE;
@@ -982,11 +996,13 @@
             if( !!p_detect_fp_exceptions )
                 detail::switch_fp_exceptions( false );
 
+#ifndef UNDER_CE
            _set_invalid_parameter_handler( old_iph );
+#endif
         }
     }
 
- return 0;
+ return ret_val;
 }
 
 //____________________________________________________________________________//
@@ -1093,10 +1109,20 @@
 // ************** system_error ************** //
 // ************************************************************************** //
 
+#ifdef UNDER_CE
+
 system_error::system_error()
+: p_errno( 0 )
+{}
+
+#else
+
+system_error::system_error()
 : p_errno( errno )
 {}
 
+#endif
+
 //____________________________________________________________________________//
 
 } // namespace boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk