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

View File

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