mirror of
https://github.com/isar/libmdbx.git
synced 2025-11-21 15:58:56 +08:00
mdbx: cleanup tabs (minor).
This commit is contained in:
109
src/bits.h
109
src/bits.h
@@ -16,18 +16,17 @@
|
||||
/* clang-format off */
|
||||
|
||||
#ifndef _FILE_OFFSET_BITS
|
||||
# define _FILE_OFFSET_BITS 64
|
||||
# define _FILE_OFFSET_BITS 64
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4464) /* C4464: relative include path contains '..' */
|
||||
#pragma warning(disable : 4710) /* C4710: 'xyz': function not inlined */
|
||||
#pragma warning(disable : 4711) /* C4711: function 'xyz' selected for automatic inline expansion */
|
||||
//#pragma warning(disable : 4061) /* C4061: enumerator 'abc' in switch of enum 'xyz' is not explicitly handled by a case label */
|
||||
#pragma warning(disable : 4201) /* C4201: nonstandard extension used : nameless struct / union */
|
||||
#pragma warning(disable : 4706) /* C4706: assignment within conditional expression */
|
||||
#pragma warning(disable : 4127) /* C4127: conditional expression is constant */
|
||||
@@ -37,102 +36,102 @@
|
||||
#include "./defs.h"
|
||||
|
||||
#if defined(USE_VALGRIND)
|
||||
# include <valgrind/memcheck.h>
|
||||
# ifndef VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE
|
||||
/* LY: available since Valgrind 3.10 */
|
||||
# define VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE(a,s)
|
||||
# define VALGRIND_ENABLE_ADDR_ERROR_REPORTING_IN_RANGE(a,s)
|
||||
# endif
|
||||
# include <valgrind/memcheck.h>
|
||||
# ifndef VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE
|
||||
/* LY: available since Valgrind 3.10 */
|
||||
# define VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE(a,s)
|
||||
# define VALGRIND_ENABLE_ADDR_ERROR_REPORTING_IN_RANGE(a,s)
|
||||
# endif
|
||||
#else
|
||||
# define VALGRIND_CREATE_MEMPOOL(h,r,z)
|
||||
# define VALGRIND_DESTROY_MEMPOOL(h)
|
||||
# define VALGRIND_MEMPOOL_TRIM(h,a,s)
|
||||
# define VALGRIND_MEMPOOL_ALLOC(h,a,s)
|
||||
# define VALGRIND_MEMPOOL_FREE(h,a)
|
||||
# define VALGRIND_MEMPOOL_CHANGE(h,a,b,s)
|
||||
# define VALGRIND_MAKE_MEM_NOACCESS(a,s)
|
||||
# define VALGRIND_MAKE_MEM_DEFINED(a,s)
|
||||
# define VALGRIND_MAKE_MEM_UNDEFINED(a,s)
|
||||
# define VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE(a,s)
|
||||
# define VALGRIND_ENABLE_ADDR_ERROR_REPORTING_IN_RANGE(a,s)
|
||||
# define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,s) (0)
|
||||
# define VALGRIND_CHECK_MEM_IS_DEFINED(a,s) (0)
|
||||
# define VALGRIND_CREATE_MEMPOOL(h,r,z)
|
||||
# define VALGRIND_DESTROY_MEMPOOL(h)
|
||||
# define VALGRIND_MEMPOOL_TRIM(h,a,s)
|
||||
# define VALGRIND_MEMPOOL_ALLOC(h,a,s)
|
||||
# define VALGRIND_MEMPOOL_FREE(h,a)
|
||||
# define VALGRIND_MEMPOOL_CHANGE(h,a,b,s)
|
||||
# define VALGRIND_MAKE_MEM_NOACCESS(a,s)
|
||||
# define VALGRIND_MAKE_MEM_DEFINED(a,s)
|
||||
# define VALGRIND_MAKE_MEM_UNDEFINED(a,s)
|
||||
# define VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE(a,s)
|
||||
# define VALGRIND_ENABLE_ADDR_ERROR_REPORTING_IN_RANGE(a,s)
|
||||
# define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,s) (0)
|
||||
# define VALGRIND_CHECK_MEM_IS_DEFINED(a,s) (0)
|
||||
#endif /* USE_VALGRIND */
|
||||
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
# include <sanitizer/asan_interface.h>
|
||||
# include <sanitizer/asan_interface.h>
|
||||
#else
|
||||
# define ASAN_POISON_MEMORY_REGION(addr, size) \
|
||||
((void)(addr), (void)(size))
|
||||
# define ASAN_UNPOISON_MEMORY_REGION(addr, size) \
|
||||
((void)(addr), (void)(size))
|
||||
# define ASAN_POISON_MEMORY_REGION(addr, size) \
|
||||
((void)(addr), (void)(size))
|
||||
# define ASAN_UNPOISON_MEMORY_REGION(addr, size) \
|
||||
((void)(addr), (void)(size))
|
||||
#endif /* __SANITIZE_ADDRESS__ */
|
||||
|
||||
#include "./osal.h"
|
||||
|
||||
#ifndef MDBX_DEBUG
|
||||
# define MDBX_DEBUG 0
|
||||
# define MDBX_DEBUG 0
|
||||
#endif
|
||||
|
||||
#if MDBX_DEBUG
|
||||
# undef NDEBUG
|
||||
# undef NDEBUG
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && !__GNUC_PREREQ(4,2)
|
||||
/* Actualy libmdbx was not tested with compilers older than GCC from RHEL6.
|
||||
* But you could remove this #error and try to continue at your own risk.
|
||||
* In such case please don't rise up an issues related ONLY to old compilers.
|
||||
*/
|
||||
# warning "libmdbx required at least GCC 4.2 compatible C/C++ compiler."
|
||||
/* Actualy libmdbx was not tested with compilers older than GCC from RHEL6.
|
||||
* But you could remove this #error and try to continue at your own risk.
|
||||
* In such case please don't rise up an issues related ONLY to old compilers.
|
||||
*/
|
||||
# warning "libmdbx required at least GCC 4.2 compatible C/C++ compiler."
|
||||
#endif
|
||||
|
||||
#if defined(__GLIBC__) && !__GLIBC_PREREQ(2,12)
|
||||
/* Actualy libmdbx was not tested with something older than glibc 2.12 (from RHEL6).
|
||||
* But you could remove this #error and try to continue at your own risk.
|
||||
* In such case please don't rise up an issues related ONLY to old systems.
|
||||
*/
|
||||
# warning "libmdbx required at least GLIBC 2.12."
|
||||
/* Actualy libmdbx was not tested with something older than glibc 2.12 (from RHEL6).
|
||||
* But you could remove this #error and try to continue at your own risk.
|
||||
* In such case please don't rise up an issues related ONLY to old systems.
|
||||
*/
|
||||
# warning "libmdbx required at least GLIBC 2.12."
|
||||
#endif
|
||||
|
||||
#if defined(__i386) || defined(__x86_64) || defined(_M_IX86)
|
||||
# define UNALIGNED_OK 1 /* TODO */
|
||||
# define UNALIGNED_OK 1 /* TODO */
|
||||
#endif
|
||||
#ifndef UNALIGNED_OK
|
||||
# define UNALIGNED_OK 0
|
||||
# define UNALIGNED_OK 0
|
||||
#endif /* UNALIGNED_OK */
|
||||
|
||||
#if (-6 & 5) || CHAR_BIT != 8 || UINT_MAX < 0xffffffff || ULONG_MAX % 0xFFFF
|
||||
# error "Sanity checking failed: Two's complement, reasonably sized integer types"
|
||||
# error "Sanity checking failed: Two's complement, reasonably sized integer types"
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ARRAY_LENGTH
|
||||
# ifdef __cplusplus
|
||||
template <typename T, size_t N>
|
||||
char (&__ArraySizeHelper(T (&array)[N]))[N];
|
||||
# define ARRAY_LENGTH(array) (sizeof(::__ArraySizeHelper(array)))
|
||||
# else
|
||||
# define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
|
||||
# endif
|
||||
# ifdef __cplusplus
|
||||
template <typename T, size_t N>
|
||||
char (&__ArraySizeHelper(T (&array)[N]))[N];
|
||||
# define ARRAY_LENGTH(array) (sizeof(::__ArraySizeHelper(array)))
|
||||
# else
|
||||
# define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
|
||||
# endif
|
||||
#endif /* ARRAY_LENGTH */
|
||||
|
||||
#ifndef ARRAY_END
|
||||
# define ARRAY_END(array) (&array[ARRAY_LENGTH(array)])
|
||||
# define ARRAY_END(array) (&array[ARRAY_LENGTH(array)])
|
||||
#endif /* ARRAY_END */
|
||||
|
||||
#ifndef STRINGIFY
|
||||
# define STRINGIFY_HELPER(x) #x
|
||||
# define STRINGIFY(x) STRINGIFY_HELPER(x)
|
||||
# define STRINGIFY_HELPER(x) #x
|
||||
# define STRINGIFY(x) STRINGIFY_HELPER(x)
|
||||
#endif /* STRINGIFY */
|
||||
|
||||
#ifndef offsetof
|
||||
# define offsetof(type, member) __builtin_offsetof(type, member)
|
||||
# define offsetof(type, member) __builtin_offsetof(type, member)
|
||||
#endif /* offsetof */
|
||||
|
||||
#ifndef container_of
|
||||
# define container_of(ptr, type, member) \
|
||||
((type *)((char *)(ptr) - offsetof(type, member)))
|
||||
# define container_of(ptr, type, member) \
|
||||
((type *)((char *)(ptr) - offsetof(type, member)))
|
||||
#endif /* container_of */
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
Reference in New Issue
Block a user