/**
* @file osw_assert.h
*
* Copyright (c) 2003 - 2015 Nomura Kei
* License : The MIT License <http://opensource.org/licenses/mit-license.php>
*/
#ifndef OSW_ASSERT_H
#define OSW_ASSERT_H
#ifdef NDEBUG
/**
* 指定された expression が偽の場合, プログラムを停止します.
* <osw_assert.h> が最後にインクルードされた時点で NDEBUG マクロが定義されている場合,
* osw_assert() マクロは何のコードも生成しません。
*
* @param expression 診断する値
*/
#define osw_assert(expression) ((void) expression)
#else
/**
* 指定された expression が偽の場合, プログラムを停止します.
* <osw_assert.h> が最後にインクルードされた時点で NDEBUG マクロが定義されている場合,
* osw_assert() マクロは何のコードも生成しません。
*
* @param expression 診断する値
*/
#define osw_assert(expression) \
(expression) ? ((void) 0) : osw_assert_exec(__FILE__, __LINE__, #expression)
#ifdef __cplusplus
extern "C" {
#endif
void osw_assert_exec(const char* file, int line, const char* expression);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* NDEBUG */
#endif /* OSW_ASSERT_H */