]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/atomic/detail/config.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / atomic / detail / config.hpp
1 /*
2 * Distributed under the Boost Software License, Version 1.0.
3 * (See accompanying file LICENSE_1_0.txt or copy at
4 * http://www.boost.org/LICENSE_1_0.txt)
5 *
6 * Copyright (c) 2012 Hartmut Kaiser
7 * Copyright (c) 2014 Andrey Semashev
8 */
9 /*!
10 * \file atomic/detail/config.hpp
11 *
12 * This header defines configuraion macros for Boost.Atomic
13 */
14
15 #ifndef BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_
16 #define BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_
17
18 #include <boost/config.hpp>
19
20 #ifdef BOOST_HAS_PRAGMA_ONCE
21 #pragma once
22 #endif
23
24 #if defined(__has_builtin)
25 #if __has_builtin(__builtin_memcpy)
26 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY
27 #endif
28 #if __has_builtin(__builtin_memcmp)
29 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP
30 #endif
31 #elif defined(BOOST_GCC)
32 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY
33 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP
34 #endif
35
36 #if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY)
37 #define BOOST_ATOMIC_DETAIL_MEMCPY __builtin_memcpy
38 #else
39 #define BOOST_ATOMIC_DETAIL_MEMCPY std::memcpy
40 #endif
41
42 #if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP)
43 #define BOOST_ATOMIC_DETAIL_MEMCMP __builtin_memcmp
44 #else
45 #define BOOST_ATOMIC_DETAIL_MEMCMP std::memcmp
46 #endif
47
48 #if defined(__CUDACC__)
49 // nvcc does not support alternatives in asm statement constraints
50 #define BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES
51 // nvcc does not support condition code register ("cc") clobber in asm statements
52 #define BOOST_ATOMIC_DETAIL_NO_ASM_CLOBBER_CC
53 #endif
54
55 #if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CLOBBER_CC)
56 #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC "cc"
57 #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "cc",
58 #else
59 #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
60 #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA
61 #endif
62
63 #if ((defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 403)) ||\
64 (defined(BOOST_GCC) && (BOOST_GCC+0) >= 70000) /* gcc 7 emits assembler warnings when zero displacement is implied */ ||\
65 defined(__SUNPRO_CC)
66 // This macro indicates we're using older binutils that don't support implied zero displacements for memory opereands,
67 // making code like this invalid:
68 // movl 4+(%%edx), %%eax
69 #define BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS
70 #endif
71
72 #if defined(__clang__) || (defined(BOOST_GCC) && (BOOST_GCC+0) < 40500) || defined(__SUNPRO_CC)
73 // This macro indicates that the compiler does not support allocating rax:rdx register pairs ("A") in asm blocks
74 #define BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS
75 #endif
76
77 #if defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
78 #if !(defined(BOOST_LIBSTDCXX11) && (BOOST_LIBSTDCXX_VERSION+0) >= 40700) /* libstdc++ from gcc >= 4.7 in C++11 mode */
79 // This macro indicates that there is no <type_traits> standard header that is sufficient for Boost.Atomic needs.
80 #define BOOST_ATOMIC_DETAIL_NO_CXX11_HDR_TYPE_TRAITS
81 #endif
82 #endif // defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
83
84 // Enable pointer/reference casts between storage and value when possible.
85 // Note: Despite that MSVC does not employ strict aliasing rules for optimizations
86 // and does not require an explicit markup for types that may alias, we still don't
87 // enable the optimization for this compiler because at least MSVC-8 and 9 are known
88 // to generate broken code sometimes when casts are used.
89 #define BOOST_ATOMIC_DETAIL_MAY_ALIAS BOOST_MAY_ALIAS
90 #if !defined(BOOST_NO_MAY_ALIAS)
91 #define BOOST_ATOMIC_DETAIL_STORAGE_TYPE_MAY_ALIAS
92 #endif
93
94 #if defined(__GCC_ASM_FLAG_OUTPUTS__)
95 // The compiler supports output values in flag registers.
96 // See: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html, Section 6.44.3.
97 #define BOOST_ATOMIC_DETAIL_ASM_HAS_FLAG_OUTPUTS
98 #endif
99
100 #if defined(__has_builtin)
101 #if __has_builtin(__builtin_constant_p)
102 #define BOOST_ATOMIC_DETAIL_IS_CONSTANT(x) __builtin_constant_p(x)
103 #endif
104 #elif defined(__GNUC__)
105 #define BOOST_ATOMIC_DETAIL_IS_CONSTANT(x) __builtin_constant_p(x)
106 #endif
107
108 #if !defined(BOOST_ATOMIC_DETAIL_IS_CONSTANT)
109 #define BOOST_ATOMIC_DETAIL_IS_CONSTANT(x) false
110 #endif
111
112 #endif // BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_