aboutsummaryrefslogtreecommitdiff
path: root/lib/strerror.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/strerror.c')
-rw-r--r--lib/strerror.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/strerror.c b/lib/strerror.c
index 3cdecae..3720f57 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -3,12 +3,14 @@
EXPORT
const char *substitute_strerror(int err) {
- #define CASE(code) case code: return #code
+ #define CASE(code) case code: (void) __COUNTER__; return #code
switch (err) {
/* substitute.h */
+ enum { _start = __COUNTER__ };
CASE(SUBSTITUTE_OK);
CASE(SUBSTITUTE_ERR_FUNC_TOO_SHORT);
CASE(SUBSTITUTE_ERR_FUNC_BAD_INSN_AT_START);
+ CASE(SUBSTITUTE_ERR_FUNC_CALLS_AT_START);
CASE(SUBSTITUTE_ERR_FUNC_JUMPS_TO_START);
CASE(SUBSTITUTE_ERR_OOM);
CASE(SUBSTITUTE_ERR_VM);
@@ -18,6 +20,9 @@ const char *substitute_strerror(int err) {
CASE(SUBSTITUTE_ERR_UNKNOWN_RELOCATION_TYPE);
CASE(SUBSTITUTE_ERR_NO_SUCH_SELECTOR);
CASE(SUBSTITUTE_ERR_ADJUSTING_THREADS);
+ _Static_assert(__COUNTER__ - _start ==
+ _SUBSTITUTE_CURRENT_MAX_ERR_PLUS_ONE + 1,
+ "not all errors named in strerror.c");
/* substitute-internal.h */
CASE(SUBSTITUTE_ERR_TASK_FOR_PID);
CASE(SUBSTITUTE_ERR_MISC);