diff options
author | 2021-07-07 17:12:12 -0400 | |
---|---|---|
committer | 2021-07-07 17:14:08 -0400 | |
commit | 27e7fd18f1c337c409f2a567697b27bcd0c09f8b (patch) | |
tree | 5ff36982295b5c6c528a26d87e950af015656cde /Eigen/src | |
parent | a59cf78c8d197e2892ec11985a07c98c362e1600 (diff) |
Rename EIGEN_EXCEPTIONS to EIGEN_USE_EXCEPTIONS, and allow disabling
exceptions with -DEIGEN_USE_EXCEPTIONS=0.
Diffstat (limited to 'Eigen/src')
-rw-r--r-- | Eigen/src/Core/CommaInitializer.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/arch/SYCL/SyclMemoryModel.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/util/Macros.h | 15 | ||||
-rw-r--r-- | Eigen/src/Core/util/Memory.h | 2 | ||||
-rw-r--r-- | Eigen/src/SparseLU/SparseLU_Memory.h | 12 |
5 files changed, 16 insertions, 17 deletions
diff --git a/Eigen/src/Core/CommaInitializer.h b/Eigen/src/Core/CommaInitializer.h index c0e29c75c..eb23dedd4 100644 --- a/Eigen/src/Core/CommaInitializer.h +++ b/Eigen/src/Core/CommaInitializer.h @@ -103,7 +103,7 @@ struct CommaInitializer EIGEN_DEVICE_FUNC inline ~CommaInitializer() -#if defined VERIFY_RAISES_ASSERT && (!defined EIGEN_NO_ASSERTION_CHECKING) && defined EIGEN_EXCEPTIONS +#if defined VERIFY_RAISES_ASSERT && (!defined EIGEN_NO_ASSERTION_CHECKING) && EIGEN_USE_EXCEPTIONS EIGEN_EXCEPTION_SPEC(Eigen::eigen_assert_exception) #endif { diff --git a/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h b/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h index f81e59db5..9e908fed9 100644 --- a/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +++ b/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h @@ -25,7 +25,7 @@ #define EIGEN_CXX11_TENSOR_TENSOR_SYCL_STORAGE_MEMORY_H #include <CL/sycl.hpp> -#ifdef EIGEN_EXCEPTIONS +#if EIGEN_USE_EXCEPTIONS #include <stdexcept> #endif #include <cstddef> diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index fca94a989..1f90847f9 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -959,9 +959,8 @@ #undef EIGEN_INTERNAL_DEBUGGING #endif - #ifdef EIGEN_EXCEPTIONS - #undef EIGEN_EXCEPTIONS - #endif + #undef EIGEN_USE_EXCEPTIONS + #define EIGEN_USE_EXCEPTIONS 0 #endif #if defined(SYCL_DEVICE_ONLY) @@ -1378,12 +1377,16 @@ namespace Eigen { EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(METHOD,OPNAME) -#if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(EIGEN_CUDA_ARCH) && !defined(EIGEN_EXCEPTIONS) && !defined(EIGEN_USE_SYCL) && !defined(EIGEN_HIP_DEVICE_COMPILE) - #define EIGEN_EXCEPTIONS +#ifndef EIGEN_USE_EXCEPTIONS + #if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(EIGEN_CUDA_ARCH) && !defined(EIGEN_USE_SYCL) && !defined(EIGEN_HIP_DEVICE_COMPILE) + #define EIGEN_USE_EXCEPTIONS 1 + #else + #define EIGEN_USE_EXCEPTIONS 0 + #endif #endif -#ifdef EIGEN_EXCEPTIONS +#if EIGEN_USE_EXCEPTIONS # define EIGEN_THROW_X(X) throw X # define EIGEN_THROW throw # define EIGEN_TRY try diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index 875318cdb..7a8afba99 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -66,7 +66,7 @@ namespace internal { EIGEN_DEVICE_FUNC inline void throw_std_bad_alloc() { - #ifdef EIGEN_EXCEPTIONS + #if EIGEN_USE_EXCEPTIONS throw std::bad_alloc(); #else std::size_t huge = static_cast<std::size_t>(-1); diff --git a/Eigen/src/SparseLU/SparseLU_Memory.h b/Eigen/src/SparseLU/SparseLU_Memory.h index 349bfd585..711cb7ec3 100644 --- a/Eigen/src/SparseLU/SparseLU_Memory.h +++ b/Eigen/src/SparseLU/SparseLU_Memory.h @@ -76,13 +76,11 @@ Index SparseLUImpl<Scalar,StorageIndex>::expand(VectorType& vec, Index& length, old_vec = vec.segment(0,nbElts); //Allocate or expand the current vector -#ifdef EIGEN_EXCEPTIONS - try -#endif + EIGEN_TRY { vec.resize(new_len); } -#ifdef EIGEN_EXCEPTIONS +#if EIGEN_USE_EXCEPTIONS catch(std::bad_alloc& ) #else if(!vec.size()) @@ -107,13 +105,11 @@ Index SparseLUImpl<Scalar,StorageIndex>::expand(VectorType& vec, Index& length, { alpha = (alpha + 1)/2; new_len = (std::max)(length+1,Index(alpha * length)); -#ifdef EIGEN_EXCEPTIONS - try -#endif + EIGEN_TRY { vec.resize(new_len); } -#ifdef EIGEN_EXCEPTIONS +#if EIGEN_USE_EXCEPTIONS catch(std::bad_alloc& ) #else if (!vec.size()) |