mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 16:55:58 +00:00
Add conditional assert
This commit is contained in:
parent
de4f610843
commit
e8cbdf261c
@ -72,6 +72,21 @@ namespace sta
|
||||
* @param msg Message shown on failure
|
||||
*/
|
||||
# define STA_ASSERT_MSG(expr, msg) ((void)(!(expr) && (sta::assert_failed(msg, __FILE__, __LINE__), 1) && (STA_HALT(), 1)))
|
||||
/**
|
||||
* @brief Assert expression if condition is true.
|
||||
*
|
||||
* @param cond Condition
|
||||
* @param expr Expression
|
||||
*/
|
||||
# define STA_ASSERT_COND(cond, expr) ((void)((cond) ? STA_ASSERT(expr) : 1))
|
||||
/**
|
||||
* @brief Assert expression if condition is true.
|
||||
*
|
||||
* @param cond Condition
|
||||
* @param expr Expression
|
||||
* @param msg Message shown on failure
|
||||
*/
|
||||
# define STA_ASSERT_COND_MSG(cond, expr, msg) ((void)((cond) ? STA_ASSERT_MSG(expr, msg)))
|
||||
|
||||
#else // !STA_ASSERT_ENABLE
|
||||
|
||||
@ -88,6 +103,21 @@ namespace sta
|
||||
* @param msg Message shown on failure
|
||||
*/
|
||||
# define STA_ASSERT_MSG(expr, msg) ((void)0)
|
||||
/**
|
||||
* @brief Assert expression if condition is true.
|
||||
*
|
||||
* @param cond Condition
|
||||
* @param expr Expression
|
||||
*/
|
||||
# define STA_ASSERT_COND(cond, expr) ((void)0)
|
||||
/**
|
||||
* @brief Assert expression if condition is true.
|
||||
*
|
||||
* @param cond Condition
|
||||
* @param expr Expression
|
||||
* @param msg Message shown on failure
|
||||
*/
|
||||
# define STA_ASSERT_COND_MSG(cond, expr, msg) ((void)0)
|
||||
|
||||
#endif // !STA_ASSERT_ENABLE
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user