From c0063a6d502daa189b1790ea3e186dfcecd06d8c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 30 Oct 2010 00:32:45 +0000 Subject: [PATCH] COMMON: Add SCUMMVM_CURRENT_FUNCTION macro (useful for debugging) svn-id: r53931 --- common/util.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/util.h b/common/util.h index 52e4295bbbc..699653918a4 100644 --- a/common/util.h +++ b/common/util.h @@ -63,6 +63,20 @@ template inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; } #define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0]))) +/** + * @def SCUMMVM_CURRENT_FUNCTION + * This macro evaluates to the current function's name on compilers supporting this. + */ +#if defined(__GNUC__) +# define SCUMMVM_CURRENT_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) +# define SCUMMVM_CURRENT_FUNCTION __func__ +#elif defined(_MSC_VER) && _MSC_VER >= 1300 +# define SCUMMVM_CURRENT_FUNCTION __FUNCTION__ +#else +# define SCUMMVM_CURRENT_FUNCTION "" +#endif + namespace Common { /**