From 535ad41ae6bc0f7499c084262abf109842576620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Thu, 2 Jun 2022 16:50:11 +0300 Subject: [PATCH] mdbx: made internal `noop` macro compatible with MSVC. --- src/defs.h | 6 +++--- test/log.h | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/defs.h b/src/defs.h index 92c16ed1..6553d5ad 100644 --- a/src/defs.h +++ b/src/defs.h @@ -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 */ diff --git a/test/log.h b/test/log.h index b7dcce8e..bc9f4579 100644 --- a/test/log.h +++ b/test/log.h @@ -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