Newer
Older
rtlibc / inc / assert.h
@Razvan Turiac Razvan Turiac on 19 Dec 2019 614 bytes Improved code.
#ifndef _RTLIBC_ASSERT_H
#define _RTLIBC_ASSERT_H


#include <stdint.h>


#ifdef __cplusplus
extern "C"
{
#endif


#ifdef _RTLIBC_ASSERT_

#define assert(condition) if (!(condition)) rtlibc_assert_failed_handler(#condition, __FILE__, __LINE__)
#define assert_msg(condition, message) if (!(condition)) rtlibc_assert_failed_handler(message, __FILE__, __LINE__)

void rtlibc_assert_failed_handler(const char *message, const char *file_name, uint32_t line_no);

#else

#define assert(condition) (void)(condition)
#define assert_msg(condition, message) (void)(condition)

#endif


#ifdef __cplusplus
}
#endif


#endif