add some asserts
This commit is contained in:
parent
605507a688
commit
39c778d2f0
7 changed files with 34 additions and 6 deletions
17
include/assert.h
Normal file
17
include/assert.h
Normal 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_ */
|
||||
Loading…
Reference in a new issue