Expose ignored error snapshot
All checks were successful
libakerror CI Build / coverage (push) Successful in 3m18s
libakerror CI Build / cmake_build (push) Successful in 10m11s
libakerror CI Build / mutation_test (push) Successful in 45m33s

Co-Authored-By: Andrew Kesterson <andrew@aklabs.net>
This commit is contained in:
2026-08-04 11:24:30 -04:00
parent 55090d2419
commit 5a269ea01b
8 changed files with 19 additions and 19 deletions

View File

@@ -15,7 +15,7 @@
* scripts/generrno.sh stamps this value in at build time from the AKERR_THREADS
* build option, the same way it stamps AKERR_LAST_ERRNO_VALUE. It is generated
* rather than defined by the consumer on purpose: whether the library
* serializes its global state and whether __akerr_last_ignored is a
* serializes its global state and whether akerr_last_ignored is a
* thread-local are the same decision, and a consumer that disagreed with the
* library about it would link against a differently shaped symbol.
*
@@ -173,12 +173,12 @@ extern akerr_ErrorContext AKERR_ARRAY_ERROR[AKERR_MAX_ARRAY_ERROR];
extern akerr_ErrorUnhandledErrorHandler akerr_handler_unhandled_error;
extern akerr_ErrorLogFunction akerr_log_method;
/*
* IGNORE()'s per-thread snapshot. IGNORE() copies the swallowed error here
* IGNORE()'s public per-thread snapshot. IGNORE() copies the swallowed error here
* before releasing its pool context, so this remains a useful debugging aid
* after the pool slot is reused. The snapshot is read-only and is replaced by
* the next ignored error. Thread local only when AKERR_THREAD_SAFE is 1.
*/
static AKERR_THREAD_LOCAL akerr_ErrorContext __akerr_last_ignored;
static AKERR_THREAD_LOCAL akerr_ErrorContext akerr_last_ignored;
/*
* Drop one reference, returning NULL once the last one is gone so the caller can
@@ -438,12 +438,12 @@ akerr_ErrorContext AKERR_NOIGNORE *__akerr_copy_string(char *destination, int ca
do { \
akerr_ErrorContext *__akerr_ignored = __stmt; \
if ( __akerr_ignored != NULL ) { \
memcpy(&__akerr_last_ignored, __akerr_ignored, \
sizeof(__akerr_last_ignored)); \
__akerr_last_ignored.stacktracebufptr = \
(char *)&__akerr_last_ignored.stacktracebuf; \
memcpy(&akerr_last_ignored, __akerr_ignored, \
sizeof(akerr_last_ignored)); \
akerr_last_ignored.stacktracebufptr = \
(char *)&akerr_last_ignored.stacktracebuf; \
akerr_ErrorContext *__akerr_ignored_snapshot = \
&__akerr_last_ignored; \
&akerr_last_ignored; \
LOG_ERROR_WITH_MESSAGE(__akerr_ignored_snapshot, \
"** IGNORED ERROR **"); \
RELEASE_ERROR(__akerr_ignored); \