From 27e7fd18f1c337c409f2a567697b27bcd0c09f8b Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Wed, 7 Jul 2021 17:12:12 -0400 Subject: Support manually disabling exceptions Rename EIGEN_EXCEPTIONS to EIGEN_USE_EXCEPTIONS, and allow disabling exceptions with -DEIGEN_USE_EXCEPTIONS=0. --- Eigen/src/Core/util/Macros.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'Eigen/src/Core/util/Macros.h') 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 -- cgit v1.2.3