summaryrefslogtreecommitdiff
path: root/src/nonstd/ASSERT_NONNULL.c
blob: 26a6138ed66a256c8c92342f09a342d0edb758f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <nonstd/assert.h>

#ifndef NDEBUG
#define ASSERT_NONNULL(__ptr) do { \
	if (!__ptr) { \
		struct __constraint_info _ci = {0}; \
		_ci.func = __func__; \
		__libc.stdlib.constraint_handler("Undefined behavior: " \
			"Parameter " #__ptr " can not be NULL", &_ci, EFAULT); \
	} \
	} while (0)
#else
#define ASSERT_NONNULL(x)
#endif