mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-29 09:58:48 +08:00
mdbx: костыль для некорректной обработки [[gnu::pure]]
в Apple Clang.
This commit is contained in:
parent
b43eed2c2b
commit
964ee00116
18
mdbx.h
18
mdbx.h
@ -218,10 +218,14 @@ typedef mode_t mdbx_mode_t;
|
||||
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(x) (0)
|
||||
#define __has_exceptions_disabled (0)
|
||||
#else
|
||||
#define __has_exceptions_disabled \
|
||||
(__has_feature(cxx_noexcept) && !__has_feature(cxx_exceptions))
|
||||
#endif /* __has_feature */
|
||||
|
||||
#ifndef __has_extension
|
||||
#define __has_extension(x) (0)
|
||||
#define __has_extension(x) __has_feature(x)
|
||||
#endif /* __has_extension */
|
||||
|
||||
#ifndef __has_builtin
|
||||
@ -236,11 +240,13 @@ typedef mode_t mdbx_mode_t;
|
||||
* These functions should be declared with the attribute pure. */
|
||||
#if defined(DOXYGEN)
|
||||
#define MDBX_PURE_FUNCTION [[gnu::pure]]
|
||||
#elif __has_C23_or_CXX_attribute(gnu::pure)
|
||||
#elif __has_C23_or_CXX_attribute(gnu::pure) && \
|
||||
(!defined(__apple_build_version__) || !defined(__clang_major__) || \
|
||||
__clang_major__ > 17)
|
||||
#define MDBX_PURE_FUNCTION [[gnu::pure]]
|
||||
#elif (defined(__GNUC__) || __has_attribute(__pure__)) && \
|
||||
(!defined(__clang__) /* https://bugs.llvm.org/show_bug.cgi?id=43275 */ || \
|
||||
!defined(__cplusplus) || !__has_feature(cxx_exceptions))
|
||||
!defined(__cplusplus) || __has_exceptions_disabled)
|
||||
#define MDBX_PURE_FUNCTION __attribute__((__pure__))
|
||||
#else
|
||||
#define MDBX_PURE_FUNCTION
|
||||
@ -278,11 +284,13 @@ typedef mode_t mdbx_mode_t;
|
||||
* It does not make sense for a const function to return void. */
|
||||
#if defined(DOXYGEN)
|
||||
#define MDBX_CONST_FUNCTION [[gnu::const]]
|
||||
#elif __has_C23_or_CXX_attribute(gnu::const)
|
||||
#elif __has_C23_or_CXX_attribute(gnu::const) && \
|
||||
(!defined(__apple_build_version__) || !defined(__clang_major__) || \
|
||||
__clang_major__ > 17)
|
||||
#define MDBX_CONST_FUNCTION [[gnu::const]]
|
||||
#elif (defined(__GNUC__) || __has_attribute(__const__)) && \
|
||||
(!defined(__clang__) /* https://bugs.llvm.org/show_bug.cgi?id=43275 */ || \
|
||||
!defined(__cplusplus) || !__has_feature(cxx_exceptions))
|
||||
!defined(__cplusplus) || __has_exceptions_disabled)
|
||||
#define MDBX_CONST_FUNCTION __attribute__((__const__))
|
||||
#else
|
||||
#define MDBX_CONST_FUNCTION MDBX_PURE_FUNCTION
|
||||
|
Loading…
x
Reference in New Issue
Block a user