mdbx: fix __pure_function & __const_function for CLANG & C++ exceptions.

This is crutch for https://bugs.llvm.org/show_bug.cgi?id=43275

Change-Id: I6d29456cd83f8e713a5b1f6b50ac721bf985148f
This commit is contained in:
Leonid Yuriev 2020-07-04 19:36:11 +03:00
parent 500fed496c
commit 5a25c7c5fb

View File

@ -214,7 +214,9 @@
* Such a function can be subject to common subexpression elimination * Such a function can be subject to common subexpression elimination
* and loop optimization just as an arithmetic operator would be. * and loop optimization just as an arithmetic operator would be.
* These functions should be declared with the attribute pure. */ * These functions should be declared with the attribute pure. */
# if defined(__GNUC__) || __has_attribute(__pure__) # if (defined(__GNUC__) || __has_attribute(__pure__)) && \
(!defined(__clang__) /* https://bugs.llvm.org/show_bug.cgi?id=43275 */ \
|| !defined(__cplusplus) || !__has_feature(cxx_exceptions))
# define __pure_function __attribute__((__pure__)) # define __pure_function __attribute__((__pure__))
# else # else
# define __pure_function # define __pure_function
@ -231,7 +233,9 @@
* data pointed to must not be declared const. Likewise, a function * data pointed to must not be declared const. Likewise, a function
* that calls a non-const function usually must not be const. * that calls a non-const function usually must not be const.
* It does not make sense for a const function to return void. */ * It does not make sense for a const function to return void. */
# if defined(__GNUC__) || __has_attribute(__const__) # if (defined(__GNUC__) || __has_attribute(__pure__)) && \
(!defined(__clang__) /* https://bugs.llvm.org/show_bug.cgi?id=43275 */ \
|| !defined(__cplusplus) || !__has_feature(cxx_exceptions))
# define __const_function __attribute__((__const__)) # define __const_function __attribute__((__const__))
# else # else
# define __const_function # define __const_function