summaryrefslogtreecommitdiff
path: root/util-internal.h
diff options
context:
space:
mode:
authorAzat Khuzhin <a3at.mail@gmail.com>2018-06-19 10:15:08 +0300
committerAzat Khuzhin <a3at.mail@gmail.com>2018-08-02 02:50:48 +0300
commite85818d24850540d220e6d7bc0a30653ba2135f2 (patch)
tree9030dff44f70971a5e1f24098c927621d61ddb2f /util-internal.h
parentc3a6fe75e1511a4c7a7a6ef0a5954b1918902933 (diff)
downloadlibevent-e85818d24850540d220e6d7bc0a30653ba2135f2.tar.gz
Cleanup __func__ detection
First of all __func__ is not a macro, it is char[] array, so the code that we had before in cmake, was incorrect, i.e.: #if defined (__func__) #define EVENT____func__ __func__ #elif defined(__FUNCTION__) #define EVENT____func__ __FUNCTION__ #else #define EVENT____func__ __FILE__ #endif So just detect do we have __func__/__FUNCTION__ in configure/cmake before build and define EVENT__HAVE___func__/EVENT__HAVE___FUNCTION__ to use the later to choose which should be used as a __func__ (if it is not presented). Closes: #644
Diffstat (limited to 'util-internal.h')
-rw-r--r--util-internal.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/util-internal.h b/util-internal.h
index 507dceb7..fe416409 100644
--- a/util-internal.h
+++ b/util-internal.h
@@ -68,8 +68,16 @@ extern "C" {
#ifdef EVENT__inline
#define inline EVENT__inline
#endif
-#if defined(EVENT____func__) && !defined(__func__)
-#define __func__ EVENT____func__
+
+/* Define to appropriate substitute if compiler doesnt have __func__ */
+#if defined(EVENT__HAVE___func__)
+# ifndef __func__
+# define __func__ __func__
+# endif
+#elif defined(EVENT__HAVE___FUNCTION__)
+# define __func__ __FUNCTION__
+#else
+# define __func__ __FILE__
#endif
/* A good no-op to use in macro definitions. */