Move __check_failed to Log.cpp so it can be logged across all backends
This commit is contained in:
parent
1d51935d43
commit
29dad5651d
@ -1,4 +1,5 @@
|
|||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
#include "arch/CPU.h"
|
||||||
#include "arch/Serial.h"
|
#include "arch/Serial.h"
|
||||||
#include "arch/Timer.h"
|
#include "arch/Timer.h"
|
||||||
#include "video/TextConsole.h"
|
#include "video/TextConsole.h"
|
||||||
@ -112,4 +113,16 @@ bool log_serial_enabled()
|
|||||||
bool log_text_console_enabled()
|
bool log_text_console_enabled()
|
||||||
{
|
{
|
||||||
return g_text_console_enabled;
|
return g_text_console_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool g_check_already_failed = false;
|
||||||
|
|
||||||
|
_noreturn bool __check_failed(const char* file, const char* line, const char* func, const char* expr)
|
||||||
|
{
|
||||||
|
if (!g_check_already_failed)
|
||||||
|
{ // Avoid endlessly failing when trying to report a failed check.
|
||||||
|
g_check_already_failed = true;
|
||||||
|
kerrorln("ERROR: Check failed at %s:%s, in %s: %s", file, line, func, expr);
|
||||||
|
}
|
||||||
|
CPU::efficient_halt();
|
||||||
}
|
}
|
@ -34,16 +34,4 @@ namespace Serial
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static bool g_check_already_failed = false;
|
|
||||||
|
|
||||||
_noreturn bool __check_failed(const char* file, const char* line, const char* func, const char* expr)
|
|
||||||
{
|
|
||||||
if (!g_check_already_failed)
|
|
||||||
{ // Avoid endlessly failing when trying to report a failed check.
|
|
||||||
g_check_already_failed = true;
|
|
||||||
Serial::printf("ERROR: Check failed at %s:%s, in %s: %s\n", file, line, func, expr);
|
|
||||||
}
|
|
||||||
CPU::efficient_halt();
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user