From dd1f9aa8ca6444202368b12a0f98c7f3eab1fe88 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sat, 17 Jan 2009 18:44:45 +0000 Subject: [PATCH] Include function name in assertion failure message; always print to file before putting up warning. --- xwords4/wince/cemain.c | 8 ++++++-- xwords4/wince/xptypes.h | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/xwords4/wince/cemain.c b/xwords4/wince/cemain.c index 99e9b2d97..0344b8f0c 100755 --- a/xwords4/wince/cemain.c +++ b/xwords4/wince/cemain.c @@ -2699,9 +2699,11 @@ RECTtoXPR( XP_Rect* dest, const RECT* src ) void wince_assert( XP_UCHAR* XP_UNUSED_LOG(s), int XP_UNUSED_LOG(line), - char* XP_UNUSED_LOG(fileName) ) + const char* XP_UNUSED_LOG(fileName), + const char* XP_UNUSED_LOG(func) ) { - XP_WARNF( "ASSERTION FAILED %s: file %s, line %d\n", s, fileName, line ); + XP_WARNF( "ASSERTION FAILED %s: %s in file %s, line %d\n", s, + func, fileName, line ); } /* wince_assert */ #ifdef ENABLE_LOGGING @@ -2730,6 +2732,8 @@ wince_warnf(const XP_UCHAR* format, ...) vsnprintf( buf, sizeof(buf), format, ap ); va_end(ap); + wince_debugf( "%s", buf ); + slen = strlen(buf)+1; wchar_t widebuf[slen]; diff --git a/xwords4/wince/xptypes.h b/xwords4/wince/xptypes.h index 96ca71dc2..6f21a8107 100755 --- a/xwords4/wince/xptypes.h +++ b/xwords4/wince/xptypes.h @@ -78,7 +78,7 @@ typedef XP_U32 XP_Time; #ifdef DEBUG -#define XP_ASSERT(b) if(!(b)) { wince_assert(#b, __LINE__, __FILE__); } +#define XP_ASSERT(b) if(!(b)) { wince_assert(#b, __LINE__, __FILE__, __func__); } #else # define XP_ASSERT(b) #endif @@ -100,7 +100,7 @@ typedef XP_U32 XP_Time; extern "C" { #endif -void wince_assert(XP_UCHAR* s, int line, char* fileName ); +void wince_assert(XP_UCHAR* s, int line, const char* fileName, const char* func ); void wince_debugf(const XP_UCHAR*, ...) __attribute__ ((format (printf, 1, 2))); void wince_warnf(const XP_UCHAR*, ...)