#include <stdio.h>
Go to the source code of this file.
|
| #define | die(msg) yac_abort_message((msg), __FILE__, __LINE__) |
| |
| #define | YAC_ASSERT(exp, msg) YAC_ASSERT_F((exp), "%s", (msg)) |
| |
| #define | YAC_ASSERT_FUNC(exp, func, msg) YAC_ASSERT_F_FUNC((exp), (func), "%s", (msg)) |
| |
| #define | YAC_ASSERT_F(exp, format, ...) YAC_ASSERT_F_FUNC((exp), __func__, format, ##__VA_ARGS__) |
| |
| #define | YAC_ASSERT_F_FUNC(exp, func, format, ...) |
| |
| #define | YAC_UNREACHABLE_DEFAULT(msg) |
| |
| #define | YAC_UNREACHABLE_DEFAULT_F_FUNC(func, format, ...) |
| |
| #define | YAC_UNREACHABLE_DEFAULT_F(format, ...) YAC_UNREACHABLE_DEFAULT_F_FUNC(__func__, format, ##__VA_ARGS__) |
| |
| #define | YAC_UNREACHABLE(msg) YAC_ASSERT(0, (msg)); |
| |
| #define | YAC_UNREACHABLE_F(format, ...) YAC_ASSERT_F(0, format, ##__VA_ARGS__) |
| |
◆ die
◆ YAC_ASSERT
| #define YAC_ASSERT |
( |
| exp, |
|
|
| msg ) YAC_ASSERT_F((exp), "%s", (msg)) |
◆ YAC_ASSERT_F
| #define YAC_ASSERT_F |
( |
| exp, |
|
|
| format, |
|
|
| ... ) YAC_ASSERT_F_FUNC((exp), __func__, format, ##__VA_ARGS__) |
◆ YAC_ASSERT_F_FUNC
| #define YAC_ASSERT_F_FUNC |
( |
| exp, |
|
|
| func, |
|
|
| format, |
|
|
| ... ) |
Value: { \
if(!((exp))) { \
char msg_buffer[1024]; \
int ret = snprintf( \
msg_buffer, sizeof(msg_buffer), \
"ERROR(%s): " format, (func), ##__VA_ARGS__); \
if ((ret >= 0) && ((size_t)ret < sizeof(msg_buffer))) \
die(msg_buffer); \
else \
die("an error occurred, but error message could not be generated"); \
} \
}
Definition at line 42 of file yac_assert.h.
◆ YAC_ASSERT_FUNC
| #define YAC_ASSERT_FUNC |
( |
| exp, |
|
|
| func, |
|
|
| msg ) YAC_ASSERT_F_FUNC((exp), (func), "%s", (msg)) |
◆ YAC_UNREACHABLE
| #define YAC_UNREACHABLE |
( |
| msg | ) |
YAC_ASSERT(0, (msg)); |
◆ YAC_UNREACHABLE_DEFAULT
| #define YAC_UNREACHABLE_DEFAULT |
( |
| msg | ) |
|
Value: default: \
{ \
YAC_UNREACHABLE(msg); \
__attribute__((fallthrough)); \
}
Definition at line 56 of file yac_assert.h.
◆ YAC_UNREACHABLE_DEFAULT_F
◆ YAC_UNREACHABLE_DEFAULT_F_FUNC
| #define YAC_UNREACHABLE_DEFAULT_F_FUNC |
( |
| func, |
|
|
| format, |
|
|
| ... ) |
Value: default: \
{ \
char msg_buffer[1024]; \
int ret = snprintf( \
msg_buffer, sizeof(msg_buffer), \
"ERROR(%s): " format, (func), ##__VA_ARGS__); \
if ((ret >= 0) && ((size_t)ret < sizeof(msg_buffer))) \
die(msg_buffer); \
else \
die("an error occurred, but error message could not be generated"); \
__attribute__((fallthrough)); \
}
Definition at line 63 of file yac_assert.h.
◆ YAC_UNREACHABLE_F
| #define YAC_UNREACHABLE_F |
( |
| format, |
|
|
| ... ) YAC_ASSERT_F(0, format, ##__VA_ARGS__) |
◆ yac_abort_message()
| void yac_abort_message |
( |
char const * | , |
|
|
char const * | , |
|
|
int | ) |