From 0030c5ea720f492fcaed2cd5ebb52f7ad54170fd Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 14 Nov 2023 16:31:31 -0500 Subject: return 0 if c is EOF --- src/_assert.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/_assert.h') 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 +#include #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); \ -- cgit v1.2.1