You’re assuming __func__
is a macro, but it’s not. It’s a conditionally-supported predefined identifier, so you can’t check it with #if defined
or #ifdef
.
If the compilers have no way of telling you whether this is supported (they could via a _FUNC_SUPPORTED
or something, I’m not saying they actually are doing this), you’ll have to check the compiler instead of the actual identifier.
Something along the lines:
#ifndef __FUNCTION_NAME__
#ifdef WIN32 //WINDOWS
#define __FUNCTION_NAME__ __FUNCTION__
#else //*NIX
#define __FUNCTION_NAME__ __func__
#endif
#endif