From 3cae78665bc104744a8b76f72241293aa9c65807 Mon Sep 17 00:00:00 2001 From: jsalmon3 <> Date: Wed, 26 Jun 2002 03:48:39 +0000 Subject: [PATCH] Fix for __FUNCTION__ on VC++ --- src/include/freecraft.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/include/freecraft.h b/src/include/freecraft.h index 9afb663bb..0bd7adc67 100644 --- a/src/include/freecraft.h +++ b/src/include/freecraft.h @@ -123,11 +123,6 @@ #define inline __inline /// Fix m$ brain damage #define alloca _alloca /// I hope this works with all VC.. -#ifndef __FUNCTION__ - // I don't know, but eVC didn't has it, even it is documented -#define __FUNCTION__ __FILE__ /* ":" __LINE__ */ -#endif - #ifndef _WIN32_WCE #pragma warning(disable:4018) // Signed/unsigned mismatch #pragma warning(disable:4244) // Conversion from double to uchar @@ -137,6 +132,14 @@ #endif // } m$ +#ifndef __FUNCTION__ +#define __FUNCTION__ __FILE__ /* ":" __LINE__ */ +#define PrintFunction() do { fprintf(stdout,"%s:%d: ",__FILE__,__LINE__); } while(0) +#else +#define PrintFunction() do { fprintf(stdout,__FUNCTION__": "); } while(0) +#endif + + /*============================================================================ == Debug definitions ============================================================================*/ @@ -191,19 +194,19 @@ ** Print debug information of level 0 with function name. */ #define DebugLevel0Fn(args) \ - do { fprintf(stdout,__FUNCTION__": " args); } while(0) + do { PrintFunction(); fprintf(stdout,args); } while(0) /** ** Print debug information of level 1 with function name. */ #define DebugLevel1Fn(args) \ - do { fprintf(stdout,__FUNCTION__": " args); } while(0) + do { PrintFunction(); fprintf(stdout,args); } while(0) /** ** Print debug information of level 2 with function name. */ #define DebugLevel2Fn(args) \ - do { fprintf(stdout,__FUNCTION__": " args); } while(0) + do { PrintFunction(); fprintf(stdout,args); } while(0) /** ** Print debug information of level 3 with function name.