The previous err_maxval hardcoded the list of AKERR_* codes, which silently rots the moment a code is added. Instead, parse the generated akerror.h at runtime: discover every "#define AKERR_<NAME> (AKERR_LAST_ERRNO_VALUE + N)", take the highest offset actually defined, and assert AKERR_MAX_ERR_VALUE covers it. A compile-time cross-check ties the parsed ceiling to the compiled macro so the test can't pass by reading a stale header. CMake injects the header path as AKERR_GENERATED_HEADER. Verified: the test fails (max_err_value >= highest_code) when pointed at a +15 header while AKERR_BADEXC is +17, and now also strengthens header mutation coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2.9 KiB
2.9 KiB