20 #ifndef TILEDARRAY_ERROR_H__INCLUDED 21 #define TILEDARRAY_ERROR_H__INCLUDED 23 #include <TiledArray/config.h> 28 #ifdef TA_DEFAULT_ERROR 29 # if !defined(TA_EXCEPTION_ERROR) && !defined(TA_ASSERT_ERROR) && !defined(TA_NO_ERROR) && !defined(TA_ABORT_ERROR) 30 # if TA_DEFAULT_ERROR == 0 32 # elif TA_DEFAULT_ERROR == 1 33 # define TA_EXCEPTION_ERROR 34 # elif TA_DEFAULT_ERROR == 2 35 # define TA_ASSERT_ERROR 36 # elif TA_DEFAULT_ERROR == 3 37 # define TA_ABORT_ERROR 38 # endif // TA_DEFAULT_ERROR == ? 39 # endif // !defined(TA_EXCEPTION_ERROR) && !defined(TA_ASSERT_ERROR) && !defined(TA_NO_ERROR) && !defined(TA_ABORT_ERROR) 40 #endif // TA_DEFAULT_ERROR 42 #if __cplusplus > 199711L 44 #define TILEDARRAY_NO_EXCEPTION noexcept 46 #define TILEDARRAY_NO_EXCEPTION throw() 67 #define TA_STRINGIZE( s ) #s 69 #define TA_EXCEPTION_MESSAGE( file , line , mess ) \ 70 "TiledArray: exception at " file "(" TA_STRINGIZE( line ) "): " mess 72 #define TA_EXCEPTION( m ) \ 74 TiledArray::exception_break(); \ 75 throw TiledArray::Exception ( TA_EXCEPTION_MESSAGE( __FILE__ , __LINE__ , m ) ); \ 78 #ifdef TA_EXCEPTION_ERROR 81 #ifdef TA_ASSERT_ERROR 82 #undef TA_ASSERT_ERROR 88 #define TA_ASSERT( a ) if(! ( a ) ) TA_EXCEPTION( "assertion failure" ) 89 #define TA_TEST( a ) TA_ASSERT( a ) 91 #elif defined(TA_ASSERT_ERROR) 95 #define TA_ASSERT( a ) assert( a ) 96 #define TA_TEST( a ) TA_ASSERT( a ) 97 #elif defined(TA_ABORT_ERROR) 101 #define TA_ASSERT( a ) if(! ( a ) ) std::abort(); 102 #define TA_TEST( a ) TA_ASSERT( a ) 107 #define TA_ASSERT( a ) { ; } 108 #define TA_TEST( a ) a 110 #endif //TA_EXCEPTION_ERROR 112 #define TA_CHECK( a ) if(! ( a ) ) TA_EXCEPTION( "check failure" ) 114 #ifdef TILEDARRAY_NO_USER_ERROR_MESSAGES 115 #define TA_USER_ERROR_MESSAGE( m ) 118 #define TA_USER_ERROR_MESSAGE( m ) std::cerr << "!! ERROR TiledArray: " << m << "\n"; 119 #endif // TILEDARRAY_NO_USER_ERROR_MESSAGES 123 #define TA_USER_ASSERT( a , m ) \ 126 TA_USER_ERROR_MESSAGE( m ) \ 127 TiledArray::exception_break(); \ 128 throw TiledArray::Exception( m ); \ 134 #define TA_USER_ASSERT( a , m ) 135 #define TA_USER_ASSERT_DISABLED 1 141 #ifndef DEPRECATED // avoid clashing with previous definitions 142 #if __cplusplus >= 201402L 143 #define DEPRECATED [[deprecated]] 144 #elif defined(__GNUC__) 145 #define DEPRECATED __attribute__((deprecated)) 147 #pragma message("WARNING: You need to implement DEPRECATED for this compiler") 150 #endif // not defined(DEPRECATED) 154 #ifndef DEPRECATEDMSG // avoid clashing with previous definitions 155 #if __cplusplus >= 201402L 156 #define DEPRECATEDMSG(msg) [[deprecated(msg)]] 157 #elif defined(__GNUC__) 158 #define DEPRECATEDMSG(msg) __attribute__((deprecated(msg))) 160 #pragma message("WARNING: You need to implement DEPRECATEDMSG for this compiler") 161 #define DEPRECATEDMSG(msg) 163 #endif // not defined(DEPRECATEDMSG) 165 #endif // TILEDARRAY_ERROR_H__INCLUDED
virtual const char * what() const TILEDARRAY_NO_EXCEPTION
void exception_break()
Place a break point on this function to stop before TiledArray exceptions are thrown.
#define TILEDARRAY_NO_EXCEPTION