mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-19 13:16:31 +00:00
new: 简单的warn assert
This commit is contained in:
14
kernel/debug/bug.h
Normal file
14
kernel/debug/bug.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <common/compiler.h>
|
||||
#include <common/kprint.h>
|
||||
|
||||
/**
|
||||
* @brief 当condition为true时输出警告信息
|
||||
*
|
||||
*/
|
||||
#define WARN_ON(condition) ({ \
|
||||
int __ret_warn_on = !!(condition); \
|
||||
if (unlikely(__ret_warn_on)) \
|
||||
kwarn("Assertion failed at %s:%d", __FILE__, __LINE__); \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
Reference in New Issue
Block a user