macros.hpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Ifdefs
00010 *****************************************************************************/
00011 
00012 #ifndef ECL_EXCEPTIONS_MACROS_HPP_
00013 #define ECL_EXCEPTIONS_MACROS_HPP_
00014 
00015 /*****************************************************************************
00016 ** Includes
00017 *****************************************************************************/
00018 
00019 #include <ecl/config/macros.hpp>
00020 #include <ecl/config/ecl.hpp>
00021 
00022 /*****************************************************************************
00023 ** Declspecs
00024 *****************************************************************************/
00025 
00026 /*
00027  * Import/exports symbols for the library
00028  */
00029 #ifdef ECL_HAS_SHARED_LIBS // ecl is being built around shared libraries
00030   #ifdef ecl_exceptions_EXPORTS // we are building a shared lib/dll
00031     #define ecl_exceptions_PUBLIC ECL_HELPER_EXPORT
00032   #else // we are using shared lib/dll
00033     #define ecl_exceptions_PUBLIC ECL_HELPER_IMPORT
00034   #endif
00035   #define ecl_exceptions_LOCAL ECL_HELPERS_LOCAL
00036 #else // ecl is being built around static libraries
00037   #define ecl_exceptions_PUBLIC
00038   #define ecl_exceptions_LOCAL
00039 #endif
00040 
00041 /*****************************************************************************
00042 ** Macros [ecl_throw]
00043 *****************************************************************************/
00044 
00045 #if defined(ECL_DISABLE_EXCEPTIONS)
00046   #define ecl_throw_decl(exception)
00047   #define ecl_throw(exception) ((void)0)
00048   #define ecl_try if(true)
00049   #define ecl_catch(exception) else
00050 #else
00051 
00064   #define ecl_throw_decl(exception) throw(exception)
00065 
00074   #define ecl_throw(exception) throw exception;
00075 
00080   #define ecl_try try
00081 
00086   #define ecl_catch(exception) catch(exception)
00087 
00090 #endif
00091 
00092 /*****************************************************************************
00093 ** Macros [ecl_assert_throw, ecl_debug_throw]
00094 *****************************************************************************/
00095 /* Some bad logic here - release can still mean we use some exceptions */
00096 #if defined(NDEBUG) || defined(ECL_NDEBUG) || defined(ECL_DISABLE_EXCEPTIONS)
00097   #define ecl_assert_throw_decl(exception)
00098   #define ecl_assert_throw(expression,exception) ((void)0)
00099   #define ecl_debug_throw_decl(exception)
00100   #define ecl_debug_throw(exception) ((void)0)
00101   #define ecl_debug_try if(true)
00102   #define ecl_debug_catch(exception) else // TODO - this is useles, you can't do ecl_debug_catch(Exception &e) { std::cout << e.what() << std::endl; } in release mode
00103 #else
00104   #define ECL_HAS_EXCEPTIONS
00105 
00120   #define ecl_assert_throw_decl(exception) throw(exception)
00121 
00129   #define ecl_assert_throw(expression,exception) if ( !(expression) ) { throw exception; }
00130 
00139   #define ecl_debug_throw_decl(exception) throw(exception)
00140 
00149   #define ecl_debug_throw(exception) throw exception;
00150 
00155   #define ecl_debug_try try
00156 
00161   #define ecl_debug_catch(exception) catch(exception)
00162 #endif
00163 
00167 #endif /* ECL_EXCEPTIONS_MACROS_HPP_ */


ecl_exceptions
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 21:17:26