summaryrefslogtreecommitdiff
path: root/src/fenv/_fenv.h
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-01-31 14:48:09 -0500
committerJakob Kaivo <jkk@ung.org>2024-01-31 14:48:09 -0500
commit78033913abfce71b1bcc075ed188c6b6ec087a13 (patch)
tree2ab38bf89ea46f651c68963c033dac5f345f1e04 /src/fenv/_fenv.h
parent24e5f210091ce984b47fd510217f10245f800f52 (diff)
add checks for valid exception masks
Diffstat (limited to 'src/fenv/_fenv.h')
-rw-r--r--src/fenv/_fenv.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/fenv/_fenv.h b/src/fenv/_fenv.h
new file mode 100644
index 00000000..d07d568f
--- /dev/null
+++ b/src/fenv/_fenv.h
@@ -0,0 +1,16 @@
+#include <fenv.h>
+#include "_safety.h"
+
+#ifdef NDEBUG
+#define ASSERT_VALID_EXCEPTION_MASK(_n) (void)(_n)
+#define ASSERT_PREVIOUS_FEXCEPT(_f, _e) (void)(_f)
+#else
+#define ASSERT_VALID_EXCEPTION_MASK(_n) do { \
+ if (((_n) & ~(FE_ALL_EXCEPT)) != 0) { \
+ __undefined("In call to %s(), exception mask 0x(%jx) is not valid", __func__, (uintmax_t)(_n)); \
+ } \
+} while (0)
+
+/* TODO!!! */
+#define ASSERT_PREVIOUS_FEXCEPT(_f, _e) (void)(_f)
+#endif