From 17b5288d6b3e446f535fa9330a6b6906fb022434 Mon Sep 17 00:00:00 2001 From: bernie Date: Tue, 14 Sep 2004 21:01:46 +0000 Subject: [PATCH] Mark assertions as LIKELY(). git-svn-id: https://src.develer.com/svnoss/bertos/trunk@202 38d2e660-2303-0410-9eaa-f027e97ec537 --- debug.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/debug.h b/debug.h index edd3c5db..6c38650b 100755 --- a/debug.h +++ b/debug.h @@ -17,6 +17,9 @@ /*#* *#* $Log$ + *#* Revision 1.2 2004/09/14 21:01:46 bernie + *#* Mark assertions as LIKELY(). + *#* *#* Revision 1.1 2004/09/14 20:19:47 bernie *#* Unified debug macros. *#* @@ -162,7 +165,7 @@ #define ASSERT_VALID_PTR_OR_NULL(p) ASSERT((((p) == NULL) || ((unsigned long)(p) >= 0x200))) #else /* !OS_HOSTED */ - /* Implemented in drv/kdebug.h */ + /* These are implemented in drv/kdebug.c */ void kdbg_init(void); void kputchar(char c); void kdump(const void *buf, size_t len); @@ -188,18 +191,17 @@ int __check_wall(long *wall, int size, const char *name, const char *file, int line); #ifndef CONFIG_KDEBUG_ASSERT_NO_TEXT - #define ASSERT(x) ((x) ? 0 : __assert(#x, THIS_FILE, __LINE__)) - #define ASSERT2(x, help) ((x) ? 0 : __assert(help " (" #x ")", THIS_FILE, __LINE__)) + #define ASSERT(x) (LIKELY(x) ? 0 : __assert(#x, THIS_FILE, __LINE__)) + #define ASSERT2(x, help) (LIKELY(x) ? 0 : __assert(help " (" #x ")", THIS_FILE, __LINE__)) #else - #define ASSERT(x) ((x) ? 0 : __assert("", THIS_FILE, __LINE__)) - #define ASSERT2(x, help) ASSERT(x) + #define ASSERT(x) (LIKELY(x) ? 0 : __assert("", THIS_FILE, __LINE__)) + #define ASSERT2(x, help) ASSERT(x) #endif - #define ASSERT_VALID_PTR(p) (((p) >= 0x200) ? 0 : __invalid_ptr(p, #p, THIS_FILE, __LINE__)) - #define ASSERT_VALID_PTR_OR_NULL(p) (((p == NULL) || ((p) >= 0x200)) ? 0 : __invalid_ptr((p), #p, THIS_FILE, __LINE__)) - #define TRACE kprintf("%s()\n", __FUNCTION__) - #define TRACEMSG(msg,...) kprintf("%s(): " msg "\n", __FUNCTION__, ## __VA_ARGS__) - + #define ASSERT_VALID_PTR(p) (LIKELY((p) >= 0x200) ? 0 : __invalid_ptr(p, #p, THIS_FILE, __LINE__)) + #define ASSERT_VALID_PTR_OR_NULL(p) (LIKELY((p == NULL) || ((p) >= 0x200)) ? 0 : __invalid_ptr((p), #p, THIS_FILE, __LINE__)) + #define TRACE kprintf("%s()\n", __FUNCTION__) + #define TRACEMSG(msg,...) kprintf("%s(): " msg "\n", __FUNCTION__, ## __VA_ARGS__) #endif /* !OS_HOSTED */ -- 2.25.1