Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:09:21

0001 //  (C) Copyright Gennadiy Rozental 2001.
0002 //  (C) Copyright Beman Dawes 2001.
0003 //  Distributed under the Boost Software License, Version 1.0.
0004 //  (See accompanying file LICENSE_1_0.txt or copy at
0005 //  http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 //  See http://www.boost.org/libs/test for the library home page.
0008 //
0009 //!@file
0010 //!@brief Defines public interface of the Execution Monitor and related classes
0011 // ***************************************************************************
0012 
0013 #ifndef BOOST_TEST_EXECUTION_MONITOR_HPP_071894GER
0014 #define BOOST_TEST_EXECUTION_MONITOR_HPP_071894GER
0015 
0016 // Boost.Test
0017 #include <boost/test/detail/global_typedef.hpp>
0018 #include <boost/test/detail/fwd_decl.hpp>
0019 #include <boost/test/detail/throw_exception.hpp>
0020 
0021 #include <boost/test/utils/class_properties.hpp>
0022 
0023 // Boost
0024 #include <boost/shared_ptr.hpp>
0025 #include <boost/scoped_array.hpp>
0026 #include <boost/type.hpp>
0027 #include <boost/cstdlib.hpp>
0028 #include <boost/function/function0.hpp>
0029 
0030 #include <boost/test/detail/suppress_warnings.hpp>
0031 
0032 #ifdef BOOST_SEH_BASED_SIGNAL_HANDLING
0033 
0034 // for the FP constants and control routines
0035 #include <float.h>
0036 
0037 #ifndef EM_INVALID
0038 #define EM_INVALID _EM_INVALID
0039 #endif
0040 
0041 #ifndef EM_DENORMAL
0042 #define EM_DENORMAL _EM_DENORMAL
0043 #endif
0044 
0045 #ifndef EM_ZERODIVIDE
0046 #define EM_ZERODIVIDE _EM_ZERODIVIDE
0047 #endif
0048 
0049 #ifndef EM_OVERFLOW
0050 #define EM_OVERFLOW _EM_OVERFLOW
0051 #endif
0052 
0053 #ifndef EM_UNDERFLOW
0054 #define EM_UNDERFLOW _EM_UNDERFLOW
0055 #endif
0056 
0057 #ifndef MCW_EM
0058 #define MCW_EM _MCW_EM
0059 #endif
0060 
0061 #else // based on ISO C standard
0062 
0063 #if !defined(BOOST_NO_FENV_H)
0064   #include <boost/detail/fenv.hpp>
0065 #endif
0066 
0067 #endif
0068 
0069 #if defined(BOOST_SEH_BASED_SIGNAL_HANDLING) && !defined(UNDER_CE)
0070   //! Indicates tha the floating point exception handling is supported
0071   //! through SEH
0072   #define BOOST_TEST_FPE_SUPPORT_WITH_SEH__
0073 #elif !defined(BOOST_SEH_BASED_SIGNAL_HANDLING) && !defined(UNDER_CE)
0074   #if !defined(BOOST_NO_FENV_H) && !defined(BOOST_CLANG) && \
0075       defined(__GLIBC__) && defined(__USE_GNU) && \
0076       !(defined(__UCLIBC__) || defined(__nios2__) || defined(__microblaze__))
0077   //! Indicates that floating point exception handling is supported for the
0078   //! non SEH version of it, for the GLIBC extensions only
0079   // see discussions on the related topic: https://svn.boost.org/trac/boost/ticket/11756
0080   #define BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__
0081   #endif
0082 #endif
0083 
0084 
0085 // Additional macro documentations not being generated without this hack
0086 #ifdef BOOST_TEST_DOXYGEN_DOC__
0087 
0088 //! Disables the support of the alternative stack
0089 //! during the compilation of the Boost.test framework. This is especially useful
0090 //! in case it is not possible to detect the lack of alternative stack support for
0091 //! your compiler (for instance, ESXi).
0092 #define BOOST_TEST_DISABLE_ALT_STACK
0093 
0094 #endif
0095 
0096 //____________________________________________________________________________//
0097 
0098 namespace boost {
0099 
0100 /// @defgroup ExecutionMonitor Function Execution Monitor
0101 /// @{
0102 /// @section Intro Introduction
0103 /// Sometimes we need to call a function and make sure that no user or system originated exceptions are being thrown by it. Uniform exception reporting
0104 /// is also may be convenient. That's the purpose of the Boost.Test's Execution Monitor.
0105 ///
0106 /// The Execution Monitor is a lower-level component of the Boost Test Library. It is the base for implementing all other Boost.Test components, but also
0107 /// can be used standalone to get controlled execution of error-prone functions with a uniform error notification. The Execution Monitor calls a user-supplied
0108 /// function in a controlled environment, relieving users from messy error detection.
0109 ///
0110 /// The Execution Monitor usage is demonstrated in the example exec_mon_example.
0111 ///
0112 /// @section DesignRationale Design Rationale
0113 ///
0114 /// The Execution Monitor design assumes that it can be used when no (or almost no) memory available. Also the Execution Monitor
0115 /// is intended to be portable to as many platforms as possible.
0116 ///
0117 /// @section UserGuide User's guide
0118 /// The Execution Monitor is designed to solve the problem of executing potentially dangerous function that may result in any number of error conditions,
0119 /// in monitored environment that should prevent any undesirable exceptions to propagate out of function call and produce consistent result report for all outcomes.
0120 /// The Execution Monitor is able to produce informative report for all standard C++ exceptions and intrinsic types. All other exceptions are reported as unknown.
0121 /// If you prefer different message for your exception type or need to perform any action, the Execution Monitor supports custom exception translators.
0122 /// There are several other parameters of the monitored environment can be configured by setting appropriate properties of the Execution Monitor.
0123 ///
0124 /// All symbols in the Execution Monitor implementation are located in the namespace boost. To use the Execution Monitor you need to:
0125 /// -# include @c boost/test/execution_monitor.hpp
0126 /// -# Make an instance of execution_monitor.
0127 /// -# Optionally register custom exception translators for exception classes which require special processing.
0128 ///
0129 /// @subsection FuncExec Monitored function execution
0130 ///
0131 /// The class execution_monitor can monitor functions with the following signatures:
0132 /// - int ()
0133 /// - void ()
0134 ///
0135 /// This function is expected to be self sufficient part of your application. You can't pass any arguments to this function directly. Instead you
0136 /// should bind them into executable nullary function using bind function (either standard or boost variant). Neither you can return any other value,
0137 /// but an integer result code. If necessary you can bind output parameters by reference or use some other more complicated nullary functor, which
0138 /// maintains state. This includes class methods, static class methods etc.
0139 ///
0140 /// To start the monitored function, invoke the method execution_monitor::execute and pass the monitored function as an argument. If the call succeeds,
0141 /// the method returns the result code produced by the monitored function. If any of the following conditions occur:
0142 /// - Uncaught C++ exception
0143 /// - Hardware or software signal, trap, or other exception
0144 /// - Timeout reached
0145 /// - Debug assert event occurred (under Microsoft Visual C++ or compatible compiler)
0146 ///
0147 /// then the method throws the execution_exception. The exception contains unique error_code value identifying the error condition and the detailed message
0148 /// that can be used to report the error.
0149 ///
0150 /// @subsection Reporting Errors reporting and translation
0151 ///
0152 /// If you need to report an error inside monitored function execution you have to throw an exception. Do not use the execution_exception - it's not intended
0153 /// to be used for this purpose. The simplest choice is to use one of the following C++ types as an exception:
0154 /// - C string
0155 /// - std:string
0156 /// - any exception class in std::exception hierarchy
0157 /// - boost::exception
0158 ///
0159 /// execution_monitor will catch and report these types of exceptions. If exception is thrown which is unknown to execution_monitor, it can only
0160 /// report the fact of the exception. So in case if you prefer to use your own exception types or can't govern what exceptions are generated by monitored
0161 /// function and would like to see proper error message in a report, execution_monitor can be configured with custom "translator" routine, which will have
0162 /// a chance to either record the fact of the exception itself or translate it into one of standard exceptions and rethrow (or both). The translator routine
0163 /// is registered per exception type and is invoked when exception of this class (or one inherited from it) is thrown inside monitored routine. You can
0164 /// register as many independent translators as you like. See execution_monitor::register_exception_translator specification for requirements on translator
0165 /// function.
0166 ///
0167 /// Finally, if you need to abort the monitored function execution without reporting any errors, you can throw an exception execution_aborted. As a result
0168 /// the execution is aborted and zero result code is produced by the method execution_monitor::execute.
0169 ///
0170 /// @subsection Parameters Supported parameters
0171 ///
0172 /// The Execution Monitor behavior is configurable through the set of parameters (properties) associated with the instance of the monitor. See execution_monitor
0173 /// specification for a list of supported parameters and their semantic.
0174 
0175 // ************************************************************************** //
0176 // **************        detail::translator_holder_base        ************** //
0177 // ************************************************************************** //
0178 
0179 namespace detail {
0180 
0181 class translator_holder_base;
0182 typedef boost::shared_ptr<translator_holder_base> translator_holder_base_ptr;
0183 
0184 class BOOST_TEST_DECL translator_holder_base {
0185 protected:
0186     typedef boost::unit_test::const_string const_string;
0187 public:
0188     // Constructor
0189     translator_holder_base( translator_holder_base_ptr next, const_string tag )
0190     : m_next( next )
0191     , m_tag( std::string() + tag )
0192     {
0193     }
0194 
0195     // Destructor
0196     virtual     ~translator_holder_base() {}
0197 
0198     // translator holder interface
0199     // invokes the function F inside the try/catch guarding against specific exception
0200     virtual int operator()( boost::function<int ()> const& F ) = 0;
0201 
0202     // erases specific translator holder from the chain
0203     translator_holder_base_ptr erase( translator_holder_base_ptr this_, const_string tag )
0204     {
0205         if( m_next )
0206             m_next = m_next->erase( m_next, tag );
0207 
0208         return m_tag == tag ? m_next : this_;
0209     }
0210 #ifndef BOOST_NO_RTTI
0211     virtual translator_holder_base_ptr erase( translator_holder_base_ptr this_, std::type_info const& ) = 0;
0212     template<typename ExceptionType>
0213     translator_holder_base_ptr erase( translator_holder_base_ptr this_, boost::type<ExceptionType>* = 0 )
0214     {
0215         if( m_next )
0216             m_next = m_next->erase<ExceptionType>( m_next );
0217 
0218         return erase( this_, typeid(ExceptionType) );
0219     }
0220 #endif
0221 
0222 protected:
0223     // Data members
0224     translator_holder_base_ptr  m_next;
0225     std::string                 m_tag;
0226 };
0227 
0228 } // namespace detail
0229 
0230 // ************************************************************************** //
0231 /// @class execution_exception
0232 /// @brief This class is used to report any kind of an failure during execution of a monitored function inside of execution_monitor
0233 ///
0234 /// The instance of this class is thrown out of execution_monitor::execute invocation when failure is detected. Regardless of a kind of failure occurred
0235 /// the instance will provide a uniform way to catch and report it.
0236 ///
0237 /// One important design rationale for this class is that we should be ready to work after fatal memory corruptions or out of memory conditions. To facilitate
0238 /// this class never allocates any memory and assumes that strings it refers to are either some constants or live in a some kind of persistent (preallocated) memory.
0239 // ************************************************************************** //
0240 
0241 class BOOST_SYMBOL_VISIBLE execution_exception {
0242     typedef boost::unit_test::const_string const_string;
0243 public:
0244     /// These values are sometimes used as program return codes.
0245     /// The particular values have been chosen to avoid conflicts with
0246     /// commonly used program return codes: values < 100 are often user
0247     /// assigned, values > 255 are sometimes used to report system errors.
0248     /// Gaps in values allow for orderly expansion.
0249     ///
0250     /// @note(1) Only uncaught C++ exceptions are treated as errors.
0251     /// If a function catches a C++ exception, it never reaches
0252     /// the execution_monitor.
0253     ///
0254     /// The implementation decides what is a system_fatal_error and what is
0255     /// just a system_exception. Fatal errors are so likely to have corrupted
0256     /// machine state (like a stack overflow or addressing exception) that it
0257     /// is unreasonable to continue execution.
0258     ///
0259     /// @note(2) These errors include Unix signals and Windows structured
0260     /// exceptions. They are often initiated by hardware traps.
0261     enum error_code {
0262         no_error               = 0,   ///< for completeness only; never returned
0263         user_error             = 200, ///< user reported non-fatal error
0264         cpp_exception_error    = 205, ///< see note (1) above
0265         system_error           = 210, ///< see note (2) above
0266         timeout_error          = 215, ///< only detectable on certain platforms
0267         user_fatal_error       = 220, ///< user reported fatal error
0268         system_fatal_error     = 225  ///< see note (2) above
0269     };
0270 
0271     /// Simple model for the location of failure in a source code
0272     struct BOOST_TEST_DECL location {
0273         explicit    location( char const* file_name = 0, size_t line_num = 0, char const* func = 0 );
0274         explicit    location( const_string file_name, size_t line_num = 0, char const* func = 0 );
0275 
0276         const_string    m_file_name;    ///< File name
0277         size_t          m_line_num;     ///< Line number
0278         const_string    m_function;     ///< Function name
0279     };
0280 
0281     /// @name Constructors
0282 
0283     /// Constructs instance based on message, location and error code
0284 
0285     /// @param[in] ec           error code
0286     /// @param[in] what_msg     error message
0287     /// @param[in] location     error location
0288     execution_exception( error_code ec, const_string what_msg, location const& location );
0289 
0290     /// @name Access methods
0291 
0292     /// Exception error code
0293     error_code      code() const    { return m_error_code; }
0294     /// Exception message
0295     const_string    what() const    { return m_what; }
0296     /// Exception location
0297     location const& where() const   { return m_location; }
0298     ///@}
0299 
0300 private:
0301     // Data members
0302     error_code      m_error_code;
0303     const_string    m_what;
0304     location        m_location;
0305 }; // execution_exception
0306 
0307 // ************************************************************************** //
0308 /// @brief Function execution monitor
0309 
0310 /// This class is used to uniformly detect and report an occurrence of several types of signals and exceptions, reducing various
0311 /// errors to a uniform execution_exception that is returned to a caller.
0312 ///
0313 /// The execution_monitor behavior can be customized through a set of public parameters (properties) associated with the execution_monitor instance.
0314 /// All parameters are implemented as public unit_test::readwrite_property data members of the class execution_monitor.
0315 // ************************************************************************** //
0316 
0317 class BOOST_TEST_DECL execution_monitor {
0318     typedef boost::unit_test::const_string const_string;
0319 public:
0320 
0321     /// Default constructor initializes all execution monitor properties
0322     execution_monitor();
0323 
0324     /// Should monitor catch system errors.
0325     ///
0326     /// The @em p_catch_system_errors property is a boolean flag (default value is true) specifying whether or not execution_monitor should trap system
0327     /// errors/system level exceptions/signals, which would cause program to crash in a regular case (without execution_monitor).
0328     /// Set this property to false, for example, if you wish to force coredump file creation. The Unit Test Framework provides a
0329     /// runtime parameter @c \-\-catch_system_errors=yes to alter the behavior in monitored test cases.
0330     unit_test::readwrite_property<bool> p_catch_system_errors;
0331 
0332     ///  Should monitor try to attach debugger in case of caught system error.
0333     ///
0334     /// The @em p_auto_start_dbg property is a boolean flag (default value is false) specifying whether or not execution_monitor should try to attach debugger
0335     /// in case system error is caught.
0336     unit_test::readwrite_property<bool> p_auto_start_dbg;
0337 
0338 
0339     ///  Specifies the seconds that elapse before a timer_error occurs.
0340     ///
0341     /// The @em p_timeout property is an integer timeout (in microseconds) for monitored function execution. Use this parameter to monitor code with possible deadlocks
0342     /// or infinite loops. This feature is only available for some operating systems (not yet Microsoft Windows).
0343     unit_test::readwrite_property<unsigned long int>  p_timeout;
0344 
0345     ///  Should monitor use alternative stack for the signal catching.
0346     ///
0347     /// The @em p_use_alt_stack property is a boolean flag (default value is false) specifying whether or not execution_monitor should use an alternative stack
0348     /// for the sigaction based signal catching. When enabled the signals are delivered to the execution_monitor on a stack different from current execution
0349     /// stack, which is safer in case if it is corrupted by monitored function. For more details on alternative stack handling see appropriate manuals.
0350     unit_test::readwrite_property<bool> p_use_alt_stack;
0351 
0352     /// Should monitor try to detect hardware floating point exceptions (!= 0), and which specific exception to catch.
0353     ///
0354     /// The @em p_detect_fp_exceptions property is a boolean flag (default value is false) specifying whether or not execution_monitor should install hardware
0355     /// traps for the floating point exception on platforms where it's supported.
0356     unit_test::readwrite_property<unsigned> p_detect_fp_exceptions;
0357 
0358 
0359     // @name Monitoring entry points
0360 
0361     /// @brief Execution monitor entry point for functions returning integer value
0362     ///
0363     /// This method executes supplied function F inside a try/catch block and also may include other unspecified platform dependent error detection code.
0364     ///
0365     /// This method throws an execution_exception on an uncaught C++ exception, a hardware or software signal, trap, or other user exception.
0366     ///
0367     /// @note execute() doesn't consider it an error for F to return a non-zero value.
0368     /// @param[in] F  Function to monitor
0369     /// @returns  value returned by function call F().
0370     /// @see vexecute
0371     int         execute( boost::function<int ()> const& F );
0372 
0373     /// @brief Execution monitor entry point for functions returning void
0374     ///
0375     /// This method is semantically identical to execution_monitor::execute, but doesn't produce any result code.
0376     /// @param[in] F  Function to monitor
0377     /// @see execute
0378     void         vexecute( boost::function<void ()> const& F );
0379     // @}
0380 
0381     // @name Exception translator registration
0382 
0383     /// @brief Registers custom (user supplied) exception translator
0384 
0385     /// This method template registers a translator for an exception type specified as a first template argument. For example
0386     /// @code
0387     ///    void myExceptTr( MyException const& ex ) { /*do something with the exception here*/}
0388     ///    em.register_exception_translator<MyException>( myExceptTr );
0389     /// @endcode
0390     /// The translator should be any unary function/functor object which accepts MyException const&. This can be free standing function
0391     /// or bound class method. The second argument is an optional string tag you can associate with this translator routine. The only reason
0392     /// to specify the tag is if you plan to erase the translator eventually. This can be useful in scenario when you reuse the same
0393     /// execution_monitor instance to monitor different routines and need to register a translator specific to the routine being monitored.
0394     /// While it is possible to erase the translator based on an exception type it was registered for, tag string provides simpler way of doing this.
0395     /// @tparam ExceptionType type of the exception we register a translator for
0396     /// @tparam ExceptionTranslator type of the translator we register for this exception
0397     /// @param[in] tr         translator function object with the signature <em> void (ExceptionType const&)</em>
0398     /// @param[in] tag        tag associated with this translator
0399     template<typename ExceptionType, typename ExceptionTranslator>
0400     void        register_exception_translator( ExceptionTranslator const& tr, const_string tag = const_string(), boost::type<ExceptionType>* = 0 );
0401 
0402     /// @brief Erases custom exception translator based on a tag
0403 
0404     /// Use the same tag as the one used during translator registration
0405     /// @param[in] tag  tag associated with translator you wants to erase
0406     void        erase_exception_translator( const_string tag )
0407     {
0408         m_custom_translators = m_custom_translators->erase( m_custom_translators, tag );
0409     }
0410 #ifndef BOOST_NO_RTTI
0411     /// @brief Erases custom exception translator based on an exception type
0412     ///
0413     /// tparam ExceptionType Exception type for which you want to erase the translator
0414     template<typename ExceptionType>
0415     void        erase_exception_translator( boost::type<ExceptionType>* = 0 )
0416     {
0417         m_custom_translators = m_custom_translators->erase<ExceptionType>( m_custom_translators );
0418     }
0419     //@}
0420 #endif
0421 
0422 private:
0423     // implementation helpers
0424     int         catch_signals( boost::function<int ()> const& F );
0425 
0426     // Data members
0427     detail::translator_holder_base_ptr  m_custom_translators;
0428     boost::scoped_array<char>           m_alt_stack;
0429 }; // execution_monitor
0430 
0431 // ************************************************************************** //
0432 // **************          detail::translator_holder           ************** //
0433 // ************************************************************************** //
0434 
0435 namespace detail {
0436 
0437 template<typename ExceptionType, typename ExceptionTranslator>
0438 class translator_holder : public translator_holder_base
0439 {
0440 public:
0441     explicit    translator_holder( ExceptionTranslator const& tr, translator_holder_base_ptr& next, const_string tag = const_string() )
0442     : translator_holder_base( next, tag ), m_translator( tr ) {}
0443 
0444     // translator holder interface
0445     int operator()( boost::function<int ()> const& F ) BOOST_OVERRIDE
0446     {
0447         BOOST_TEST_I_TRY {
0448             return m_next ? (*m_next)( F ) : F();
0449         }
0450         BOOST_TEST_I_CATCH( ExceptionType, e ) {
0451             m_translator( e );
0452             return boost::exit_exception_failure;
0453         }
0454     }
0455 #ifndef BOOST_NO_RTTI
0456     translator_holder_base_ptr erase( translator_holder_base_ptr this_, std::type_info const& ti ) BOOST_OVERRIDE
0457     {
0458         return ti == typeid(ExceptionType) ? m_next : this_;
0459     }
0460 #endif
0461 
0462 private:
0463     // Data members
0464     ExceptionTranslator m_translator;
0465 };
0466 
0467 } // namespace detail
0468 
0469 template<typename ExceptionType, typename ExceptionTranslator>
0470 void
0471 execution_monitor::register_exception_translator( ExceptionTranslator const& tr, const_string tag, boost::type<ExceptionType>* )
0472 {
0473     m_custom_translators.reset(
0474         new detail::translator_holder<ExceptionType,ExceptionTranslator>( tr, m_custom_translators, tag ) );
0475 }
0476 
0477 // ************************************************************************** //
0478 /// @class execution_aborted
0479 /// @brief This is a trivial default constructible class. Use it to report graceful abortion of a monitored function execution.
0480 // ************************************************************************** //
0481 
0482 struct BOOST_SYMBOL_VISIBLE execution_aborted {};
0483 
0484 // ************************************************************************** //
0485 // **************                  system_error                ************** //
0486 // ************************************************************************** //
0487 
0488 class system_error {
0489 public:
0490     // Constructor
0491     explicit    system_error( char const* exp );
0492 
0493     long const          p_errno;
0494     char const* const   p_failed_exp;
0495 };
0496 
0497 //!@internal
0498 #define BOOST_TEST_SYS_ASSERT( cond ) BOOST_TEST_I_ASSRT( cond, ::boost::system_error( BOOST_STRINGIZE( exp ) ) )
0499 
0500 // ************************************************************************** //
0501 // **************Floating point exception management interface ************** //
0502 // ************************************************************************** //
0503 
0504 namespace fpe {
0505 
0506 enum masks {
0507     BOOST_FPE_OFF       = 0,
0508 
0509 #if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__) /* *** */
0510     BOOST_FPE_DIVBYZERO = EM_ZERODIVIDE,
0511     BOOST_FPE_INEXACT   = EM_INEXACT,
0512     BOOST_FPE_INVALID   = EM_INVALID,
0513     BOOST_FPE_OVERFLOW  = EM_OVERFLOW,
0514     BOOST_FPE_UNDERFLOW = EM_UNDERFLOW|EM_DENORMAL,
0515 
0516     BOOST_FPE_ALL       = MCW_EM,
0517 
0518 #elif !defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__)/* *** */
0519     BOOST_FPE_DIVBYZERO = BOOST_FPE_OFF,
0520     BOOST_FPE_INEXACT   = BOOST_FPE_OFF,
0521     BOOST_FPE_INVALID   = BOOST_FPE_OFF,
0522     BOOST_FPE_OVERFLOW  = BOOST_FPE_OFF,
0523     BOOST_FPE_UNDERFLOW = BOOST_FPE_OFF,
0524     BOOST_FPE_ALL       = BOOST_FPE_OFF,
0525 #else /* *** */
0526 
0527 #if defined(FE_DIVBYZERO)
0528     BOOST_FPE_DIVBYZERO = FE_DIVBYZERO,
0529 #else
0530     BOOST_FPE_DIVBYZERO = BOOST_FPE_OFF,
0531 #endif
0532 
0533 #if defined(FE_INEXACT)
0534     BOOST_FPE_INEXACT   = FE_INEXACT,
0535 #else
0536     BOOST_FPE_INEXACT   = BOOST_FPE_OFF,
0537 #endif
0538 
0539 #if defined(FE_INVALID)
0540     BOOST_FPE_INVALID   = FE_INVALID,
0541 #else
0542     BOOST_FPE_INVALID   = BOOST_FPE_OFF,
0543 #endif
0544 
0545 #if defined(FE_OVERFLOW)
0546     BOOST_FPE_OVERFLOW  = FE_OVERFLOW,
0547 #else
0548     BOOST_FPE_OVERFLOW  = BOOST_FPE_OFF,
0549 #endif
0550 
0551 #if defined(FE_UNDERFLOW)
0552     BOOST_FPE_UNDERFLOW = FE_UNDERFLOW,
0553 #else
0554     BOOST_FPE_UNDERFLOW = BOOST_FPE_OFF,
0555 #endif
0556 
0557 #if defined(FE_ALL_EXCEPT)
0558     BOOST_FPE_ALL       = FE_ALL_EXCEPT,
0559 #else
0560     BOOST_FPE_ALL       = BOOST_FPE_OFF,
0561 #endif
0562 
0563 #endif /* *** */
0564     BOOST_FPE_INV       = BOOST_FPE_ALL+1
0565 };
0566 
0567 //____________________________________________________________________________//
0568 
0569 // return the previous set of enabled exceptions when successful, and BOOST_FPE_INV otherwise
0570 unsigned BOOST_TEST_DECL enable( unsigned mask );
0571 unsigned BOOST_TEST_DECL disable( unsigned mask );
0572 
0573 //____________________________________________________________________________//
0574 
0575 } // namespace fpe
0576 
0577 ///@}
0578 
0579 }  // namespace boost
0580 
0581 
0582 #include <boost/test/detail/enable_warnings.hpp>
0583 
0584 #endif