Skip to content

Commit ec01aa5

Browse files
committed
MariaRocks: fix compilation in Windows: don't use __PRETTY_FUNCTION__ where it is not available
1 parent d49bbf1 commit ec01aa5

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

storage/rocksdb/rdb_utils.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ namespace myrocks {
106106
DBUG_ASSERT(static_cast<bool>(a) == static_cast<bool>(b))
107107
#endif
108108

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+
109121
/*
110122
Intent behind this macro is to avoid manually typing the function name every
111123
time we want to add the debugging statement and use the compiler for this
@@ -116,11 +128,7 @@ namespace myrocks {
116128
contains the signature of the function as well as its bare name and provides
117129
therefore more context when interpreting the logs.
118130
*/
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__)
124132

125133
/*
126134
Error handling pattern used across MySQL abides by the following rules: "All
@@ -143,9 +151,10 @@ namespace myrocks {
143151
and unlocking mutexes.
144152
*/
145153
#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))
147156
#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, \
149158
mysql_mutex_unlock(&m))
150159

151160
/*

0 commit comments

Comments
 (0)