LCOV - code coverage report
Current view: top level - json/detail - config.hpp (source / functions) Coverage Total Hit
Test: coverage_remapped.info Lines: 100.0 % 4 4
Test Date: 2026-10-22 11:51:09 Functions: 100.0 % 5 5

           TLA  Line data    Source code
       1                 : //
       2                 : // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
       3                 : //
       4                 : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       5                 : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       6                 : //
       7                 : // Official repository: https://github.com/boostorg/json
       8                 : //
       9                 : 
      10                 : #ifndef BOOST_JSON_DETAIL_CONFIG_HPP
      11                 : #define BOOST_JSON_DETAIL_CONFIG_HPP
      12                 : 
      13                 : #include <boost/config.hpp>
      14                 : #include <boost/config/pragma_message.hpp>
      15                 : #include <boost/assert.hpp>
      16                 : #include <boost/throw_exception.hpp>
      17                 : #include <cstdint>
      18                 : #include <type_traits>
      19                 : #include <utility>
      20                 : 
      21                 : // detect 32/64 bit
      22                 : #if UINTPTR_MAX == UINT64_MAX
      23                 : # define BOOST_JSON_ARCH 64
      24                 : #elif UINTPTR_MAX == UINT32_MAX
      25                 : # define BOOST_JSON_ARCH 32
      26                 : #else
      27                 : # error Unknown or unsupported architecture, please open an issue
      28                 : #endif
      29                 : 
      30                 : #ifndef BOOST_JSON_REQUIRE_CONST_INIT
      31                 : # define BOOST_JSON_REQUIRE_CONST_INIT
      32                 : # if __cpp_constinit >= 201907L
      33                 : #  undef BOOST_JSON_REQUIRE_CONST_INIT
      34                 : #  define BOOST_JSON_REQUIRE_CONST_INIT constinit
      35                 : # elif defined(__clang__) && defined(__has_cpp_attribute)
      36                 : #  if __has_cpp_attribute(clang::require_constant_initialization)
      37                 : #   undef BOOST_JSON_REQUIRE_CONST_INIT
      38                 : #   define BOOST_JSON_REQUIRE_CONST_INIT [[clang::require_constant_initialization]]
      39                 : #  endif
      40                 : # endif
      41                 : #endif
      42                 : 
      43                 : #ifndef BOOST_JSON_NO_ATTRIBUTE_NO_DESTROY
      44                 : # if defined(__clang__) && defined(__has_cpp_attribute)
      45                 : #  if __has_cpp_attribute(clang::no_destroy)
      46                 : #     define BOOST_JSON_ATTRIBUTE_NO_DESTROY [[clang::no_destroy]]
      47                 : #  else
      48                 : #    define BOOST_JSON_NO_ATTRIBUTE_NO_DESTROY
      49                 : #  endif
      50                 : # else
      51                 : #   define BOOST_JSON_NO_ATTRIBUTE_NO_DESTROY
      52                 : # endif
      53                 : #endif
      54                 : 
      55                 : #if ! defined(BOOST_JSON_NO_SSE2) && \
      56                 :     ! defined(BOOST_JSON_USE_SSE2)
      57                 : # if (defined(_M_IX86) && _M_IX86_FP == 2) || \
      58                 :       defined(_M_X64) || defined(__SSE2__)
      59                 : #  define BOOST_JSON_USE_SSE2
      60                 : # endif
      61                 : #endif
      62                 : 
      63                 : #if defined(BOOST_JSON_DOCS)
      64                 : # define BOOST_JSON_DECL
      65                 : #else
      66                 : # if (defined(BOOST_JSON_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_JSON_STATIC_LINK)
      67                 : #  if defined(BOOST_JSON_SOURCE)
      68                 : #   define BOOST_JSON_DECL        BOOST_SYMBOL_EXPORT
      69                 : #  else
      70                 : #   define BOOST_JSON_DECL        BOOST_SYMBOL_IMPORT
      71                 : #  endif
      72                 : # endif // shared lib
      73                 : # ifndef  BOOST_JSON_DECL
      74                 : #  define BOOST_JSON_DECL
      75                 : # endif
      76                 : # if !defined(BOOST_JSON_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_JSON_NO_LIB)
      77                 : #  define BOOST_LIB_NAME boost_json
      78                 : #  if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_JSON_DYN_LINK)
      79                 : #   define BOOST_DYN_LINK
      80                 : #  endif
      81                 : #  include <boost/config/auto_link.hpp>
      82                 : # endif
      83                 : #endif
      84                 : 
      85                 : #ifndef BOOST_JSON_LIKELY
      86                 : # define BOOST_JSON_LIKELY(x) BOOST_LIKELY( !!(x) )
      87                 : #endif
      88                 : 
      89                 : #ifndef BOOST_JSON_UNLIKELY
      90                 : # define BOOST_JSON_UNLIKELY(x) BOOST_UNLIKELY( !!(x) )
      91                 : #endif
      92                 : 
      93                 : #ifndef BOOST_JSON_UNREACHABLE
      94                 : # ifdef _MSC_VER
      95                 : #  define BOOST_JSON_UNREACHABLE() __assume(0)
      96                 : # elif defined(__GNUC__) || defined(__clang__)
      97                 : #  define BOOST_JSON_UNREACHABLE() __builtin_unreachable()
      98                 : # elif defined(__has_builtin)
      99                 : #  if __has_builtin(__builtin_unreachable)
     100                 : #   define BOOST_JSON_UNREACHABLE() __builtin_unreachable()
     101                 : #  endif
     102                 : # else
     103                 : #  define BOOST_JSON_UNREACHABLE() static_cast<void>(0)
     104                 : # endif
     105                 : #endif
     106                 : 
     107                 : #ifndef BOOST_JSON_ASSUME
     108                 : # define BOOST_JSON_ASSUME(x) (!!(x) ? void() : BOOST_JSON_UNREACHABLE())
     109                 : # ifdef _MSC_VER
     110                 : #  undef BOOST_JSON_ASSUME
     111                 : #  define BOOST_JSON_ASSUME(x) __assume(!!(x))
     112                 : # elif defined(__has_builtin)
     113                 : #  if __has_builtin(__builtin_assume)
     114                 : #   undef BOOST_JSON_ASSUME
     115                 : #   define BOOST_JSON_ASSUME(x) __builtin_assume(!!(x))
     116                 : #  endif
     117                 : # endif
     118                 : #endif
     119                 : 
     120                 : // older versions of msvc and clang don't always
     121                 : // constant initialize when they are supposed to
     122                 : #ifndef BOOST_JSON_WEAK_CONSTINIT
     123                 : # if defined(_MSC_VER) && ! defined(__clang__) && _MSC_VER < 1920
     124                 : #  define BOOST_JSON_WEAK_CONSTINIT
     125                 : # elif defined(__clang__) && __clang_major__ < 4
     126                 : #  define BOOST_JSON_WEAK_CONSTINIT
     127                 : # endif
     128                 : #endif
     129                 : 
     130                 : // These macros are private, for tests, do not change
     131                 : // them or else previously built libraries won't match.
     132                 : #ifndef  BOOST_JSON_MAX_STRING_SIZE
     133                 : # define BOOST_JSON_NO_MAX_STRING_SIZE
     134                 : # define BOOST_JSON_MAX_STRING_SIZE  0x7ffffffe
     135                 : #endif
     136                 : #ifndef  BOOST_JSON_MAX_STRUCTURED_SIZE
     137                 : # define BOOST_JSON_NO_MAX_STRUCTURED_SIZE
     138                 : # define BOOST_JSON_MAX_STRUCTURED_SIZE  0x7ffffffe
     139                 : #endif
     140                 : #ifndef  BOOST_JSON_STACK_BUFFER_SIZE
     141                 : # define BOOST_JSON_NO_STACK_BUFFER_SIZE
     142                 : # if defined(__i386__) || defined(__x86_64__) || \
     143                 :      defined(_M_IX86)  || defined(_M_X64)
     144                 : #  define BOOST_JSON_STACK_BUFFER_SIZE 4096
     145                 : # else
     146                 : // If we are not on Intel, then assume we are on
     147                 : // embedded and use a smaller stack size. If this
     148                 : // is not suitable, the user can define the macro
     149                 : // themselves when building the library or including
     150                 : // src.hpp.
     151                 : #  define BOOST_JSON_STACK_BUFFER_SIZE 256
     152                 : # endif
     153                 : #endif
     154                 : 
     155                 : #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
     156                 : # define BOOST_JSON_CONSTINIT constinit
     157                 : #elif defined(__has_cpp_attribute) && defined(__clang__)
     158                 : # if __has_cpp_attribute(clang::require_constant_initialization)
     159                 : #  define BOOST_JSON_CONSTINIT [[clang::require_constant_initialization]]
     160                 : # endif
     161                 : #elif defined(__GNUC__) && (__GNUC__ >= 10)
     162                 : # define BOOST_JSON_CONSTINIT __constinit
     163                 : #endif
     164                 : #ifndef BOOST_JSON_CONSTINIT
     165                 : # define BOOST_JSON_CONSTINIT
     166                 : #endif
     167                 : 
     168                 : namespace boost {
     169                 : namespace json {
     170                 : namespace detail {
     171                 : 
     172                 : template<class...>
     173                 : struct make_void
     174                 : {
     175                 :     using type =void;
     176                 : };
     177                 : 
     178                 : template<class... Ts>
     179                 : using void_t = typename
     180                 :     make_void<Ts...>::type;
     181                 : 
     182                 : template<class T>
     183                 : using remove_cvref = typename
     184                 :     std::remove_cv<typename
     185                 :         std::remove_reference<T>::type>::type;
     186                 : 
     187                 : template<class T, class U>
     188 HIT    25058786 : T exchange(T& t, U u) noexcept
     189                 : {
     190        25058786 :     T v = std::move(t);
     191        25058786 :     t = std::move(u);
     192        25058786 :     return v;
     193                 : }
     194                 : 
     195                 : /*  This is a derivative work, original copyright:
     196                 : 
     197                 :     Copyright Eric Niebler 2013-present
     198                 : 
     199                 :     Use, modification and distribution is subject to the
     200                 :     Boost Software License, Version 1.0. (See accompanying
     201                 :     file LICENSE_1_0.txt or copy at
     202                 :     http://www.boost.org/LICENSE_1_0.txt)
     203                 : 
     204                 :     Project home: https://github.com/ericniebler/range-v3
     205                 : */
     206                 : template<typename T>
     207                 : struct static_const
     208                 : {
     209                 :     static constexpr T value {};
     210                 : };
     211                 : template<typename T>
     212                 : constexpr T static_const<T>::value;
     213                 : 
     214                 : #define BOOST_JSON_INLINE_VARIABLE(name, type) \
     215                 :     namespace { constexpr auto& name = \
     216                 :         ::boost::json::detail::static_const<type>::value; \
     217                 :     } struct _unused_ ## name ## _semicolon_bait_
     218                 : 
     219                 : } // detail
     220                 : } // namespace json
     221                 : } // namespace boost
     222                 : 
     223                 : #ifndef BOOST_JSON_ALLOW_DEPRECATED
     224                 : # ifdef BOOST_ALLOW_DEPRECATED
     225                 : #  define BOOST_JSON_ALLOW_DEPRECATED
     226                 : # endif
     227                 : #endif
     228                 : 
     229                 : #if defined(BOOST_GCC) && BOOST_GCC < 50000 && !defined(BOOST_JSON_ALLOW_DEPRECATED)
     230                 : # pragma GCC warning "Support for GCC versions below 5.0 is deprecated and will stop in Boost 1.88.0. To suppress this message define macro BOOST_JSON_ALLOW_DEPRECATED."
     231                 : #endif
     232                 : 
     233                 : #ifndef BOOST_JSON_ALLOW_DEPRECATED
     234                 : # define BOOST_JSON_DEPRECATED(x) BOOST_DEPRECATED(x)
     235                 : #else
     236                 : # define BOOST_JSON_DEPRECATED(x)
     237                 : #endif
     238                 : 
     239                 : #ifndef BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS
     240                 : #include <boost/json/detail/gdb_printers.hpp>
     241                 : #endif
     242                 : 
     243                 : #endif
        

Generated by: LCOV version 2.3