mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-09-28 21:17:33 +00:00
Add debug assert
This commit is contained in:
29
src/assert.cpp
Normal file
29
src/assert.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <sta/assert.hpp>
|
||||
#ifdef STA_ASSERT_ENABLE
|
||||
|
||||
#include <sta/debug_serial.hpp>
|
||||
#include <sta/lang.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
STA_WEAK
|
||||
void assert_failed(const char * expr, const char * file, uint32_t line)
|
||||
{
|
||||
// printf("%s:%d: Assertion failed: %s", file, line, expr)
|
||||
STA_DEBUG_PRINT(file);
|
||||
STA_DEBUG_PRINT(':');
|
||||
STA_DEBUG_PRINT(line);
|
||||
STA_DEBUG_PRINT(": Assertion failed: ");
|
||||
STA_DEBUG_PRINTLN(expr);
|
||||
}
|
||||
|
||||
STA_WEAK
|
||||
void assert_halt()
|
||||
{
|
||||
while (true);
|
||||
}
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_ASSERT_ENABLE
|
Reference in New Issue
Block a user