Release ignored error contexts
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
#include "akerror.h"
|
||||
#include "err_capture.h"
|
||||
|
||||
/*
|
||||
* IGNORE deliberately swallows an error: it records the context in
|
||||
* __akerr_last_ignored, logs it with an "IGNORED ERROR" marker, and lets
|
||||
* execution continue.
|
||||
*/
|
||||
/* IGNORE logs and releases an error, then lets execution continue. */
|
||||
|
||||
akerr_ErrorContext *boom(void)
|
||||
{
|
||||
@@ -21,11 +17,15 @@ int main(void)
|
||||
PREPARE_ERROR(e);
|
||||
(void)e;
|
||||
|
||||
IGNORE(boom());
|
||||
/* More failures than the pool has slots must remain safe: a leaking
|
||||
* IGNORE used to exhaust the pool and terminate the process here. */
|
||||
for ( int i = 0; i < AKERR_MAX_ARRAY_ERROR + 1; i++ ) {
|
||||
IGNORE(boom());
|
||||
AKERR_CHECK(__akerr_last_ignored == NULL);
|
||||
AKERR_CHECK(akerr_slots_in_use() == 0);
|
||||
}
|
||||
reached_after_ignore = 1;
|
||||
|
||||
AKERR_CHECK(__akerr_last_ignored != NULL);
|
||||
AKERR_CHECK(__akerr_last_ignored->status == AKERR_VALUE);
|
||||
AKERR_CHECK(reached_after_ignore == 1);
|
||||
AKERR_CHECK_CONTAINS("IGNORED ERROR");
|
||||
AKERR_CHECK_CONTAINS("this error is ignored on purpose");
|
||||
|
||||
Reference in New Issue
Block a user