codec/include/nil/crypto3/detail/config.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2018-2020 Mikhail Komarov <nemo@nil.foundation>
3 //
4 // MIT License
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //---------------------------------------------------------------------------//
24 // @file This file is used to define various compiler-dependent attributes macros
25 // absent in Boost.Config until following PRs are accepted:
26 // https://github.com/boostorg/config/pull/338,
27 // https://github.com/boostorg/config/pull/339
28 //---------------------------------------------------------------------------//
29 
30 #ifndef CRYPTO3_DETAIL_CONFIG_HPP
31 #define CRYPTO3_DETAIL_CONFIG_HPP
32 
33 #include <boost/config.hpp>
34 
35 #ifdef BOOST_CLANG
36 #if (__clang_major__ >= 4 || (__clang_major__ >= 3 && __clang_minor__ >= 8))
37 #define BOOST_ATTRIBUTE_TARGET(isa) __attribute__((target(isa)))
38 #endif
39 
40 #if defined(__clang__) && !defined(_MSC_VER)
41 #define BOOST_ATTRIBUTE_MALLOC_FUNCTION __attribute__((malloc))
42 #endif
43 #endif
44 
45 #ifdef BOOST_GCC
46 #if (BOOST_GCC_VERSION >= 40800)
47 #define BOOST_ATTRIBUTE_TARGET(isa) __attribute__((target(isa)))
48 #endif
49 
50 #define BOOST_ATTRIBUTE_MALLOC_FUNCTION __attribute__((malloc))
51 #endif
52 
53 #if defined(_MSC_VER)
54 #define BOOST_ATTRIBUTE_MALLOC_FUNCTION __declspec(restrict)
55 #endif
56 
57 #endif // CRYPTO3_PREDEF_HPP