Allow messages for not_implemented errors

This commit is contained in:
Danny Robson 2012-06-04 14:50:58 +10:00
parent e889aa35b4
commit 3c0368e74c
2 changed files with 18 additions and 5 deletions

View File

@ -28,6 +28,7 @@
using namespace std;
//------------------------------------------------------------------------------
void
panic (const std::string& what) {
breakpoint ();
@ -40,6 +41,8 @@ void
panic (void)
{ panic ("NFI"); }
//------------------------------------------------------------------------------
#if defined(PLATFORM_WIN32)
#include <windows.h>
void
@ -58,11 +61,20 @@ breakpoint (void) {
#endif
//------------------------------------------------------------------------------
void
not_implemented (void)
{ panic ("Function not implemented"); }
not_implemented (void) {
static const char *MSG = "Function not implemented";
not_implemented (MSG);
}
void
not_implemented (const char *msg)
{ panic (msg); }
//------------------------------------------------------------------------------
void
unreachable (void) {
panic ("Unreachable code executed");
@ -75,15 +87,16 @@ unreachable (const std::string& what) {
}
//------------------------------------------------------------------------------
void
unusual (void) {
panic ("Unusual code path found.");
}
//------------------------------------------------------------------------------
#if defined(PLATFORM_LINUX)
#include <fenv.h>
void
enable_fpe (void) {
feenableexcept (FE_DIVBYZERO | FE_INVALID);
@ -113,5 +126,4 @@ disable_fpe (void) {
// unsigned int ignored;
// _controlfp_s (&ignored, 0, _MCW_EM);
}
#endif

View File

@ -153,8 +153,9 @@ class panic_error {
void panic (const std::string&) terminal;
void panic (void) terminal;
void not_implemented (void) terminal;
void not_implemented (const char*) terminal;
void unreachable (void) terminal;
void unreachable (const std::string&) terminal;
void unusual (void);