From 964ee00116dedc218e456ada11efd81c22feb429 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: Wed, 23 Oct 2024 11:26:09 +0300 Subject: [PATCH] =?UTF-8?q?mdbx:=20=D0=BA=D0=BE=D1=81=D1=82=D1=8B=D0=BB?= =?UTF-8?q?=D1=8C=20=D0=B4=D0=BB=D1=8F=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=80?= =?UTF-8?q?=D1=80=D0=B5=D0=BA=D1=82=D0=BD=D0=BE=D0=B9=20=D0=BE=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=BA=D0=B8=20`[[gnu::pure]]`=20=D0=B2?= =?UTF-8?q?=20Apple=20Clang.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mdbx.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/mdbx.h b/mdbx.h index 2a6a29d9..e3915991 100644 --- a/mdbx.h +++ b/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