10 #ifndef EIGEN_CORE_UTIL_ASSERT_H 11 #define EIGEN_CORE_UTIL_ASSERT_H 30 #if !defined(EIGEN_NO_DEBUG) && (!defined(EIGEN_GPU_COMPILE_PHASE) || !defined(EIGEN_NO_DEBUG_GPU)) 34 #ifndef EIGEN_USE_CUSTOM_PLAIN_ASSERT 36 #define EIGEN_USE_CUSTOM_PLAIN_ASSERT 0 39 #if EIGEN_USE_CUSTOM_PLAIN_ASSERT 41 #ifndef EIGEN_HAS_BUILTIN_FILE 48 #if (EIGEN_HAS_BUILTIN(__builtin_FILE) && (EIGEN_COMP_CLANG || !defined(EIGEN_CUDA_ARCH))) || \ 49 (EIGEN_GNUC_STRICT_AT_LEAST(5, 0, 0) && (EIGEN_COMP_NVCC >= 110000 || !defined(EIGEN_CUDA_ARCH))) || \ 50 (EIGEN_COMP_MSVC >= 1926 && (!EIGEN_COMP_NVCC || EIGEN_COMP_NVCC >= 110000)) 51 #define EIGEN_HAS_BUILTIN_FILE 1 53 #define EIGEN_HAS_BUILTIN_FILE 0 55 #endif // EIGEN_HAS_BUILTIN_FILE 57 #if EIGEN_HAS_BUILTIN_FILE 58 #define EIGEN_BUILTIN_FILE __builtin_FILE() 59 #define EIGEN_BUILTIN_LINE __builtin_LINE() 62 #define EIGEN_BUILTIN_FILE __FILE__ 63 #define EIGEN_BUILTIN_LINE __LINE__ 71 #define EIGEN_BUILTIN_FUNCTION __FUNCSIG__ 73 #define EIGEN_BUILTIN_FUNCTION __PRETTY_FUNCTION__ 75 #define EIGEN_BUILTIN_FUNCTION __func__ 82 template <
typename EnableIf = void,
typename... EmptyArgs>
83 struct assert_handler_impl {
84 EIGEN_DEVICE_FUNC EIGEN_DONT_INLINE
static inline void run(
const char* expression,
const char* file,
unsigned line,
85 const char*
function) {
86 #ifdef EIGEN_GPU_COMPILE_PHASE 90 printf(
"Assertion failed at %s:%u in %s: %s\n", file ==
nullptr ?
"<file>" : file, line,
91 function ==
nullptr ?
"<function>" :
function, expression);
95 #else // EIGEN_GPU_COMPILE_PHASE 99 fprintf(stderr,
"Assertion failed at %s:%u in %s: %s\n", file ==
nullptr ?
"<file>" : file, line,
100 function ==
nullptr ?
"<function>" :
function, expression);
104 #endif // EIGEN_GPU_COMPILE_PHASE 116 template <
typename... EmptyArgs>
117 struct assert_handler_impl<void_t<decltype(__assert_fail((const char*)
nullptr,
118 (
const char*)
nullptr,
120 (
const char*)
nullptr,
121 std::declval<EmptyArgs>()...
125 EIGEN_DEVICE_FUNC EIGEN_DONT_INLINE
static inline void run(
const char* expression,
const char* file,
unsigned line,
126 const char*
function) {
128 __assert_fail(expression, file, line,
function, std::declval<EmptyArgs>()...);
132 EIGEN_DEVICE_FUNC EIGEN_DONT_INLINE
inline void __assert_handler(
const char* expression,
const char* file,
133 unsigned line,
const char*
function) {
134 assert_handler_impl<>::run(expression, file, line,
function);
140 #define eigen_plain_assert(expression) \ 141 (EIGEN_PREDICT_FALSE(!(expression)) ? Eigen::internal::__assert_handler(#expression, EIGEN_BUILTIN_FILE, \ 142 EIGEN_BUILTIN_LINE, EIGEN_BUILTIN_FUNCTION) \ 145 #else // EIGEN_USE_CUSTOM_PLAIN_ASSERT 148 #define eigen_plain_assert(condition) assert(condition) 150 #endif // EIGEN_USE_CUSTOM_PLAIN_ASSERT 152 #else // EIGEN_NO_DEBUG 154 #define eigen_plain_assert(condition) ((void)0) 156 #endif // EIGEN_NO_DEBUG 158 #endif // EIGEN_CORE_UTIL_ASSERT_H Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1