mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-10-22 15:11:51 +02:00
Add asm_assert macro
This commit is contained in:
parent
c9f22468ce
commit
46c25e83bc
|
@ -346,9 +346,13 @@ void ASM::Refresh() {
|
|||
}
|
||||
}
|
||||
|
||||
void ASM::asm_assert(bool condition) {
|
||||
void ASM::_asm_assert(bool condition, const char* msg) {
|
||||
if (!condition) {
|
||||
// TODO: Handle better
|
||||
|
||||
if (msg)
|
||||
NRF_LOG_ERROR("Assertion failed: %s", msg);
|
||||
|
||||
for (;;) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,14 @@
|
|||
#include <memory>
|
||||
#include <chrono>
|
||||
|
||||
#if DEBUG
|
||||
#define STRINGIZE_DETAIL(x) #x
|
||||
#define STRINGIZE(x) STRINGIZE_DETAIL(x)
|
||||
#define asm_assert(condition) _asm_assert(condition, __FILE__ ":" STRINGIZE(__LINE__) " " #condition)
|
||||
#else
|
||||
#define asm_assert(condition) _asm_assert(condition, NULL)
|
||||
#endif
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
|
@ -199,7 +207,7 @@ namespace Pinetime {
|
|||
bool showingStatusIcons = false;
|
||||
|
||||
void run();
|
||||
void asm_assert(bool condition);
|
||||
void _asm_assert(bool condition, const char* msg);
|
||||
|
||||
std::shared_ptr<Value> pop() {
|
||||
asm_assert(stack_pointer > 0);
|
||||
|
|
Loading…
Reference in a new issue