Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:33:29

0001 //
0002 // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
0003 // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
0004 //
0005 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0006 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // Official repository: https://github.com/boostorg/url
0009 //
0010 
0011 #ifndef BOOST_URL_DETAIL_CONFIG_HPP
0012 #define BOOST_URL_DETAIL_CONFIG_HPP
0013 
0014 #include <boost/config.hpp>
0015 #include <boost/config/workaround.hpp>
0016 #include <limits.h>
0017 #include <stdint.h>
0018 
0019 #if CHAR_BIT != 8
0020 # error unsupported platform
0021 #endif
0022 
0023 // Determine if compiling as a dynamic library
0024 #if (defined(BOOST_URL_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_URL_STATIC_LINK)
0025 #    define BOOST_URL_BUILD_DLL
0026 #endif
0027 
0028 // Set visibility flags
0029 #if !defined(BOOST_URL_BUILD_DLL)
0030 #    define BOOST_URL_DECL /* static library */
0031 #elif defined(BOOST_URL_SOURCE)
0032 #    define BOOST_URL_DECL BOOST_SYMBOL_EXPORT /* source: dllexport/visibility */
0033 #else
0034 #    define BOOST_URL_DECL BOOST_SYMBOL_IMPORT /* header: dllimport */
0035 #endif
0036 
0037 // Set up auto-linker
0038 # if !defined(BOOST_URL_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_URL_NO_LIB)
0039 #  define BOOST_LIB_NAME boost_url
0040 #  if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_URL_DYN_LINK)
0041 #   define BOOST_DYN_LINK
0042 #  endif
0043 #  include <boost/config/auto_link.hpp>
0044 # endif
0045 
0046 // Set up SSE2
0047 #if ! defined(BOOST_URL_NO_SSE2) && \
0048     ! defined(BOOST_URL_USE_SSE2)
0049 # if (defined(_M_IX86) && _M_IX86_FP == 2) || \
0050       defined(_M_X64) || defined(__SSE2__)
0051 #  define BOOST_URL_USE_SSE2
0052 # endif
0053 #endif
0054 
0055 // constexpr
0056 #if BOOST_WORKAROUND( BOOST_GCC_VERSION, <= 72000 ) || \
0057     BOOST_WORKAROUND( BOOST_CLANG_VERSION, <= 35000 )
0058 # define BOOST_URL_CONSTEXPR
0059 #else
0060 # define BOOST_URL_CONSTEXPR constexpr
0061 #endif
0062 
0063 // Add source location to error codes
0064 #ifdef BOOST_URL_NO_SOURCE_LOCATION
0065 # define BOOST_URL_ERR(ev) (::boost::system::error_code(ev))
0066 # define BOOST_URL_RETURN_EC(ev) return (ev)
0067 # define BOOST_URL_POS ::boost::source_location()
0068 #else
0069 # define BOOST_URL_ERR(ev) (::boost::system::error_code( (ev), [] { \
0070          static constexpr auto loc((BOOST_CURRENT_LOCATION)); \
0071          return &loc; }()))
0072 # define BOOST_URL_RETURN_EC(ev) \
0073     static constexpr auto loc ## __LINE__((BOOST_CURRENT_LOCATION)); \
0074     return ::boost::system::error_code((ev), &loc ## __LINE__)
0075 # define BOOST_URL_POS (BOOST_CURRENT_LOCATION)
0076 #endif
0077 
0078 // String token parameters
0079 #ifndef BOOST_URL_STRTOK_TPARAM
0080 #define BOOST_URL_STRTOK_TPARAM class StringToken = string_token::return_string
0081 #endif
0082 #ifndef BOOST_URL_STRTOK_RETURN
0083 #define BOOST_URL_STRTOK_RETURN typename StringToken::result_type
0084 #endif
0085 #ifndef BOOST_URL_STRTOK_ARG
0086 #define BOOST_URL_STRTOK_ARG(name) StringToken&& token = {}
0087 #endif
0088 
0089 // Move
0090 #if BOOST_WORKAROUND( BOOST_GCC_VERSION, < 80000 ) || \
0091     BOOST_WORKAROUND( BOOST_CLANG_VERSION, < 30900 )
0092 #define BOOST_URL_RETURN(x) return std::move((x))
0093 #else
0094 #define BOOST_URL_RETURN(x) return (x)
0095 #endif
0096 
0097 // Limit tests
0098 #ifndef BOOST_URL_MAX_SIZE
0099 // we leave room for a null,
0100 // and still fit in size_t
0101 #define BOOST_URL_MAX_SIZE ((std::size_t(-1))-1)
0102 #endif
0103 
0104 // noinline attribute
0105 #ifdef BOOST_GCC
0106 #define BOOST_URL_NO_INLINE [[gnu::noinline]]
0107 #else
0108 #define BOOST_URL_NO_INLINE
0109 #endif
0110 
0111 // libstdcxx copy-on-write strings
0112 #ifndef BOOST_URL_COW_STRINGS
0113 #if defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 60000 || (defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0))
0114 #define BOOST_URL_COW_STRINGS
0115 #endif
0116 #endif
0117 
0118 // detect 32/64 bit
0119 #if UINTPTR_MAX == UINT64_MAX
0120 # define BOOST_URL_ARCH 64
0121 #elif UINTPTR_MAX == UINT32_MAX
0122 # define BOOST_URL_ARCH 32
0123 #else
0124 # error Unknown or unsupported architecture, please open an issue
0125 #endif
0126 
0127 // deprecated attribute
0128 #if defined(BOOST_MSVC) || defined(BOOST_URL_DOCS)
0129 #define BOOST_URL_DEPRECATED(msg)
0130 #else
0131 #define BOOST_URL_DEPRECATED(msg) BOOST_DEPRECATED(msg)
0132 #endif
0133 
0134 // avoid Boost.TypeTraits for these traits
0135 namespace boost {
0136 namespace urls {
0137 
0138 template<class...> struct make_void { typedef void type; };
0139 template<class... Ts> using void_t = typename make_void<Ts...>::type;
0140 
0141 } // urls
0142 } // boost
0143 
0144 #endif