1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2024-12-10 22:24:14 +01:00
rpi-vk-driver/driver/CustomAssert.h

34 lines
541 B
C
Raw Normal View History

2018-05-10 23:10:35 +02:00
#pragma once
2018-05-13 16:29:15 +02:00
#if defined (__cplusplus)
extern "C" {
#endif
2018-05-10 23:10:35 +02:00
#include <signal.h>
2018-08-25 12:03:29 +02:00
#include <stdio.h>
2018-05-10 23:10:35 +02:00
enum { HAVE_TRAP_INSTRUCTION = 1, };
__attribute__((gnu_inline, always_inline))
__inline__ static void DEBUG_BREAK(void)
{
__asm__ volatile(".inst 0xe7f001f0");
}
#ifdef DEBUG_BUILD
2018-05-13 20:29:47 +02:00
#define assert(expr) \
if( expr ){} \
else \
{ \
2019-09-07 18:41:46 +02:00
fprintf(stderr, "Assert failed: %s\n" \
2018-05-13 20:29:47 +02:00
"File: %s\n" \
"Line: %i\n", #expr, __FILE__, __LINE__); \
DEBUG_BREAK(); \
}
2018-05-10 23:10:35 +02:00
#else
2018-05-13 20:29:47 +02:00
#define assert(expr) //do nothing
2018-05-10 23:10:35 +02:00
#endif
2018-05-13 16:29:15 +02:00
#if defined (__cplusplus)
}
#endif