aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/main.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-08-29 15:20:31 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-08-29 15:20:31 +0200
commit124d12a915129bc36ebe87f483712505a11dc91f (patch)
tree5c0b12148e55cfbfa2c2e69368d982774d96193f /test/main.h
parentf29dbec321617d46287c4415889c4485ad70bea3 (diff)
parentaec3d90ca65528fdface6013ccbcc33b04ada867 (diff)
merge default branch
Diffstat (limited to 'test/main.h')
-rw-r--r--test/main.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/test/main.h b/test/main.h
index e89b5a305..b8854a1c3 100644
--- a/test/main.h
+++ b/test/main.h
@@ -79,6 +79,10 @@ namespace Eigen
#define EIGEN_DEFAULT_IO_FORMAT IOFormat(4, 0, " ", "\n", "", "", "", "")
+#if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(__CUDA_ARCH__)
+ #define EIGEN_EXCEPTIONS
+#endif
+
#ifndef EIGEN_NO_ASSERTION_CHECKING
namespace Eigen
@@ -120,13 +124,14 @@ namespace Eigen
if(report_on_cerr_on_assert_failure) \
std::cerr << #a << " " __FILE__ << "(" << __LINE__ << ")\n"; \
Eigen::no_more_assert = true; \
- throw Eigen::eigen_assert_exception(); \
+ EIGEN_THROW_X(Eigen::eigen_assert_exception()); \
} \
else if (Eigen::internal::push_assert) \
{ \
eigen_assert_list.push_back(std::string(EI_PP_MAKE_STRING(__FILE__) " (" EI_PP_MAKE_STRING(__LINE__) ") : " #a) ); \
}
+ #ifdef EIGEN_EXCEPTIONS
#define VERIFY_RAISES_ASSERT(a) \
{ \
Eigen::no_more_assert = false; \
@@ -145,6 +150,7 @@ namespace Eigen
Eigen::report_on_cerr_on_assert_failure = true; \
Eigen::internal::push_assert = false; \
}
+ #endif //EIGEN_EXCEPTIONS
#elif !defined(__CUDACC__) // EIGEN_DEBUG_ASSERTS
// see bug 89. The copy_bool here is working around a bug in gcc <= 4.3
@@ -155,9 +161,10 @@ namespace Eigen
if(report_on_cerr_on_assert_failure) \
eigen_plain_assert(a); \
else \
- throw Eigen::eigen_assert_exception(); \
+ EIGEN_THROW_X(Eigen::eigen_assert_exception()); \
}
- #define VERIFY_RAISES_ASSERT(a) { \
+ #ifdef EIGEN_EXCEPTIONS
+ #define VERIFY_RAISES_ASSERT(a) { \
Eigen::no_more_assert = false; \
Eigen::report_on_cerr_on_assert_failure = false; \
try { \
@@ -167,9 +174,14 @@ namespace Eigen
catch (Eigen::eigen_assert_exception&) { VERIFY(true); } \
Eigen::report_on_cerr_on_assert_failure = true; \
}
-
+ #endif //EIGEN_EXCEPTIONS
#endif // EIGEN_DEBUG_ASSERTS
+#ifndef VERIFY_RAISES_ASSERT
+ #define VERIFY_RAISES_ASSERT(a) \
+ std::cout << "Can't VERIFY_RAISES_ASSERT( " #a " ) with exceptions disabled\n";
+#endif
+
#if !defined(__CUDACC__)
#define EIGEN_USE_CUSTOM_ASSERT
#endif