|
#define | EXCEPTION_ASSERTION_FAILED 0x8000 |
|
#define | LACF_CRASH() |
|
#define | VERIFY(x) VERIFY_MSG(x, "%s", "") |
|
#define | VERIFY_MSG(x, fmt, ...) |
|
#define | VERIFY3_impl(x, op, y, type, fmt) |
|
#define | VERIFY3S(x, op, y) VERIFY3_impl(x, op, y, long, "%lu") |
|
#define | VERIFY3U(x, op, y) VERIFY3_impl(x, op, y, unsigned long long, "0x%llx") |
|
#define | VERIFY3F(x, op, y) VERIFY3_impl(x, op, y, double, "%f") |
|
#define | VERIFY3P(x, op, y) VERIFY3_impl(x, op, y, void *, "%p") |
|
#define | VERIFY0(x) VERIFY3S((x), ==, 0) |
|
#define | VERIFY_FAIL() |
|
#define | ASSERT(x) LACF_UNUSED(x) |
|
#define | ASSERT3S(x, op, y) do { LACF_UNUSED(x); LACF_UNUSED(y); } while (0) |
|
#define | ASSERT3U(x, op, y) do { LACF_UNUSED(x); LACF_UNUSED(y); } while (0) |
|
#define | ASSERT3F(x, op, y) do { LACF_UNUSED(x); LACF_UNUSED(y); } while (0) |
|
#define | ASSERT3P(x, op, y) do { LACF_UNUSED(x); LACF_UNUSED(y); } while (0) |
|
#define | ASSERT0(x) LACF_UNUSED(x) |
|
#define | ASSERT_MSG(x, fmt, ...) LACF_UNUSED(x) |
|
This is the master assertion checking machinery of libacfutils.
The macros in this module are designed to provide error checking and crash log generation. The majority of the time, you will be using the ASSERT*
family of macros, to create assertion checks. If the condition in the macro argument fails, the check generates a crash, file + line number reference and backtrace, all of which will be logged. After this, the application exits. ASSERT
macros are only compiled into your code if the DEBUG
macro is defined during compilation. If you want to generate a an assertion check that is always compiled in, use the VERIFY*
family of macros.
Definition in file assert.h.
ASSERT() and VERIFY() are assertion test macros. If the condition expression provided as the argument to the macro evaluates as non-true, the program prints a debug message specifying exactly where and what condition was violated, a stack backtrace and a dumps core by calling LACF_CRASH() (which calls abort() on macOS/Linux and generates an assertion failure exception on Windows).
The difference between ASSERT and VERIFY is that ASSERT compiles to a no-op unless -DDEBUG
is provided to the compiler. VERIFY always checks its condition and dumps if it is non-true.
Definition at line 78 of file assert.h.
#define VERIFY3S |
( |
|
x, |
|
|
|
op, |
|
|
|
y |
|
) |
| VERIFY3_impl(x, op, y, long, "%lu") |
Provides a more convenient macro for assertions checks of signed integer comparisons ("3S" = 3 arguments, Signed integer). The first and last argument are expected to be integer values, and the middle a comparison operator, such as ==
or >
, placed between the two operands. If the comparison fails, this macro prints not only the condition that failed, but also what the numerical values of the first and last argument were, to aid in crash analysis. For example:
int foo = 100, bar = 50;
#define VERIFY3S(x, op, y)
will print "assertion foo < bar failed (100 < 50)".
Definition at line 125 of file assert.h.