mirror of
https://github.com/isar/libmdbx.git
synced 2025-12-17 17:32:24 +08:00
mdbx-build: sourcery pinning (but cmake requires manually config-files removal for now).
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
#cmakedefine HAVE_VALGRIND_MEMCHECK_H
|
||||
/* *INDENT-OFF* */
|
||||
/* clang-format off */
|
||||
|
||||
#cmakedefine HAVE_VALGRIND_MEMCHECK_H
|
||||
#cmakedefine HAS_RELAXED_CONSTEXPR
|
||||
|
||||
#cmakedefine LTO_ENABLED
|
||||
@@ -7,16 +10,14 @@
|
||||
#cmakedefine ENABLE_GCOV
|
||||
#cmakedefine ENABLE_ASAN
|
||||
|
||||
#cmakedefine01 HAVE_MDBX_VERSIONINFO
|
||||
|
||||
/* Common */
|
||||
#cmakedefine01 MDBX_TXN_CHECKPID
|
||||
#cmakedefine01 MDBX_TXN_CHECKOWNER
|
||||
#cmakedefine01 MDBX_BUILD_SHARED_LIBRARY
|
||||
|
||||
/* Windows */
|
||||
#cmakedefine MDBX_BUILD_DLL
|
||||
#cmakedefine01 MDBX_CONFIG_MANUAL_TLS_CALLBACK
|
||||
#cmakedefine MDBX_AVOID_CRT
|
||||
#cmakedefine01 MDBX_AVOID_CRT
|
||||
|
||||
/* MacOS */
|
||||
#cmakedefine01 MDBX_OSX_SPEED_INSTEADOF_DURABILITY
|
||||
@@ -26,6 +27,10 @@
|
||||
#cmakedefine01 MDBX_USE_OFDLOCKS
|
||||
|
||||
/* Simulate "AUTO" values of tristate options */
|
||||
#cmakedefine MDBX_TXN_CHECKPID_AUTO
|
||||
#ifdef MDBX_TXN_CHECKPID_AUTO
|
||||
#undef MDBX_TXN_CHECKPID
|
||||
#endif
|
||||
#cmakedefine MDBX_USE_ROBUST_AUTO
|
||||
#ifdef MDBX_USE_ROBUST_AUTO
|
||||
#undef MDBX_USE_ROBUST
|
||||
@@ -34,3 +39,15 @@
|
||||
#ifdef MDBX_USE_OFDLOCKS_AUTO
|
||||
#undef MDBX_USE_OFDLOCKS
|
||||
#endif
|
||||
|
||||
/* Build Info */
|
||||
#cmakedefine MDBX_BUILD_TIMESTAMP "@MDBX_BUILD_TIMESTAMP@"
|
||||
#cmakedefine MDBX_BUILD_TARGET "@MDBX_BUILD_TARGET@"
|
||||
#cmakedefine MDBX_BUILD_CONFIG "@MDBX_BUILD_CONFIG@"
|
||||
#cmakedefine MDBX_BUILD_OPTIONS_STRING "@MDBX_BUILD_OPTIONS_STRING@"
|
||||
#cmakedefine MDBX_BUILD_COMPILER "@MDBX_BUILD_COMPILER@"
|
||||
#cmakedefine MDBX_BUILD_FLAGS "@MDBX_BUILD_FLAGS@"
|
||||
#cmakedefine MDBX_BUILD_SOURCERY @MDBX_BUILD_SOURCERY@
|
||||
|
||||
/* *INDENT-ON* */
|
||||
/* clang-format on */
|
||||
|
||||
@@ -14686,6 +14686,53 @@ int mdbx_set_attr(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
__dll_export
|
||||
#ifdef __attribute_used__
|
||||
__attribute_used__
|
||||
#elif defined(__GNUC__) || __has_attribute(__used__)
|
||||
__attribute__((__used__))
|
||||
#endif
|
||||
#ifdef __attribute_externally_visible__
|
||||
__attribute_externally_visible__
|
||||
#elif (defined(__GNUC__) && !defined(__clang__)) || \
|
||||
__has_attribute(__externally_visible__)
|
||||
__attribute__((__externally_visible__))
|
||||
#endif
|
||||
const mdbx_build_info mdbx_build = {
|
||||
#ifdef MDBX_BUILD_TIMESTAMP
|
||||
MDBX_BUILD_TIMESTAMP
|
||||
#else
|
||||
__DATE__ " " __TIME__
|
||||
#endif
|
||||
,
|
||||
#ifdef MDBX_BUILD_TARGET
|
||||
MDBX_BUILD_TARGET
|
||||
#else
|
||||
"UNKNOWN_BUILD_TARGET"
|
||||
#endif
|
||||
#ifdef MDBX_BUILD_CONFIG
|
||||
"-" MDBX_BUILD_CONFIG
|
||||
#endif
|
||||
,
|
||||
#ifdef MDBX_BUILD_OPTIONS_STRING
|
||||
MDBX_BUILD_OPTIONS_STRING
|
||||
#else
|
||||
"@TODO: MDBX_BUILD_OPTIONS_STRING"
|
||||
#endif
|
||||
,
|
||||
#ifdef MDBX_BUILD_COMPILER
|
||||
MDBX_BUILD_COMPILER
|
||||
#else
|
||||
"@TODO: MDBX_BUILD_COMPILER"
|
||||
#endif
|
||||
,
|
||||
#ifdef MDBX_BUILD_FLAGS
|
||||
MDBX_BUILD_FLAGS
|
||||
#else
|
||||
"@TODO: MDBX_BUILD_FLAGS"
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
LIBMDBX_API __attribute__((__weak__)) const char *__asan_default_options() {
|
||||
return "symbolize=1:allow_addr2line=1:"
|
||||
|
||||
@@ -417,6 +417,9 @@ typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
|
||||
# define STRINGIFY(x) STRINGIFY_HELPER(x)
|
||||
#endif /* STRINGIFY */
|
||||
|
||||
#define CONCAT(a,b) a##b
|
||||
#define XCONCAT(a,b) CONCAT(a,b)
|
||||
|
||||
#ifndef offsetof
|
||||
# define offsetof(type, member) __builtin_offsetof(type, member)
|
||||
#endif /* offsetof */
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
/* *INDENT-OFF* */
|
||||
/* clang-format off */
|
||||
|
||||
#ifdef MDBX_CONFIG_H
|
||||
#include MDBX_CONFIG_H
|
||||
#endif
|
||||
#include "config.h"
|
||||
|
||||
/* In case the MDBX_DEBUG is undefined set it corresponding to NDEBUG */
|
||||
#ifndef MDBX_DEBUG
|
||||
@@ -153,6 +151,57 @@
|
||||
#define MDBX_WORDBITS 32
|
||||
#endif /* MDBX_WORDBITS */
|
||||
|
||||
/* Some platforms define the EOWNERDEAD error code even though they
|
||||
* don't support Robust Mutexes. Compile with -DMDBX_USE_ROBUST=0. */
|
||||
#ifndef MDBX_USE_ROBUST
|
||||
#define MDBX_USE_ROBUST_CONFIG AUTO
|
||||
/* Howard Chu: Android currently lacks Robust Mutex support */
|
||||
#if defined(EOWNERDEAD) && !defined(__ANDROID__) && !defined(__APPLE__) && \
|
||||
(!defined(__GLIBC__) || \
|
||||
__GLIBC_PREREQ( \
|
||||
2, \
|
||||
10) /* LY: glibc before 2.10 has a troubles with Robust Mutex too. */ \
|
||||
|| _POSIX_C_SOURCE >= 200809L)
|
||||
#define MDBX_USE_ROBUST 1
|
||||
#else
|
||||
#define MDBX_USE_ROBUST 0
|
||||
#endif
|
||||
#else
|
||||
#define MDBX_USE_ROBUST_CONFIG MDBX_USE_ROBUST
|
||||
#endif /* MDBX_USE_ROBUST */
|
||||
|
||||
#ifndef MDBX_USE_OFDLOCKS
|
||||
#define MDBX_USE_OFDLOCKS_CONFIG AUTO
|
||||
#if defined(F_OFD_SETLK) && defined(F_OFD_SETLKW) && defined(F_OFD_GETLK)
|
||||
#define MDBX_USE_OFDLOCKS 1
|
||||
#else
|
||||
#define MDBX_USE_OFDLOCKS 0
|
||||
#endif
|
||||
#else
|
||||
#define MDBX_USE_OFDLOCKS_CONFIG MDBX_USE_OFDLOCKS
|
||||
#endif /* MDBX_USE_OFDLOCKS */
|
||||
|
||||
/* Controls checking PID against reuse DB environment after the fork() */
|
||||
#ifndef MDBX_TXN_CHECKPID
|
||||
#define MDBX_TXN_CHECKPID_CONFIG AUTO
|
||||
#if defined(MADV_DONTFORK) || defined(_WIN32) || defined(_WIN64)
|
||||
/* PID check could be ommited:
|
||||
* - on Linux when madvise(MADV_DONTFORK) is available. i.e. after the fork()
|
||||
* mapped pages will not be available for child process.
|
||||
* - in Windows where fork() not available. */
|
||||
#define MDBX_TXN_CHECKPID 0
|
||||
#else
|
||||
#define MDBX_TXN_CHECKPID 1
|
||||
#endif
|
||||
#else
|
||||
#define MDBX_TXN_CHECKPID_CONFIG MDBX_TXN_CHECKPID
|
||||
#endif /* MDBX_TXN_CHECKPID */
|
||||
|
||||
#define mdbx_sourcery_anchor XCONCAT(mdbx_sourcery_, MDBX_BUILD_SOURCERY)
|
||||
#if defined(MDBX_TOOLS)
|
||||
extern LIBMDBX_API const char *const mdbx_sourcery_anchor;
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Basic constants and types */
|
||||
|
||||
@@ -202,11 +251,7 @@ typedef uint32_t pgno_t;
|
||||
/* A transaction ID. */
|
||||
typedef uint64_t txnid_t;
|
||||
#define PRIaTXN PRIi64
|
||||
#if MDBX_DEBUG
|
||||
#define MIN_TXNID UINT64_C(0x100000000)
|
||||
#else
|
||||
#define MIN_TXNID UINT64_C(1)
|
||||
#endif /* MIN_TXNID */
|
||||
|
||||
/* Used for offsets within a single page.
|
||||
* Since memory pages are typically 4 or 8KB in size, 12-13 bits,
|
||||
@@ -1274,16 +1319,3 @@ static __inline void mdbx_jitter4testing(bool tiny) {
|
||||
(void)tiny;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Controls checking PID against reuse DB environment after the fork() */
|
||||
#ifndef MDBX_TXN_CHECKPID
|
||||
#if defined(MADV_DONTFORK) || defined(_WIN32) || defined(_WIN64)
|
||||
/* PID check could be ommited:
|
||||
* - on Linux when madvise(MADV_DONTFORK) is available. i.e. after the fork()
|
||||
* mapped pages will not be available for child process.
|
||||
* - in Windows where fork() not available. */
|
||||
#define MDBX_TXN_CHECKPID 0
|
||||
#else
|
||||
#define MDBX_TXN_CHECKPID 1
|
||||
#endif
|
||||
#endif /* MDBX_TXN_CHECKPID */
|
||||
|
||||
@@ -14,30 +14,6 @@
|
||||
|
||||
#include "./internals.h"
|
||||
|
||||
/* Some platforms define the EOWNERDEAD error code even though they
|
||||
* don't support Robust Mutexes. Compile with -DMDBX_USE_ROBUST=0. */
|
||||
#ifndef MDBX_USE_ROBUST
|
||||
/* Howard Chu: Android currently lacks Robust Mutex support */
|
||||
#if defined(EOWNERDEAD) && !defined(__ANDROID__) && !defined(__APPLE__) && \
|
||||
(!defined(__GLIBC__) || \
|
||||
__GLIBC_PREREQ( \
|
||||
2, \
|
||||
10) /* LY: glibc before 2.10 has a troubles with Robust Mutex too. */ \
|
||||
|| _POSIX_C_SOURCE >= 200809L)
|
||||
#define MDBX_USE_ROBUST 1
|
||||
#else
|
||||
#define MDBX_USE_ROBUST 0
|
||||
#endif
|
||||
#endif /* MDBX_USE_ROBUST */
|
||||
|
||||
#ifndef MDBX_USE_OFDLOCKS
|
||||
#if defined(F_OFD_SETLK) && defined(F_OFD_SETLKW) && defined(F_OFD_GETLK)
|
||||
#define MDBX_USE_OFDLOCKS 1
|
||||
#else
|
||||
#define MDBX_USE_OFDLOCKS 0
|
||||
#endif
|
||||
#endif /* MDBX_USE_OFDLOCKS */
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* global constructor/destructor */
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
static void mdbx_winnt_import(void);
|
||||
|
||||
#ifdef MDBX_BUILD_DLL
|
||||
#ifdef MDBX_BUILD_SHARED_LIBRARY
|
||||
#if MDBX_AVOID_CRT && defined(NDEBUG)
|
||||
/* DEBUG/CHECKED builds still require MSVC's CRT for runtime checks.
|
||||
*
|
||||
@@ -44,7 +44,7 @@ static
|
||||
#endif /* !MDBX_CONFIG_MANUAL_TLS_CALLBACK */
|
||||
void NTAPI
|
||||
mdbx_dll_callback(PVOID module, DWORD reason, PVOID reserved)
|
||||
#endif /* MDBX_BUILD_DLL */
|
||||
#endif /* MDBX_BUILD_SHARED_LIBRARY */
|
||||
{
|
||||
(void)reserved;
|
||||
switch (reason) {
|
||||
@@ -62,12 +62,12 @@ static
|
||||
mdbx_rthc_thread_dtor(module);
|
||||
break;
|
||||
}
|
||||
#ifdef MDBX_BUILD_DLL
|
||||
#if MDBX_BUILD_SHARED_LIBRARY
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(MDBX_BUILD_DLL) && !MDBX_CONFIG_MANUAL_TLS_CALLBACK
|
||||
#if !MDBX_BUILD_SHARED_LIBRARY && !MDBX_CONFIG_MANUAL_TLS_CALLBACK
|
||||
/* *INDENT-OFF* */
|
||||
/* clang-format off */
|
||||
#if defined(_MSC_VER)
|
||||
@@ -105,7 +105,7 @@ static
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
/* clang-format on */
|
||||
#endif /* !defined(MDBX_BUILD_DLL) && !MDBX_CONFIG_MANUAL_TLS_CALLBACK */
|
||||
#endif /* !MDBX_BUILD_SHARED_LIBRARY && !MDBX_CONFIG_MANUAL_TLS_CALLBACK */
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
#if !defined(_CRT_SECURE_NO_WARNINGS)
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#if !defined(_NO_CRT_STDIO_INLINE) && defined(MDBX_BUILD_DLL)
|
||||
#if !defined(_NO_CRT_STDIO_INLINE) && MDBX_BUILD_SHARED_LIBRARY && \
|
||||
!defined(MDBX_TOOLS)
|
||||
#define _NO_CRT_STDIO_INLINE
|
||||
#endif
|
||||
#endif /* Windows */
|
||||
@@ -109,7 +110,7 @@ typedef struct {
|
||||
} mdbx_condmutex_t;
|
||||
typedef CRITICAL_SECTION mdbx_fastmutex_t;
|
||||
|
||||
#ifdef MDBX_AVOID_CRT
|
||||
#if MDBX_AVOID_CRT
|
||||
#ifndef mdbx_malloc
|
||||
static inline void *mdbx_malloc(size_t bytes) {
|
||||
return LocalAlloc(LMEM_FIXED, bytes);
|
||||
|
||||
@@ -12,14 +12,13 @@
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
|
||||
#include "elements/internals.h"
|
||||
#include "internals.h"
|
||||
|
||||
#if defined(_MSC_VER) && defined(MDBX_BUILD_TARGET)
|
||||
#pragma message("Configuration-depended MDBX_BUILD_TARGET: " MDBX_BUILD_TARGET)
|
||||
#endif
|
||||
#if defined(_MSC_VER) && defined(MDBX_COMPILE_FLAGS)
|
||||
#pragma message( \
|
||||
"Configuration-depended MDBX_COMPILE_FLAGS: " MDBX_COMPILE_FLAGS)
|
||||
#if defined(_MSC_VER) && defined(MDBX_BUILD_FLAGS)
|
||||
#pragma message("Configuration-depended MDBX_BUILD_FLAGS: " MDBX_BUILD_FLAGS)
|
||||
#endif
|
||||
|
||||
#if MDBX_VERSION_MAJOR != ${MDBX_VERSION_MAJOR} || \
|
||||
@@ -27,19 +26,39 @@
|
||||
#error "API version mismatch! Had `git fetch --tags` done?"
|
||||
#endif
|
||||
|
||||
/*LIBMDBX_API*/ const mdbx_version_info mdbx_version = {
|
||||
${MDBX_VERSION_MAJOR},
|
||||
${MDBX_VERSION_MINOR},
|
||||
${MDBX_VERSION_RELEASE},
|
||||
${MDBX_VERSION_REVISION},
|
||||
{"@MDBX_GIT_TIMESTAMP@", "@MDBX_GIT_TREE@", "@MDBX_GIT_COMMIT@",
|
||||
"@MDBX_GIT_DESCRIBE@"}};
|
||||
static const char sourcery[] = STRINGIFY(MDBX_BUILD_SOURCERY);
|
||||
|
||||
/*LIBMDBX_API*/ const mdbx_build_info mdbx_build = {
|
||||
"@MDBX_BUILD_TIMESTAMP@",
|
||||
"${MDBX_BUILD_TARGET}"
|
||||
#ifdef DMDBX_BUILD_CONFIG
|
||||
"-" DMDBX_BUILD_CONFIG
|
||||
__dll_export
|
||||
#ifdef __attribute_used__
|
||||
__attribute_used__
|
||||
#elif defined(__GNUC__) || __has_attribute(__used__)
|
||||
__attribute__((__used__))
|
||||
#endif
|
||||
,
|
||||
"@MDBX_OPTIONS_STRING@", "@MDBX_BUILD_COMPILER@", "${MDBX_COMPILE_FLAGS}"};
|
||||
#ifdef __attribute_externally_visible__
|
||||
__attribute_externally_visible__
|
||||
#elif (defined(__GNUC__) && !defined(__clang__)) || \
|
||||
__has_attribute(__externally_visible__)
|
||||
__attribute__((__externally_visible__))
|
||||
#endif
|
||||
const mdbx_version_info mdbx_version = {
|
||||
${MDBX_VERSION_MAJOR},
|
||||
${MDBX_VERSION_MINOR},
|
||||
${MDBX_VERSION_RELEASE},
|
||||
${MDBX_VERSION_REVISION},
|
||||
{"@MDBX_GIT_TIMESTAMP@", "@MDBX_GIT_TREE@", "@MDBX_GIT_COMMIT@",
|
||||
"@MDBX_GIT_DESCRIBE@"},
|
||||
sourcery};
|
||||
|
||||
__dll_export
|
||||
#ifdef __attribute_used__
|
||||
__attribute_used__
|
||||
#elif defined(__GNUC__) || __has_attribute(__used__)
|
||||
__attribute__((__used__))
|
||||
#endif
|
||||
#ifdef __attribute_externally_visible__
|
||||
__attribute_externally_visible__
|
||||
#elif (defined(__GNUC__) && !defined(__clang__)) || \
|
||||
__has_attribute(__externally_visible__)
|
||||
__attribute__((__externally_visible__))
|
||||
#endif
|
||||
const char *const mdbx_sourcery_anchor = sourcery;
|
||||
|
||||
Reference in New Issue
Block a user