@@ -106,6 +106,18 @@ namespace myrocks {
106
106
DBUG_ASSERT (static_cast <bool >(a) == static_cast<bool>(b))
107
107
#endif
108
108
109
+
110
+ /*
111
+ Portability: use __PRETTY_FUNCTION__ when available, otherwise use __func__
112
+ which is in the standard.
113
+ */
114
+
115
+ #ifdef __GNUC__
116
+ # define __MYROCKS_PORTABLE_PRETTY_FUNCTION__ __PRETTY_FUNCTION__
117
+ #else
118
+ # define __MYROCKS_PORTABLE_PRETTY_FUNCTION__ __func__
119
+ #endif
120
+
109
121
/*
110
122
Intent behind this macro is to avoid manually typing the function name every
111
123
time we want to add the debugging statement and use the compiler for this
@@ -116,11 +128,7 @@ namespace myrocks {
116
128
contains the signature of the function as well as its bare name and provides
117
129
therefore more context when interpreting the logs.
118
130
*/
119
- #ifdef __GNUC__
120
- # define DBUG_ENTER_FUNC () DBUG_ENTER(__PRETTY_FUNCTION__)
121
- #else
122
- # define DBUG_ENTER_FUNC () DBUG_ENTER(__func__)
123
- #endif
131
+ #define DBUG_ENTER_FUNC () DBUG_ENTER(__MYROCKS_PORTABLE_PRETTY_FUNCTION__)
124
132
125
133
/*
126
134
Error handling pattern used across MySQL abides by the following rules: "All
@@ -143,9 +151,10 @@ namespace myrocks {
143
151
and unlocking mutexes.
144
152
*/
145
153
#define RDB_MUTEX_LOCK_CHECK (m ) \
146
- rdb_check_mutex_call_result (__PRETTY_FUNCTION__, true , mysql_mutex_lock(&m))
154
+ rdb_check_mutex_call_result (__MYROCKS_PORTABLE_PRETTY_FUNCTION__, true , \
155
+ mysql_mutex_lock (&m))
147
156
#define RDB_MUTEX_UNLOCK_CHECK (m ) \
148
- rdb_check_mutex_call_result (__PRETTY_FUNCTION__ , false , \
157
+ rdb_check_mutex_call_result (__MYROCKS_PORTABLE_PRETTY_FUNCTION__ , false , \
149
158
mysql_mutex_unlock (&m))
150
159
151
160
/*
0 commit comments