1#ifndef BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED
2#define BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED
3
4// Copyright 2016, 2018, 2019 Peter Dimov.
5//
6// Distributed under the Boost Software License, Version 1.0.
7//
8// See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt
10
11// BOOST_MP11_WORKAROUND
12
13#if defined( BOOST_STRICT_CONFIG ) || defined( BOOST_MP11_NO_WORKAROUNDS )
14
15# define BOOST_MP11_WORKAROUND( symbol, test ) 0
16
17#else
18
19# define BOOST_MP11_WORKAROUND( symbol, test ) ((symbol) != 0 && ((symbol) test))
20
21#endif
22
23//
24
25#define BOOST_MP11_CUDA 0
26#define BOOST_MP11_CLANG 0
27#define BOOST_MP11_INTEL 0
28#define BOOST_MP11_GCC 0
29#define BOOST_MP11_MSVC 0
30
31#define BOOST_MP11_CONSTEXPR constexpr
32
33#if defined( __CUDACC__ )
34
35// nvcc
36
37# undef BOOST_MP11_CUDA
38# define BOOST_MP11_CUDA (__CUDACC_VER_MAJOR__ * 1000000 + __CUDACC_VER_MINOR__ * 10000 + __CUDACC_VER_BUILD__)
39
40// CUDA (8.0) has no constexpr support in msvc mode:
41# if defined(_MSC_VER) && (BOOST_MP11_CUDA < 9000000)
42
43# define BOOST_MP11_NO_CONSTEXPR
44
45# undef BOOST_MP11_CONSTEXPR
46# define BOOST_MP11_CONSTEXPR
47
48# endif
49
50#endif
51
52#if defined(__clang__)
53
54// Clang
55
56# undef BOOST_MP11_CLANG
57# define BOOST_MP11_CLANG (__clang_major__ * 100 + __clang_minor__)
58
59# if defined(__has_cpp_attribute)
60# if __has_cpp_attribute(fallthrough) && __cplusplus >= 201406L // Clang 3.9+ in c++1z mode
61# define BOOST_MP11_HAS_FOLD_EXPRESSIONS
62# endif
63# endif
64
65#if BOOST_MP11_CLANG < 400 && __cplusplus >= 201402L \
66 && defined( __GLIBCXX__ ) && !__has_include(<shared_mutex>)
67
68// Clang pre-4 in C++14 mode, libstdc++ pre-4.9, ::gets is not defined,
69// but Clang tries to import it into std
70
71 extern "C" char *gets (char *__s);
72#endif
73
74#elif defined(__INTEL_COMPILER)
75
76// Intel C++
77
78# undef BOOST_MP11_INTEL
79# define BOOST_MP11_INTEL __INTEL_COMPILER
80
81#elif defined(__GNUC__)
82
83// g++
84
85# undef BOOST_MP11_GCC
86# define BOOST_MP11_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
87
88#elif defined(_MSC_VER)
89
90// MS Visual C++
91
92# undef BOOST_MP11_MSVC
93# define BOOST_MP11_MSVC _MSC_VER
94
95# if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 )
96# define BOOST_MP11_NO_CONSTEXPR
97# endif
98
99#if _MSC_FULL_VER < 190024210 // 2015u3
100# undef BOOST_MP11_CONSTEXPR
101# define BOOST_MP11_CONSTEXPR
102#endif
103
104#endif
105
106// BOOST_MP11_HAS_CXX14_CONSTEXPR
107
108#if !defined(BOOST_MP11_NO_CONSTEXPR) && defined(__cpp_constexpr) && __cpp_constexpr >= 201304
109# define BOOST_MP11_HAS_CXX14_CONSTEXPR
110#endif
111
112// BOOST_MP11_HAS_FOLD_EXPRESSIONS
113
114#if !defined(BOOST_MP11_HAS_FOLD_EXPRESSIONS) && defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201603
115# define BOOST_MP11_HAS_FOLD_EXPRESSIONS
116#endif
117
118// BOOST_MP11_HAS_TYPE_PACK_ELEMENT
119
120#if defined(__has_builtin)
121# if __has_builtin(__type_pack_element)
122# define BOOST_MP11_HAS_TYPE_PACK_ELEMENT
123# endif
124#endif
125
126// BOOST_MP11_HAS_TEMPLATE_AUTO
127
128#if defined(__cpp_nontype_template_parameter_auto) && __cpp_nontype_template_parameter_auto >= 201606L
129# define BOOST_MP11_HAS_TEMPLATE_AUTO
130#endif
131
132#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 )
133// mp_value<0> is bool, mp_value<-1L> is int, etc
134# undef BOOST_MP11_HAS_TEMPLATE_AUTO
135#endif
136
137// BOOST_MP11_DEPRECATED(msg)
138
139#if BOOST_MP11_WORKAROUND( BOOST_MP11_CLANG, < 304 )
140# define BOOST_MP11_DEPRECATED(msg)
141#elif defined(__GNUC__) || defined(__clang__)
142# define BOOST_MP11_DEPRECATED(msg) __attribute__((deprecated(msg)))
143#elif defined(_MSC_VER) && _MSC_VER >= 1900
144# define BOOST_MP11_DEPRECATED(msg) [[deprecated(msg)]]
145#else
146# define BOOST_MP11_DEPRECATED(msg)
147#endif
148
149#endif // #ifndef BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED
150