Commit 123b6e3c authored by Hallvard Furuseth's avatar Hallvard Furuseth
Browse files

Wrap __func__ in mdb_func_

parent 21621cc7
...@@ -149,13 +149,24 @@ ...@@ -149,13 +149,24 @@
/** @defgroup internal MDB Internals /** @defgroup internal MDB Internals
* @{ * @{
*/ */
/** @defgroup compat Windows Compatibility Macros /** @defgroup compat Compatibility Macros
* A bunch of macros to minimize the amount of platform-specific ifdefs * A bunch of macros to minimize the amount of platform-specific ifdefs
* needed throughout the rest of the code. When the features this library * needed throughout the rest of the code. When the features this library
* needs are similar enough to POSIX to be hidden in a one-or-two line * needs are similar enough to POSIX to be hidden in a one-or-two line
* replacement, this macro approach is used. * replacement, this macro approach is used.
* @{ * @{
*/ */
/** Wrapper around __func__, which is a C99 feature */
#if __STDC_VERSION__ >= 199901L
# define mdb_func_ __func__
#elif __GNUC__ >= 2 || _MSC_VER >= 1300
# define mdb_func_ __FUNCTION__
#else
/* If a debug message says <mdb_unknown>(), update the #if statements above */
# define mdb_func_ "<mdb_unknown>"
#endif
#ifdef _WIN32 #ifdef _WIN32
#define MDB_USE_HASH 1 #define MDB_USE_HASH 1
#define MDB_PIDLOCK 0 #define MDB_PIDLOCK 0
...@@ -327,7 +338,7 @@ static txnid_t mdb_debug_start; ...@@ -327,7 +338,7 @@ static txnid_t mdb_debug_start;
*/ */
# define DPRINTF(args) ((void) ((mdb_debug) && DPRINTF0 args)) # define DPRINTF(args) ((void) ((mdb_debug) && DPRINTF0 args))
# define DPRINTF0(fmt, ...) \ # define DPRINTF0(fmt, ...) \
fprintf(stderr, "%s:%d " fmt "\n", __func__, __LINE__, __VA_ARGS__) fprintf(stderr, "%s:%d " fmt "\n", mdb_func_, __LINE__, __VA_ARGS__)
#else #else
# define DPRINTF(args) ((void) 0) # define DPRINTF(args) ((void) 0)
#endif #endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment