1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2024-12-04 16:24:15 +01:00
rpi-vk-driver/driver/CustomAssert.h
2019-09-07 17:41:46 +01:00

34 lines
541 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 \
{ \
fprintf(stderr, "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