mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-05-13 21:56:42 +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>
|
<p>Move <code>lockRelease()</code> to the end of <code>exitSafe()</code>.</p>
|
||||||
</release-item>
|
</release-item>
|
||||||
|
|
||||||
|
<release-item>
|
||||||
|
<p>Add <code>CHECK()</code> macro for production assertions.</p>
|
||||||
|
</release-item>
|
||||||
|
|
||||||
<release-item>
|
<release-item>
|
||||||
<p>Automatically generate constants for command and option names.</p>
|
<p>Automatically generate constants for command and option names.</p>
|
||||||
</release-item>
|
</release-item>
|
||||||
|
@ -21,5 +21,15 @@ Asserts are used in test code to ensure that certain conditions are true. They
|
|||||||
#define ASSERT(condition)
|
#define ASSERT(condition)
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user