[Commits] ec01aa5: MariaRocks: fix compilation in Windows: don't use __PRETTY_FUNCTION__ where it is not available

Sergei Petrunia psergey at askmonty.org
Sun Mar 12 14:59:46 EET 2017


revision-id: ec01aa5d6bc37b6b81e04bc1987e1a47eff1e4b2
parent(s): d49bbf12a232074d41b9b4dd1472eced665cb14a
committer: Sergei Petrunia
branch nick: 10.2-mariarocks
timestamp: 2017-03-12 15:59:46 +0300
message:

MariaRocks: fix compilation in Windows: don't use __PRETTY_FUNCTION__ where it is not available

---
 storage/rocksdb/rdb_utils.h | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/storage/rocksdb/rdb_utils.h b/storage/rocksdb/rdb_utils.h
index e3c2fb3..71ec8ef 100644
--- a/storage/rocksdb/rdb_utils.h
+++ b/storage/rocksdb/rdb_utils.h
@@ -106,6 +106,18 @@ namespace myrocks {
   DBUG_ASSERT(static_cast<bool>(a) == static_cast<bool>(b))
 #endif
 
+
+/*
+  Portability: use __PRETTY_FUNCTION__ when available, otherwise use __func__
+  which is in the standard.
+*/
+
+#ifdef __GNUC__
+#  define __MYROCKS_PORTABLE_PRETTY_FUNCTION__  __PRETTY_FUNCTION__
+#else
+#  define __MYROCKS_PORTABLE_PRETTY_FUNCTION__  __func__
+#endif
+
 /*
   Intent behind this macro is to avoid manually typing the function name every
   time we want to add the debugging statement and use the compiler for this
@@ -116,11 +128,7 @@ namespace myrocks {
   contains the signature of the function as well as its bare name and provides
   therefore more context when interpreting the logs.
 */
-#ifdef __GNUC__
-#  define DBUG_ENTER_FUNC() DBUG_ENTER(__PRETTY_FUNCTION__)
-#else
-#  define DBUG_ENTER_FUNC() DBUG_ENTER(__func__)
-#endif
+#define DBUG_ENTER_FUNC() DBUG_ENTER(__MYROCKS_PORTABLE_PRETTY_FUNCTION__)
 
 /*
   Error handling pattern used across MySQL abides by the following rules: "All
@@ -143,9 +151,10 @@ namespace myrocks {
   and unlocking mutexes.
 */
 #define RDB_MUTEX_LOCK_CHECK(m)                                                \
-  rdb_check_mutex_call_result(__PRETTY_FUNCTION__, true, mysql_mutex_lock(&m))
+  rdb_check_mutex_call_result(__MYROCKS_PORTABLE_PRETTY_FUNCTION__, true,      \
+                              mysql_mutex_lock(&m))
 #define RDB_MUTEX_UNLOCK_CHECK(m)                                              \
-  rdb_check_mutex_call_result(__PRETTY_FUNCTION__, false,                      \
+  rdb_check_mutex_call_result(__MYROCKS_PORTABLE_PRETTY_FUNCTION__, false,     \
                               mysql_mutex_unlock(&m))
 
 /*


More information about the commits mailing list