|
||||
File indexing completed on 2024-11-15 09:13:46
0001 /*! 0002 @file 0003 Defines configuration macros used throughout the library. 0004 0005 Copyright Louis Dionne 2013-2022 0006 Distributed under the Boost Software License, Version 1.0. 0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 0008 */ 0009 0010 #ifndef BOOST_HANA_CONFIG_HPP 0011 #define BOOST_HANA_CONFIG_HPP 0012 0013 #include <boost/hana/version.hpp> 0014 0015 0016 ////////////////////////////////////////////////////////////////////////////// 0017 // Detect the compiler 0018 ////////////////////////////////////////////////////////////////////////////// 0019 0020 #if defined(_MSC_VER) && !defined(__clang__) // MSVC 0021 // This must be checked first, because otherwise it produces a fatal 0022 // error due to unrecognized #warning directives used below. 0023 0024 # if _MSC_VER < 1915 0025 # pragma message("Warning: the native Microsoft compiler is not supported due to lack of proper C++14 support.") 0026 # else 0027 // 1. Active issues 0028 // Multiple copy/move ctors 0029 # define BOOST_HANA_WORKAROUND_MSVC_MULTIPLECTOR_106654 0030 0031 // 2. Issues fixed in the development branch of MSVC 0032 // Forward declaration of class template member function returning decltype(auto) 0033 # define BOOST_HANA_WORKAROUND_MSVC_DECLTYPEAUTO_RETURNTYPE_662735 0034 0035 // 3. Issues fixed conditionally 0036 // Requires __declspec(empty_bases) 0037 // Empty base optimization 0038 # define BOOST_HANA_WORKAROUND_MSVC_EMPTYBASE 0039 0040 // Requires /experimental:preprocessor 0041 // Variadic macro expansion 0042 # if !defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL 0043 # define BOOST_HANA_WORKAROUND_MSVC_PREPROCESSOR_616033 0044 # endif 0045 # endif 0046 0047 #elif defined(__clang__) && defined(_MSC_VER) // Clang-cl (Clang for Windows) 0048 0049 # define BOOST_HANA_CONFIG_CLANG_CL 0050 # define BOOST_HANA_CONFIG_CLANG BOOST_HANA_CONFIG_VERSION( \ 0051 __clang_major__, __clang_minor__, __clang_patchlevel__) 0052 0053 #elif defined(__clang__) && defined(__apple_build_version__) // Apple's Clang 0054 0055 # define BOOST_HANA_CONFIG_APPLE_CLANG 0056 # if __apple_build_version__ >= 6020049 0057 # define BOOST_HANA_CONFIG_CLANG BOOST_HANA_CONFIG_VERSION(3, 6, 0) 0058 # endif 0059 0060 #elif defined(__clang__) // genuine Clang 0061 0062 # define BOOST_HANA_CONFIG_CLANG BOOST_HANA_CONFIG_VERSION( \ 0063 __clang_major__, __clang_minor__, __clang_patchlevel__) 0064 0065 #elif defined(__GNUC__) // GCC 0066 0067 # define BOOST_HANA_CONFIG_GCC BOOST_HANA_CONFIG_VERSION( \ 0068 __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) 0069 0070 #endif 0071 0072 ////////////////////////////////////////////////////////////////////////////// 0073 // Check the compiler for general C++14 capabilities 0074 ////////////////////////////////////////////////////////////////////////////// 0075 #if (__cplusplus < 201400) 0076 # if defined(_MSC_VER) 0077 # if _MSC_VER < 1915 0078 # pragma message("Warning: Your compiler doesn't provide C++14 or higher capabilities. Try adding the compiler flag '-std=c++14' or '-std=c++1y'.") 0079 # endif 0080 # else 0081 # warning "Your compiler doesn't provide C++14 or higher capabilities. Try adding the compiler flag '-std=c++14' or '-std=c++1y'." 0082 # endif 0083 #endif 0084 0085 ////////////////////////////////////////////////////////////////////////////// 0086 // Caveats and other compiler-dependent options 0087 ////////////////////////////////////////////////////////////////////////////// 0088 0089 // `BOOST_HANA_CONFIG_HAS_CONSTEXPR_LAMBDA` enables some constructs requiring 0090 // `constexpr` lambdas, which are in the language starting with C++17. 0091 // 0092 // Always disabled for now because Clang only has partial support for them 0093 // (captureless lambdas only). 0094 #if defined(__cplusplus) && __cplusplus > 201402L 0095 # define BOOST_HANA_CONSTEXPR_STATELESS_LAMBDA constexpr 0096 // # define BOOST_HANA_CONFIG_HAS_CONSTEXPR_LAMBDA 0097 #else 0098 # define BOOST_HANA_CONSTEXPR_STATELESS_LAMBDA /* nothing */ 0099 #endif 0100 0101 // `BOOST_HANA_CONSTEXPR_LAMBDA` expands to `constexpr` if constexpr lambdas 0102 // are supported and to nothing otherwise. 0103 #if defined(BOOST_HANA_CONFIG_HAS_CONSTEXPR_LAMBDA) 0104 # define BOOST_HANA_CONSTEXPR_LAMBDA constexpr 0105 #else 0106 # define BOOST_HANA_CONSTEXPR_LAMBDA /* nothing */ 0107 #endif 0108 0109 // `BOOST_HANA_INLINE_VARIABLE` expands to `inline` when C++17 inline variables 0110 // are supported, and to nothing otherwise. This allows marking global variables 0111 // defined in a header as `inline` to avoid potential ODR violations. 0112 #if defined(__cplusplus) && __cplusplus > 201402L 0113 # define BOOST_HANA_INLINE_VARIABLE inline 0114 #else 0115 # define BOOST_HANA_INLINE_VARIABLE /* nothing */ 0116 #endif 0117 0118 ////////////////////////////////////////////////////////////////////////////// 0119 // Library features and options that can be tweaked by users 0120 ////////////////////////////////////////////////////////////////////////////// 0121 0122 #if defined(BOOST_HANA_DOXYGEN_INVOKED) || \ 0123 (defined(NDEBUG) && !defined(BOOST_HANA_CONFIG_DISABLE_ASSERTIONS)) 0124 //! @ingroup group-config 0125 //! Disables the `BOOST_HANA_*_ASSERT` macro & friends. 0126 //! 0127 //! When this macro is defined, the `BOOST_HANA_*_ASSERT` macro & friends 0128 //! are disabled, i.e. they expand to nothing. 0129 //! 0130 //! This macro is defined automatically when `NDEBUG` is defined. It can 0131 //! also be defined by users before including this header or defined on 0132 //! the command line. 0133 # define BOOST_HANA_CONFIG_DISABLE_ASSERTIONS 0134 #endif 0135 0136 #if defined(BOOST_HANA_DOXYGEN_INVOKED) 0137 //! @ingroup group-config 0138 //! Disables concept checks in interface methods. 0139 //! 0140 //! When this macro is not defined (the default), tag-dispatched methods 0141 //! will make sure the arguments they are passed are models of the proper 0142 //! concept(s). This can be very helpful in catching programming errors, 0143 //! but it is also slightly less compile-time efficient. You should 0144 //! probably always leave the checks enabled (and hence never define this 0145 //! macro), except perhaps in translation units that are compiled very 0146 //! often but whose code using Hana is modified very rarely. 0147 # define BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS 0148 #endif 0149 0150 #if defined(BOOST_HANA_DOXYGEN_INVOKED) 0151 //! @ingroup group-config 0152 //! Enables usage of the "string literal operator template" GNU extension. 0153 //! 0154 //! That operator is not part of the language yet, but it is supported by 0155 //! both Clang and GCC. This operator allows Hana to provide the nice `_s` 0156 //! user-defined literal for creating compile-time strings. 0157 //! 0158 //! When this macro is not defined, the GNU extension will be not used 0159 //! by Hana. Because this is a non-standard extension, the macro is not 0160 //! defined by default. 0161 # define BOOST_HANA_CONFIG_ENABLE_STRING_UDL 0162 #endif 0163 0164 #if defined(BOOST_HANA_DOXYGEN_INVOKED) 0165 //! @ingroup group-config 0166 //! Enables additional assertions and sanity checks to be done by Hana. 0167 //! 0168 //! When this macro is defined (it is __not defined__ by default), 0169 //! additional sanity checks may be done by Hana. These checks may 0170 //! be costly to perform, either in terms of compilation time or in 0171 //! terms of execution time. These checks may help debugging an 0172 //! application during its initial development, but they should not 0173 //! be enabled as part of the normal configuration. 0174 # define BOOST_HANA_CONFIG_ENABLE_DEBUG_MODE 0175 #endif 0176 0177 #endif // !BOOST_HANA_CONFIG_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |