From c16f98494630501e5dd3919697732d834f3de4ef Mon Sep 17 00:00:00 2001 From: rasky Date: Fri, 30 Jul 2004 14:26:33 +0000 Subject: [PATCH 1/1] Semplificato l'output dell'ASSERT Aggiunta ASSERT2 con stringa di help opzionalmente disattivabile git-svn-id: https://src.develer.com/svnoss/bertos/trunk@91 38d2e660-2303-0410-9eaa-f027e97ec537 --- drv/kdebug.c | 8 ++++++-- drv/kdebug.h | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drv/kdebug.c b/drv/kdebug.c index 943148b3..063df825 100755 --- a/drv/kdebug.c +++ b/drv/kdebug.c @@ -16,6 +16,10 @@ /* * $Log$ + * Revision 1.8 2004/07/30 14:26:33 rasky + * Semplificato l'output dell'ASSERT + * Aggiunta ASSERT2 con stringa di help opzionalmente disattivabile + * * Revision 1.7 2004/07/30 14:15:53 rasky * Nuovo supporto unificato per detect della CPU * @@ -194,9 +198,9 @@ void PGM_FUNC(kputs)(const char * PGM_ATTR str) int PGM_FUNC(__assert)(const char * PGM_ATTR cond, const char *file, int line) { PGM_FUNC(kputs)(file); - PGM_FUNC(kprintf)(PSTR(":%d: Assertion failed: \""), line); + PGM_FUNC(kprintf)(PSTR(":%d: Assertion failed: "), line); PGM_FUNC(kputs)(cond); - PGM_FUNC(kputs)(PSTR("\"\n")); + PGM_FUNC(kputs)(PSTR("\n")); return 1; } diff --git a/drv/kdebug.h b/drv/kdebug.h index 612429a7..fe67c8ed 100755 --- a/drv/kdebug.h +++ b/drv/kdebug.h @@ -16,6 +16,10 @@ /* * $Log$ + * Revision 1.4 2004/07/30 14:26:33 rasky + * Semplificato l'output dell'ASSERT + * Aggiunta ASSERT2 con stringa di help opzionalmente disattivabile + * * Revision 1.3 2004/06/03 11:27:09 bernie * Add dual-license information. * @@ -63,7 +67,14 @@ int __check_wall(long *wall, int size, const char *name, const char *file, int line); #define THIS_FILE __FILE__ - #define ASSERT(x) ((x) ? 0 : __assert(#x, THIS_FILE, __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__)) + #else + #define ASSERT(x) ((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__) @@ -80,6 +91,7 @@ #else /* !_DEBUG */ #define ASSERT(x) + #define ASSERT2(x, help) #define ASSERT_VALID_PTR(p) #define ASSERT_VALID_PTR_OR_NULL(p) #define TRACE do {} while(0) @@ -90,6 +102,9 @@ #define INIT_WALL(name) #define CHECK_WALL(name) + INLINE void kdbg_init(void) {} + INLINE void kprintf(UNUSED(const char*, fmt), ...) {} + #endif /* !_DEBUG */ #endif /* KDEBUG_H */ -- 2.25.1