add some asserts

This commit is contained in:
Michael Shaw 2023-05-04 02:02:17 -04:00
commit 39c778d2f0
7 changed files with 34 additions and 6 deletions

17
include/assert.h Normal file
View file

@ -0,0 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _ASSERT_H_
#define _ASSERT_H_
#ifdef KDEBUG
#define assert(expr) \
do { \
if (!(expr)) { \
printf(LOG_ERROR "assertion failed: %s, file %s, line %d\n", #expr, __FILE__, __LINE__); \
yield(); \
} \
} while (0)
#else
#define assert(expr) ((void)0)
#endif
#endif /* _ASSERT_H_ */