mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-30 05:39:12 +02:00
Add CHECK() macro for production assertions.
CHECK() works just like ASSERT() but is kept in production builds.
This commit is contained in:
parent
b258aec0ad
commit
670fa88a98
@ -29,6 +29,10 @@
|
||||
<p>Move <code>lockRelease()</code> to the end of <code>exitSafe()</code>.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Add <code>CHECK()</code> macro for production assertions.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Automatically generate constants for command and option names.</p>
|
||||
</release-item>
|
||||
|
@ -21,5 +21,15 @@ Asserts are used in test code to ensure that certain conditions are true. They
|
||||
#define ASSERT(condition)
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Checks are used in production builds to test very important conditions. Be sure to limit use to the most critical cases.
|
||||
***********************************************************************************************************************************/
|
||||
#define CHECK(condition) \
|
||||
do \
|
||||
{ \
|
||||
if (!(condition)) \
|
||||
THROW_FMT(AssertError, "check '%s' failed", #condition); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user