550W Document
550W, a high-end OS
assert.h
浏览该文件的文档.
1 #pragma once
2 
3 #include <lib/stdio.h>
4 
5 /* clang-format off */
6 static inline void _panic(const char* file_name,int lineno, const char* func_name)
7 {
8  k_print("Assertion failed at %s in %s:%d\n\r",
9  func_name,file_name,lineno);
10  for(;;);
11 }
12 
13 #define assert(cond) \
14  { \
15  if (!(cond)) { \
16  _panic(__FILE__, __LINE__,__FUNCTION__); \
17  } \
18  }
19 
20 
21 static inline void panic(char *s)
22 {
23  k_print("panic: ");
24  k_print(s);
25  k_print("\n");
26  assert(0);
27 }
28 
29 /* clang-format on */
#define assert(cond)
Definition: assert.h:13
int k_print(const char *fmt,...)
Definition: printk.c:209