summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb/src/mdbx/defs.h
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-11-23 18:11:47 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-11-23 18:11:47 +0300
commit72ed903dac773db034a187b4ba7f187ef43d717e (patch)
tree9a5bd012fd7c0b4dd4ae53ae85d601a82dc56c60 /plugins/Dbx_mdb/src/mdbx/defs.h
parent7d9f19596aec67afaa158af06c5a547029ffdbbf (diff)
updating lmdbx to the recent stable
Diffstat (limited to 'plugins/Dbx_mdb/src/mdbx/defs.h')
-rw-r--r--plugins/Dbx_mdb/src/mdbx/defs.h58
1 files changed, 44 insertions, 14 deletions
diff --git a/plugins/Dbx_mdb/src/mdbx/defs.h b/plugins/Dbx_mdb/src/mdbx/defs.h
index ed1a87e8a4..800553bb17 100644
--- a/plugins/Dbx_mdb/src/mdbx/defs.h
+++ b/plugins/Dbx_mdb/src/mdbx/defs.h
@@ -139,13 +139,50 @@
# endif
#endif /* __deprecated */
-#ifndef __packed
-# if defined(__GNUC__) || __has_attribute(packed)
-# define __packed __attribute__((packed))
-# else
-# define __packed
-# endif
-#endif /* __packed */
+#if !defined(__noop) && !defined(_MSC_VER)
+# ifdef __cplusplus
+ static inline void __noop_consume_args() {}
+ template <typename First, typename... Rest>
+ static inline void
+ __noop_consume_args(const First &first, const Rest &... rest) {
+ (void) first; __noop_consume_args(rest...);
+ }
+# define __noop(...) __noop_consume_args(__VA_ARGS__)
+# elif defined(__GNUC__) && (!defined(__STRICT_ANSI__) || !__STRICT_ANSI__)
+ static __inline void __noop_consume_args(void* anchor, ...) {
+ (void) anchor;
+ }
+# define __noop(...) __noop_consume_args(0, ##__VA_ARGS__)
+# else
+# define __noop(...) do {} while(0)
+# endif
+#endif /* __noop */
+
+#ifndef __fallthrough
+# if __GNUC_PREREQ(7, 0) || __has_attribute(fallthrough)
+# define __fallthrough __attribute__((fallthrough))
+# else
+# define __fallthrough __noop()
+# endif
+#endif /* __fallthrough */
+
+#ifndef __unreachable
+# if __GNUC_PREREQ(4,5)
+# define __unreachable() __builtin_unreachable()
+# elif defined(_MSC_VER)
+# define __unreachable() __assume(0)
+# else
+# define __unreachable() __noop()
+# endif
+#endif /* __unreachable */
+
+#ifndef __prefetch
+# if defined(__GNUC__) || defined(__clang__)
+# define __prefetch(ptr) __builtin_prefetch(ptr)
+# else
+# define __prefetch(ptr) __noop(ptr)
+# endif
+#endif /* __prefetch */
#ifndef __aligned
# if defined(__GNUC__) || __has_attribute(aligned)
@@ -283,13 +320,6 @@
# endif
#endif /* unlikely */
-#if !defined(__noop) && !defined(_MSC_VER)
- static __inline int __do_noop(void* crutch, ...) {
- (void) crutch; return 0;
- }
-# define __noop(...) __do_noop(0, __VA_ARGS__)
-#endif /* __noop */
-
/* Wrapper around __func__, which is a C99 feature */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
# define mdbx_func_ __func__