1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2024-11-29 11:24:14 +01:00
rpi-vk-driver/driver/CustomAssert.h
2018-08-25 11:03:29 +01:00

34 lines
532 B
C

#pragma once
#if defined (__cplusplus)
extern "C" {
#endif
#include <signal.h>
#include <stdio.h>
enum { HAVE_TRAP_INSTRUCTION = 1, };
__attribute__((gnu_inline, always_inline))
__inline__ static void DEBUG_BREAK(void)
{
__asm__ volatile(".inst 0xe7f001f0");
}
#ifdef DEBUG_BUILD
#define assert(expr) \
if( expr ){} \
else \
{ \
printf("Assert failed: %s\n" \
"File: %s\n" \
"Line: %i\n", #expr, __FILE__, __LINE__); \
DEBUG_BREAK(); \
}
#else
#define assert(expr) //do nothing
#endif
#if defined (__cplusplus)
}
#endif