From 75f143835e1320f4bb5970e52505482ec9c7a1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 29 Aug 2017 09:52:25 +0200 Subject: [PATCH] Prevent exception translator registration with CATCH_CONFIG_DISABLE --- include/catch.hpp | 2 +- include/internal/catch_interfaces_exception.h | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/catch.hpp b/include/catch.hpp index 956c4b30..d49c7461 100644 --- a/include/catch.hpp +++ b/include/catch.hpp @@ -308,7 +308,7 @@ using Catch::Detail::Approx; #endif -#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) +#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) // "BDD-style" convenience wrappers #define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) ) diff --git a/include/internal/catch_interfaces_exception.h b/include/internal/catch_interfaces_exception.h index 43e4fbf4..40b7e59b 100644 --- a/include/internal/catch_interfaces_exception.h +++ b/include/internal/catch_interfaces_exception.h @@ -8,11 +8,16 @@ #ifndef TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED #define TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED +#include "catch_interfaces_registry_hub.h" + +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \ + static std::string translatorName( signature ) +#endif + #include #include -#include "catch_interfaces_registry_hub.h" - namespace Catch { using exceptionTranslateFunction = std::string(*)();