Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:44:22

0001 /*
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * http://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * Copyright (c) 2012 Hartmut Kaiser
0007  * Copyright (c) 2014-2018, 2020-2021 Andrey Semashev
0008  */
0009 /*!
0010  * \file   atomic/detail/config.hpp
0011  *
0012  * This header defines configuraion macros for Boost.Atomic
0013  */
0014 
0015 #ifndef BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_
0016 #define BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_
0017 
0018 #include <boost/config.hpp>
0019 
0020 #ifdef BOOST_HAS_PRAGMA_ONCE
0021 #pragma once
0022 #endif
0023 
0024 #if defined(__CUDACC__)
0025 // nvcc does not support alternatives ("q,m") in asm statement constraints
0026 #define BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES
0027 // nvcc does not support condition code register ("cc") clobber in asm statements
0028 #define BOOST_ATOMIC_DETAIL_NO_ASM_CLOBBER_CC
0029 #endif
0030 
0031 #if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CLOBBER_CC)
0032 #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC "cc"
0033 #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "cc",
0034 #else
0035 #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
0036 #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA
0037 #endif
0038 
0039 #if (defined(__i386__) || defined(__x86_64__)) && (defined(__clang__) || (defined(BOOST_GCC) && BOOST_GCC < 40500) || defined(__SUNPRO_CC))
0040 // This macro indicates that the compiler does not support allocating eax:edx or rax:rdx register pairs ("A") in asm blocks
0041 #define BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS
0042 #endif
0043 
0044 #if defined(__i386__) && (defined(__PIC__) || defined(__PIE__)) && !(defined(__clang__) || (defined(BOOST_GCC) && BOOST_GCC >= 50100))
0045 // This macro indicates that asm blocks should preserve ebx value unchanged. Some compilers are able to maintain ebx themselves
0046 // around the asm blocks. For those compilers we don't need to save/restore ebx in asm blocks.
0047 #define BOOST_ATOMIC_DETAIL_X86_ASM_PRESERVE_EBX
0048 #endif
0049 
0050 #if defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
0051 #if !(defined(BOOST_LIBSTDCXX11) && BOOST_LIBSTDCXX_VERSION >= 40700) /* libstdc++ from gcc >= 4.7 in C++11 mode */
0052 // This macro indicates that there is not even a basic <type_traits> standard header that is sufficient for most Boost.Atomic needs.
0053 #define BOOST_ATOMIC_DETAIL_NO_CXX11_BASIC_HDR_TYPE_TRAITS
0054 #endif
0055 #endif // defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
0056 
0057 #if defined(BOOST_NO_CXX11_ALIGNAS) ||\
0058     (defined(BOOST_GCC) && BOOST_GCC < 40900) ||\
0059     (defined(BOOST_MSVC) && BOOST_MSVC < 1910 && defined(_M_IX86))
0060 // gcc prior to 4.9 doesn't support alignas with a constant expression as an argument.
0061 // MSVC 14.0 does support alignas, but in 32-bit mode emits "error C2719: formal parameter with requested alignment of N won't be aligned" for N > 4,
0062 // when aligned types are used in function arguments, even though the std::max_align_t type has alignment of 8.
0063 #define BOOST_ATOMIC_DETAIL_NO_CXX11_ALIGNAS
0064 #endif
0065 
0066 #if defined(BOOST_NO_CXX11_CONSTEXPR) || (defined(BOOST_GCC) && BOOST_GCC < 40800)
0067 // This macro indicates that the compiler doesn't support constexpr constructors that initialize one member
0068 // of an anonymous union member of the class.
0069 #define BOOST_ATOMIC_DETAIL_NO_CXX11_CONSTEXPR_UNION_INIT
0070 #endif
0071 
0072 #if !defined(BOOST_ATOMIC_DETAIL_NO_CXX11_CONSTEXPR_UNION_INIT)
0073 #define BOOST_ATOMIC_DETAIL_CONSTEXPR_UNION_INIT BOOST_CONSTEXPR
0074 #else
0075 #define BOOST_ATOMIC_DETAIL_CONSTEXPR_UNION_INIT
0076 #endif
0077 
0078 // Enable pointer/reference casts between storage and value when possible.
0079 // Note: Despite that MSVC does not employ strict aliasing rules for optimizations
0080 // and does not require an explicit markup for types that may alias, we still don't
0081 // enable the optimization for this compiler because at least MSVC-8 and 9 are known
0082 // to generate broken code sometimes when casts are used.
0083 #define BOOST_ATOMIC_DETAIL_MAY_ALIAS BOOST_MAY_ALIAS
0084 #if !defined(BOOST_NO_MAY_ALIAS)
0085 #define BOOST_ATOMIC_DETAIL_STORAGE_TYPE_MAY_ALIAS
0086 #endif
0087 
0088 #if defined(__GCC_ASM_FLAG_OUTPUTS__)
0089 // The compiler supports output values in flag registers.
0090 // See: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html, Section 6.44.3.
0091 #define BOOST_ATOMIC_DETAIL_ASM_HAS_FLAG_OUTPUTS
0092 #endif
0093 
0094 #if defined(BOOST_INTEL) || (defined(BOOST_GCC) && BOOST_GCC < 40700) ||\
0095     (defined(BOOST_CLANG) && !defined(__apple_build_version__) && (__clang_major__ * 100 + __clang_minor__) < 302) ||\
0096     (defined(__clang__) && defined(__apple_build_version__) && (__clang_major__ * 100 + __clang_minor__) < 402)
0097 // Intel compiler (at least 18.0 update 1) breaks if noexcept specification is used in defaulted function declarations:
0098 // error: the default constructor of "boost::atomics::atomic<T>" cannot be referenced -- it is a deleted function
0099 // GCC 4.6 doesn't seem to support that either. Clang 3.1 deduces wrong noexcept for the defaulted function and fails as well.
0100 #define BOOST_ATOMIC_DETAIL_DEF_NOEXCEPT_DECL
0101 #define BOOST_ATOMIC_DETAIL_DEF_NOEXCEPT_IMPL BOOST_NOEXCEPT
0102 #else
0103 #define BOOST_ATOMIC_DETAIL_DEF_NOEXCEPT_DECL BOOST_NOEXCEPT
0104 #define BOOST_ATOMIC_DETAIL_DEF_NOEXCEPT_IMPL
0105 #endif
0106 
0107 #if defined(__has_builtin)
0108 #if __has_builtin(__builtin_constant_p)
0109 #define BOOST_ATOMIC_DETAIL_IS_CONSTANT(x) __builtin_constant_p(x)
0110 #endif
0111 #if __has_builtin(__builtin_clear_padding)
0112 #define BOOST_ATOMIC_DETAIL_CLEAR_PADDING(x) __builtin_clear_padding(x)
0113 #elif __has_builtin(__builtin_zero_non_value_bits)
0114 #define BOOST_ATOMIC_DETAIL_CLEAR_PADDING(x) __builtin_zero_non_value_bits(x)
0115 #endif
0116 #endif
0117 
0118 #if !defined(BOOST_ATOMIC_DETAIL_IS_CONSTANT) && defined(__GNUC__)
0119 #define BOOST_ATOMIC_DETAIL_IS_CONSTANT(x) __builtin_constant_p(x)
0120 #endif
0121 
0122 #if !defined(BOOST_ATOMIC_DETAIL_IS_CONSTANT)
0123 #define BOOST_ATOMIC_DETAIL_IS_CONSTANT(x) false
0124 #endif
0125 
0126 #if !defined(BOOST_ATOMIC_DETAIL_CLEAR_PADDING) && defined(BOOST_MSVC) && BOOST_MSVC >= 1927
0127 // Note that as of MSVC 19.29 this intrinsic does not clear padding in unions:
0128 // https://developercommunity.visualstudio.com/t/__builtin_zero_non_value_bits-does-not-c/1551510
0129 #define BOOST_ATOMIC_DETAIL_CLEAR_PADDING(x) __builtin_zero_non_value_bits(x)
0130 #endif
0131 
0132 #if !defined(BOOST_ATOMIC_DETAIL_CLEAR_PADDING)
0133 #define BOOST_ATOMIC_NO_CLEAR_PADDING
0134 #define BOOST_ATOMIC_DETAIL_CLEAR_PADDING(x)
0135 #endif
0136 
0137 #if (defined(__BYTE_ORDER__) && defined(__FLOAT_WORD_ORDER__) && __BYTE_ORDER__ == __FLOAT_WORD_ORDER__) ||\
0138     defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
0139 // This macro indicates that integer and floating point endianness is the same
0140 #define BOOST_ATOMIC_DETAIL_INT_FP_ENDIAN_MATCH
0141 #endif
0142 
0143 #endif // BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_