include
ecl
exceptions
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(exception) ((void)0)
47
#define ecl_try if(true)
48
#define ecl_catch(exception) else
49
#else
50
63
#define ecl_throw(exception) throw exception;
64
69
#define ecl_try try
70
75
#define ecl_catch(exception) catch(exception)
76
79
#endif
80
81
/*****************************************************************************
82
** Macros [ecl_assert_throw, ecl_debug_throw]
83
*****************************************************************************/
84
/* Some bad logic here - release can still mean we use some exceptions */
85
#if defined(NDEBUG) || defined(ECL_NDEBUG) || defined(ECL_DISABLE_EXCEPTIONS)
86
#define ecl_assert_throw(expression,exception) ((void)0)
87
#define ecl_debug_throw(exception) ((void)0)
88
#define ecl_debug_try if(true)
89
#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
90
#else
91
#define ECL_HAS_EXCEPTIONS
92
104
#define ecl_assert_throw(expression,exception) if ( !(expression) ) { throw exception; }
105
114
#define ecl_debug_throw(exception) throw exception;
115
120
#define ecl_debug_try try
121
126
#define ecl_debug_catch(exception) catch(exception)
127
#endif
128
132
#endif
/* ECL_EXCEPTIONS_MACROS_HPP_ */
macros.hpp
ecl_exceptions
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:18:26