From: John Hodge Date: Wed, 10 Jul 2013 12:19:18 +0000 (+0800) Subject: Kernel/logdebug - More useful asserts X-Git-Tag: rel0.15~381 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=0e844bc15a212d0e933b6243a9a9964ab7925c4f;p=tpg%2Facess2.git Kernel/logdebug - More useful asserts --- diff --git a/KernelLand/Kernel/include/logdebug.h b/KernelLand/Kernel/include/logdebug.h index c2faf7d2..c5337439 100644 --- a/KernelLand/Kernel/include/logdebug.h +++ b/KernelLand/Kernel/include/logdebug.h @@ -58,10 +58,16 @@ extern void Debug_HexDump(const char *Header, const void *Data, size_t Length); # define LEAVE_RET0() return #endif #if !DISABLE_ASSERTS -# define ASSERT(expr) do{if(!(expr))Panic("%s:%i - %s: Assertion '"#expr"' failed",__FILE__,__LINE__,(char*)__func__);}while(0) +# define ASSERTV(expr,msg,args...) do{if(!(expr))Panic("%s:%i - %s: Assertion '"#expr"' failed"msg,__FILE__,__LINE__,(char*)__func__,##args);}while(0) +# define ASSERTRV(expr,rv,msg,args...) do{if(!(expr)){Warning("%s:%i: Assertion '"#expr"' failed"msg,__FILE__,__LINE__,(char*)__func__ , ##args);return rv;}}while(0) #else -# define ASSERT(expr) +# define ASSERTV(expr) +# define ASSERTRV(expr) #endif +#define ASSERT(expr) ASSERTV(expr, "") +#define ASSERTR(expr,rv) ASSERTRV(expr, rv, "") +#define ASSERTC(l,rel,r) ASSERTV(l rel r, ": %i"#rel"%i", l, r) +#define ASSERTCR(l,rel,r,rv) ASSERTRV(l rel r, rv, ": %i"#rel"%i", l, r) /** * \} */