compat.h: Upgrade EDUKE32_FUNCTION and add EDUKE32_PRETTY_FUNCTION.

git-svn-id: https://svn.eduke32.com/eduke32@6077 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-02-25 08:15:58 +00:00
parent 62a921c409
commit d6e820645b

View file

@ -120,15 +120,22 @@
#define EDUKE32_UNREACHABLE_SECTION(...) __VA_ARGS__
#endif
// Detection of __func__ or equivalent functionality, found in SDL_assert.h
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
# define EDUKE32_FUNCTION __func__
#elif ((__GNUC__ >= 2) || defined(_MSC_VER))
#if EDUKE32_GCC_PREREQ(2,0) || defined _MSC_VER
# define EDUKE32_FUNCTION __FUNCTION__
#elif (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || (defined __cplusplus && __cplusplus >= 201103L)
# define EDUKE32_FUNCTION __func__
#else
# define EDUKE32_FUNCTION "???"
#endif
#ifdef _MSC_VER
# define EDUKE32_PRETTY_FUNCTION __FUNCSIG__
#elif EDUKE32_GCC_PREREQ(2,0)
# define EDUKE32_PRETTY_FUNCTION __PRETTY_FUNCTION__
#else
# define EDUKE32_PRETTY_FUNCTION EDUKE32_FUNCTION
#endif
/* Static assertions, based on source found in LuaJIT's src/lj_def.h. */
#define EDUKE32_ASSERT_NAME2(name, line) name ## line
#define EDUKE32_ASSERT_NAME(line) EDUKE32_ASSERT_NAME2(eduke32_assert_, line)