summaryrefslogtreecommitdiff
path: root/src/_assert.h
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2023-11-27 14:08:35 -0500
committerJakob Kaivo <jkk@ung.org>2023-11-27 14:08:35 -0500
commit43bc9bea0773cce280c4d4442a494fe24f8e92bd (patch)
tree3fbc8ec51783b86d6eb8fbfc2ddc14d2fc46c40f /src/_assert.h
parent4d16801b9a6727d39a49dde70daa29eeac15a16c (diff)
add framework for marking function call location in diagnostics
Diffstat (limited to 'src/_assert.h')
-rw-r--r--src/_assert.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/_assert.h b/src/_assert.h
index 1d7b1637..2466455f 100644
--- a/src/_assert.h
+++ b/src/_assert.h
@@ -5,13 +5,22 @@
#include <stdio.h>
#include "stdlib/_stdlib.h"
+#ifdef THREADS
+_Thread_local
+#endif
+extern struct __checked_call {
+ char *file;
+ char *func;
+ unsigned long long line;
+} __checked_call;
+
#ifndef NDEBUG
#define ASSERT_NONNULL(__ptr) do { \
if (!__ptr) { \
struct __constraint_info _ci = {0}; \
_ci.func = __func__; \
__stdlib.constraint_handler("Undefined behavior: " \
- "Parameter " #__ptr " can not be NULL", &_ci, EFAULT); \
+ "Parameter " #__ptr " can not be NULL", &_ci, 0 /* was EFAULT */); \
} \
} while (0)