aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-10-30 00:32:45 +0000
committerMax Horn2010-10-30 00:32:45 +0000
commitc0063a6d502daa189b1790ea3e186dfcecd06d8c (patch)
tree9825150a65c13bc99112655a2bc064acc769a713
parentecd3e29fe0854c632e5a7688b171e24561c70fc2 (diff)
downloadscummvm-rg350-c0063a6d502daa189b1790ea3e186dfcecd06d8c.tar.gz
scummvm-rg350-c0063a6d502daa189b1790ea3e186dfcecd06d8c.tar.bz2
scummvm-rg350-c0063a6d502daa189b1790ea3e186dfcecd06d8c.zip
COMMON: Add SCUMMVM_CURRENT_FUNCTION macro (useful for debugging)
svn-id: r53931
-rw-r--r--common/util.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/util.h b/common/util.h
index 52e4295bbb..699653918a 100644
--- a/common/util.h
+++ b/common/util.h
@@ -63,6 +63,20 @@ template<typename T> 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 "<unknown>"
+#endif
+
namespace Common {
/**