mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 12:17:11 +01:00 
			
		
		
		
	Don't use exception-related std:: functions with -fno-exceptions
This doesn't cause trouble with GCC/Clang and libstdc++, but IAR and its stdlib apparently doesn't compile when you use `fno-exceptions` and `std::current_exception`/`std::rethrow_exception`. Fixes #1462
This commit is contained in:
		| @@ -67,17 +67,23 @@ namespace Catch { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     std::string ExceptionTranslatorRegistry::tryTranslators() const { | ||||
|         if (m_translators.empty()) { | ||||
|             std::rethrow_exception(std::current_exception()); | ||||
|         } else { | ||||
|             return m_translators[0]->translate(m_translators.begin() + 1, m_translators.end()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| #else // ^^ Exceptions are enabled // Exceptions are disabled vv | ||||
|     std::string ExceptionTranslatorRegistry::translateActiveException() const { | ||||
|         CATCH_INTERNAL_ERROR("Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); | ||||
|     } | ||||
|  | ||||
|     std::string ExceptionTranslatorRegistry::tryTranslators() const { | ||||
|         CATCH_INTERNAL_ERROR("Attempted to use exception translators under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); | ||||
|     } | ||||
| #endif | ||||
|  | ||||
|  | ||||
|     std::string ExceptionTranslatorRegistry::tryTranslators() const { | ||||
|         if( m_translators.empty() ) | ||||
|             std::rethrow_exception(std::current_exception()); | ||||
|         else | ||||
|             return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() ); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský