]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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(__SUNPRO_CC) | |
65 | // This macro indicates we're using older binutils that don't support implied zero displacements for memory opereands, | |
66 | // making code like this invalid: | |
67 | // movl 4+(%%edx), %%eax | |
68 | #define BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS | |
69 | #endif | |
70 | ||
71 | #if defined(__clang__) || (defined(BOOST_GCC) && (BOOST_GCC+0) < 40500) || defined(__SUNPRO_CC) | |
72 | // This macro indicates that the compiler does not support allocating rax:rdx register pairs ("A") in asm blocks | |
73 | #define BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS | |
74 | #endif | |
75 | ||
76 | #endif // BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_ |