Newer
Older
rtlibc / inc / assert.h
/* Copyright (C) Thornwave Labs Inc - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited
 * Proprietary and confidential
 * Written by Razvan Turiac <razvan.turiac@thornwave.com>
 */

#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