Created
April 13, 2016 00:32
-
-
Save springmeyer/0913a311919fd4e95e6651475fe4f508 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test/catch.hpp b/test/catch.hpp | |
index 391c7ab..7f96d25 100644 | |
--- a/test/catch.hpp | |
+++ b/test/catch.hpp | |
@@ -5140,8 +5140,6 @@ namespace Catch { | |
} // namespace Catch | |
-#if defined ( CATCH_PLATFORM_WINDOWS ) ///////////////////////////////////////// | |
- | |
namespace Catch { | |
struct FatalConditionHandler { | |
@@ -5150,54 +5148,6 @@ namespace Catch { | |
} // namespace Catch | |
-#else // Not Windows - assumed to be POSIX compatible ////////////////////////// | |
- | |
-#include <signal.h> | |
- | |
-namespace Catch { | |
- | |
- struct SignalDefs { int id; const char* name; }; | |
- extern SignalDefs signalDefs[]; | |
- SignalDefs signalDefs[] = { | |
- { SIGINT, "SIGINT - Terminal interrupt signal" }, | |
- { SIGILL, "SIGILL - Illegal instruction signal" }, | |
- { SIGFPE, "SIGFPE - Floating point error signal" }, | |
- { SIGSEGV, "SIGSEGV - Segmentation violation signal" }, | |
- { SIGTERM, "SIGTERM - Termination request signal" }, | |
- { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" } | |
- }; | |
- | |
- struct FatalConditionHandler { | |
- | |
- static void handleSignal( int sig ) { | |
- for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) | |
- if( sig == signalDefs[i].id ) | |
- fatal( signalDefs[i].name, -sig ); | |
- fatal( "<unknown signal>", -sig ); | |
- } | |
- | |
- FatalConditionHandler() : m_isSet( true ) { | |
- for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) | |
- signal( signalDefs[i].id, handleSignal ); | |
- } | |
- ~FatalConditionHandler() { | |
- reset(); | |
- } | |
- void reset() { | |
- if( m_isSet ) { | |
- for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) | |
- signal( signalDefs[i].id, SIG_DFL ); | |
- m_isSet = false; | |
- } | |
- } | |
- | |
- bool m_isSet; | |
- }; | |
- | |
-} // namespace Catch | |
- | |
-#endif // not Windows | |
- | |
#include <set> | |
#include <string> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment