added __REFUNC__ macro

This commit is contained in:
Richard Aas 2015-10-05 13:54:55 +00:00
parent b026ae2920
commit 770beeef62
3 changed files with 12 additions and 2 deletions

View file

@ -236,3 +236,13 @@ typedef bool _Bool;
#ifndef EAUTH
#define EAUTH 217
#endif
/*
* Any C compiler conforming to C99 or later MUST support __func__
*/
#if __STDC_VERSION__ >= 199901L
#define __REFUNC__ (const char *)__func__
#else
#define __REFUNC__ __FUNCTION__
#endif

View file

@ -104,7 +104,7 @@ static inline void mem_unlock(void)
#define MAGIC_CHECK(m) \
if (mem_magic != (m)->magic) { \
DEBUG_WARNING("%s: magic check failed 0x%08x (%p)\n", \
__FUNCTION__, (m)->magic, (m)+1); \
__REFUNC__, (m)->magic, (m)+1); \
BREAKPOINT; \
}
#else

View file

@ -31,7 +31,7 @@ static bool inited = false;
/** Check random state */
#define RAND_CHECK \
if (!inited) { \
DEBUG_WARNING("%s: random not inited\n", __FUNCTION__); \
DEBUG_WARNING("%s: random not inited\n", __REFUNC__); \
}
#else
#define RAND_CHECK if (0) {}