summaryrefslogtreecommitdiff
path: root/src/_assert.h
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2023-11-14 16:31:31 -0500
committerJakob Kaivo <jkk@ung.org>2023-11-14 16:31:31 -0500
commit0030c5ea720f492fcaed2cd5ebb52f7ad54170fd (patch)
tree2c507618e3c22ce1062d823200d0811375797fcd /src/_assert.h
parent88aa612a4e75833368f6c4552d95d1d5c1232555 (diff)
return 0 if c is EOF
Diffstat (limited to 'src/_assert.h')
-rw-r--r--src/_assert.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/_assert.h b/src/_assert.h
index 5e472e89..1d7b1637 100644
--- a/src/_assert.h
+++ b/src/_assert.h
@@ -1,8 +1,9 @@
#ifndef ___ASSERT_H__
#define ___ASSERT_H__
+#include <errno.h>
+#include <stdio.h>
#include "stdlib/_stdlib.h"
-#include "errno/ERANGE.h"
#ifndef NDEBUG
#define ASSERT_NONNULL(__ptr) do { \
@@ -28,9 +29,10 @@
} while (0)
#define ASSERT_REPRESENTABLE(_n, _min, _max, _type, _sentinel) do { \
- if ((_n) != _sentinel && ((_n) < _min || (_n) > _max)) { \
+ if (!(((_n) == (_sentinel)) || (((_min) <= (_n)) && ((_n) <= (_max))))) { \
struct __constraint_info _ci = {0}; \
_ci.func = __func__; \
+ _ci.value = _n; \
__stdlib.constraint_handler("Undefined behavior: " \
"Parameter " #_n " must be representable as a " #_type \
" or be equal to " #_sentinel, &_ci, ERANGE); \