mdbx: made internal noop macro compatible with MSVC.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-06-02 16:50:11 +03:00
parent 106f39327e
commit 535ad41ae6
2 changed files with 7 additions and 4 deletions

View File

@ -104,7 +104,7 @@
#endif /* __must_check_result */
#if !defined(__noop) && !defined(_MSC_VER)
# define __noop(...) do {} while(0)
# define __noop do {} while(0)
#endif /* __noop */
#if defined(__fallthrough) && \
@ -136,7 +136,7 @@
# elif defined(_MSC_VER)
# define __unreachable() __assume(0)
# else
# define __unreachable() __noop()
# define __unreachable() do {} while(1)
# endif
#endif /* __unreachable */
@ -144,7 +144,7 @@
# if defined(__GNUC__) || defined(__clang__) || __has_builtin(__builtin_prefetch)
# define __prefetch(ptr) __builtin_prefetch(ptr)
# else
# define __prefetch(ptr) __noop(ptr)
# define __prefetch(ptr) do { (void)(ptr); } while(0)
# endif
#endif /* __prefetch */

View File

@ -85,6 +85,9 @@ public:
} // namespace logging
void MDBX_PRINTF_ARGS(1, 2) static inline log_null(const char *msg, ...) {
return (void)msg;
}
void MDBX_PRINTF_ARGS(1, 2) log_extra(const char *msg, ...);
void MDBX_PRINTF_ARGS(1, 2) log_trace(const char *msg, ...);
void MDBX_PRINTF_ARGS(1, 2) log_debug(const char *msg, ...);
@ -100,5 +103,5 @@ bool log_enabled(const logging::loglevel priority);
#ifdef _DEBUG
#define TRACE(...) log_trace(__VA_ARGS__)
#else
#define TRACE(...) __noop(__VA_ARGS__)
#define TRACE(...) log_null(__VA_ARGS__)
#endif