macros.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_EXCEPTIONS_MACROS_HPP_
13 #define ECL_EXCEPTIONS_MACROS_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include <ecl/config/macros.hpp>
20 #include <ecl/config/ecl.hpp>
21 
22 /*****************************************************************************
23 ** Declspecs
24 *****************************************************************************/
25 
26 /*
27  * Import/exports symbols for the library
28  */
29 #ifdef ECL_HAS_SHARED_LIBS // ecl is being built around shared libraries
30  #ifdef ecl_exceptions_EXPORTS // we are building a shared lib/dll
31  #define ecl_exceptions_PUBLIC ECL_HELPER_EXPORT
32  #else // we are using shared lib/dll
33  #define ecl_exceptions_PUBLIC ECL_HELPER_IMPORT
34  #endif
35  #define ecl_exceptions_LOCAL ECL_HELPERS_LOCAL
36 #else // ecl is being built around static libraries
37  #define ecl_exceptions_PUBLIC
38  #define ecl_exceptions_LOCAL
39 #endif
40 
41 /*****************************************************************************
42 ** Macros [ecl_throw]
43 *****************************************************************************/
44 
45 #if defined(ECL_DISABLE_EXCEPTIONS)
46  #define ecl_throw_decl(exception)
47  #define ecl_throw(exception) ((void)0)
48  #define ecl_try if(true)
49  #define ecl_catch(exception) else
50 #else
51 
64  #define ecl_throw_decl(exception) throw(exception)
65 
74  #define ecl_throw(exception) throw exception;
75 
80  #define ecl_try try
81 
86  #define ecl_catch(exception) catch(exception)
87 
90 #endif
91 
92 /*****************************************************************************
93 ** Macros [ecl_assert_throw, ecl_debug_throw]
94 *****************************************************************************/
95 /* Some bad logic here - release can still mean we use some exceptions */
96 #if defined(NDEBUG) || defined(ECL_NDEBUG) || defined(ECL_DISABLE_EXCEPTIONS)
97  #define ecl_assert_throw_decl(exception)
98  #define ecl_assert_throw(expression,exception) ((void)0)
99  #define ecl_debug_throw_decl(exception)
100  #define ecl_debug_throw(exception) ((void)0)
101  #define ecl_debug_try if(true)
102  #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
103 #else
104  #define ECL_HAS_EXCEPTIONS
105 
120  #define ecl_assert_throw_decl(exception) throw(exception)
121 
129  #define ecl_assert_throw(expression,exception) if ( !(expression) ) { throw exception; }
130 
139  #define ecl_debug_throw_decl(exception) throw(exception)
140 
149  #define ecl_debug_throw(exception) throw exception;
150 
155  #define ecl_debug_try try
156 
161  #define ecl_debug_catch(exception) catch(exception)
162 #endif
163 
167 #endif /* ECL_EXCEPTIONS_MACROS_HPP_ */


ecl_exceptions
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:12