mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add some reference code to help improve the CAF_ASSERT at a later point in time.
This commit is contained in:
parent
160b4c263d
commit
7ddd5ca7d7
@ -14,3 +14,51 @@
|
||||
std::abort(); \
|
||||
} \
|
||||
} while(false)
|
||||
|
||||
#if 0 // Bits and pieces for reference to improve the assert
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4668)
|
||||
#include <windows.h>
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
|
||||
void openDebugWindow()
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4996)
|
||||
AllocConsole();
|
||||
freopen("conin$", "r", stdin);
|
||||
freopen("conout$", "w", stdout);
|
||||
freopen("conout$", "w", stderr);
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
void assertAbort()
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
#if (_MSC_VER >= 1600)
|
||||
//if (::IsDebuggerPresent())
|
||||
#endif
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
#endif
|
||||
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
#define ASSERT_TEST(expr) \
|
||||
do \
|
||||
{ \
|
||||
if(!(expr)) \
|
||||
{ \
|
||||
std::cout << __FILE__ << ":" << __LINE__ << ": CAF_ASSERT(" \
|
||||
<< #expr << ") failed" << std::endl; \
|
||||
assertAbort(); \
|
||||
} \
|
||||
} while(false)
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user