bug #1109: use noexcept instead of throw for C++11 compilers
This commit is contained in:
		
							parent
							
								
									145ad5d800
								
							
						
					
					
						commit
						e73ef4f25e
					
				| @ -106,7 +106,7 @@ struct CommaInitializer | |||||||
|   EIGEN_DEVICE_FUNC |   EIGEN_DEVICE_FUNC | ||||||
|   inline ~CommaInitializer() |   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) && defined EIGEN_EXCEPTIONS | ||||||
|   throw(Eigen::eigen_assert_exception) |   EIGEN_EXCEPTION_SPEC(Eigen::eigen_assert_exception) | ||||||
| #endif | #endif | ||||||
|   { |   { | ||||||
|     eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows() |     eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows() | ||||||
|  | |||||||
| @ -365,7 +365,7 @@ | |||||||
| // Does the compiler support C++11 math?
 | // Does the compiler support C++11 math?
 | ||||||
| // Let's be conservative and enable the default C++11 implementation only if we are sure it exists
 | // Let's be conservative and enable the default C++11 implementation only if we are sure it exists
 | ||||||
| #ifndef EIGEN_HAS_CXX11_MATH | #ifndef EIGEN_HAS_CXX11_MATH | ||||||
|   #if (__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC)  \ |   #if (__cplusplus > 201103L) || (__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC)  \ | ||||||
|       && (EIGEN_ARCH_i386_OR_x86_64) && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC) |       && (EIGEN_ARCH_i386_OR_x86_64) && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC) | ||||||
|     #define EIGEN_HAS_CXX11_MATH 1 |     #define EIGEN_HAS_CXX11_MATH 1 | ||||||
|   #else |   #else | ||||||
| @ -375,13 +375,26 @@ | |||||||
| 
 | 
 | ||||||
| // Does the compiler support proper C++11 containers?
 | // Does the compiler support proper C++11 containers?
 | ||||||
| #ifndef EIGEN_HAS_CXX11_CONTAINERS | #ifndef EIGEN_HAS_CXX11_CONTAINERS | ||||||
|   #if ((__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG)) || EIGEN_COMP_MSVC >= 1900 |   #if    (__cplusplus > 201103L) \ | ||||||
|  |       || ((__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_ICC>=1400)) \ | ||||||
|  |       || EIGEN_COMP_MSVC >= 1900 | ||||||
|     #define EIGEN_HAS_CXX11_CONTAINERS 1 |     #define EIGEN_HAS_CXX11_CONTAINERS 1 | ||||||
|   #else |   #else | ||||||
|     #define EIGEN_HAS_CXX11_CONTAINERS 0 |     #define EIGEN_HAS_CXX11_CONTAINERS 0 | ||||||
|   #endif |   #endif | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | // Does the compiler support C++11 noexcept?
 | ||||||
|  | #ifndef EIGEN_HAS_CXX11_NOEXCEPT | ||||||
|  |   #if    (__cplusplus > 201103L) \ | ||||||
|  |       || ((__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_ICC>=1400)) \ | ||||||
|  |       || EIGEN_COMP_MSVC >= 1900 | ||||||
|  |     #define EIGEN_HAS_CXX11_NOEXCEPT 1 | ||||||
|  |   #else | ||||||
|  |     #define EIGEN_HAS_CXX11_NOEXCEPT 0 | ||||||
|  |   #endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| /** Allows to disable some optimizations which might affect the accuracy of the result.
 | /** Allows to disable some optimizations which might affect the accuracy of the result.
 | ||||||
|   * Such optimization are enabled by default, and set EIGEN_FAST_MATH to 0 to disable them. |   * Such optimization are enabled by default, and set EIGEN_FAST_MATH to 0 to disable them. | ||||||
|   * They currently include: |   * They currently include: | ||||||
| @ -842,4 +855,12 @@ namespace Eigen { | |||||||
| #  define EIGEN_CATCH(X) else | #  define EIGEN_CATCH(X) else | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #if EIGEN_HAS_CXX11_NOEXCEPT | ||||||
|  | #   define EIGEN_NO_THROW noexcept(true) | ||||||
|  | #   define EIGEN_EXCEPTION_SPEC(X) noexcept(false) | ||||||
|  | #else | ||||||
|  | #   define EIGEN_NO_THROW throw() | ||||||
|  | #   define EIGEN_EXCEPTION_SPEC(X) throw(X) | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #endif // EIGEN_MACROS_H
 | #endif // EIGEN_MACROS_H
 | ||||||
|  | |||||||
| @ -732,7 +732,7 @@ template<typename T> void swap(scoped_array<T> &a,scoped_array<T> &b) | |||||||
| 
 | 
 | ||||||
| #if EIGEN_MAX_ALIGN_BYTES!=0 | #if EIGEN_MAX_ALIGN_BYTES!=0 | ||||||
|   #define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \ |   #define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \ | ||||||
|       void* operator new(size_t size, const std::nothrow_t&) throw() { \ |       void* operator new(size_t size, const std::nothrow_t&) EIGEN_NO_THROW { \ | ||||||
|         EIGEN_TRY { return Eigen::internal::conditional_aligned_malloc<NeedsToAlign>(size); } \ |         EIGEN_TRY { return Eigen::internal::conditional_aligned_malloc<NeedsToAlign>(size); } \ | ||||||
|         EIGEN_CATCH (...) { return 0; } \ |         EIGEN_CATCH (...) { return 0; } \ | ||||||
|       } |       } | ||||||
| @ -743,20 +743,20 @@ template<typename T> void swap(scoped_array<T> &a,scoped_array<T> &b) | |||||||
|       void *operator new[](size_t size) { \ |       void *operator new[](size_t size) { \ | ||||||
|         return Eigen::internal::conditional_aligned_malloc<NeedsToAlign>(size); \ |         return Eigen::internal::conditional_aligned_malloc<NeedsToAlign>(size); \ | ||||||
|       } \ |       } \ | ||||||
|       void operator delete(void * ptr) throw() { Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); } \ |       void operator delete(void * ptr) EIGEN_NO_THROW { Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); } \ | ||||||
|       void operator delete[](void * ptr) throw() { Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); } \ |       void operator delete[](void * ptr) EIGEN_NO_THROW { Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); } \ | ||||||
|       void operator delete(void * ptr, std::size_t /* sz */) throw() { Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); } \ |       void operator delete(void * ptr, std::size_t /* sz */) EIGEN_NO_THROW { Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); } \ | ||||||
|       void operator delete[](void * ptr, std::size_t /* sz */) throw() { Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); } \ |       void operator delete[](void * ptr, std::size_t /* sz */) EIGEN_NO_THROW { Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); } \ | ||||||
|       /* in-place new and delete. since (at least afaik) there is no actual   */ \ |       /* in-place new and delete. since (at least afaik) there is no actual   */ \ | ||||||
|       /* memory allocated we can safely let the default implementation handle */ \ |       /* memory allocated we can safely let the default implementation handle */ \ | ||||||
|       /* this particular case. */ \ |       /* this particular case. */ \ | ||||||
|       static void *operator new(size_t size, void *ptr) { return ::operator new(size,ptr); } \ |       static void *operator new(size_t size, void *ptr) { return ::operator new(size,ptr); } \ | ||||||
|       static void *operator new[](size_t size, void* ptr) { return ::operator new[](size,ptr); } \ |       static void *operator new[](size_t size, void* ptr) { return ::operator new[](size,ptr); } \ | ||||||
|       void operator delete(void * memory, void *ptr) throw() { return ::operator delete(memory,ptr); } \ |       void operator delete(void * memory, void *ptr) EIGEN_NO_THROW { return ::operator delete(memory,ptr); } \ | ||||||
|       void operator delete[](void * memory, void *ptr) throw() { return ::operator delete[](memory,ptr); } \ |       void operator delete[](void * memory, void *ptr) EIGEN_NO_THROW { return ::operator delete[](memory,ptr); } \ | ||||||
|       /* nothrow-new (returns zero instead of std::bad_alloc) */ \ |       /* nothrow-new (returns zero instead of std::bad_alloc) */ \ | ||||||
|       EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \ |       EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \ | ||||||
|       void operator delete(void *ptr, const std::nothrow_t&) throw() { \ |       void operator delete(void *ptr, const std::nothrow_t&) EIGEN_NO_THROW { \ | ||||||
|         Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); \ |         Eigen::internal::conditional_aligned_free<NeedsToAlign>(ptr); \ | ||||||
|       } \ |       } \ | ||||||
|       typedef void eigen_aligned_operator_new_marker_type; |       typedef void eigen_aligned_operator_new_marker_type; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Gael Guennebaud
						Gael Guennebaud