Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:20

0001 /*
0002  *          Copyright Andrey Semashev 2007 - 2015.
0003  * Distributed under the Boost Software License, Version 1.0.
0004  *    (See accompanying file LICENSE_1_0.txt or copy at
0005  *          http://www.boost.org/LICENSE_1_0.txt)
0006  */
0007 /*!
0008  * \file   config.hpp
0009  * \author Andrey Semashev
0010  * \date   08.03.2007
0011  *
0012  * \brief  This header is the Boost.Log library implementation, see the library documentation
0013  *         at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html. In this file
0014  *         internal configuration macros are defined.
0015  */
0016 
0017 #ifndef BOOST_LOG_DETAIL_CONFIG_HPP_INCLUDED_
0018 #define BOOST_LOG_DETAIL_CONFIG_HPP_INCLUDED_
0019 
0020 // Try including WinAPI config as soon as possible so that any other headers don't include Windows SDK headers
0021 #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__)
0022 #include <boost/winapi/config.hpp>
0023 #endif
0024 
0025 #include <limits.h> // To bring in libc macros
0026 #include <boost/config.hpp>
0027 
0028 // The library requires dynamic_cast in a few places
0029 #if defined(BOOST_NO_RTTI)
0030 #   error Boost.Log: RTTI is required by the library
0031 #endif
0032 
0033 #if defined(_MSC_VER) && _MSC_VER >= 1600
0034 #   define BOOST_LOG_HAS_PRAGMA_DETECT_MISMATCH
0035 #endif
0036 
0037 #if !defined(BOOST_WINDOWS)
0038 #   ifndef BOOST_LOG_WITHOUT_DEBUG_OUTPUT
0039 #       define BOOST_LOG_WITHOUT_DEBUG_OUTPUT
0040 #   endif
0041 #   ifndef BOOST_LOG_WITHOUT_EVENT_LOG
0042 #       define BOOST_LOG_WITHOUT_EVENT_LOG
0043 #   endif
0044 #endif
0045 
0046 #ifdef BOOST_HAS_PRAGMA_ONCE
0047 #pragma once
0048 #endif
0049 
0050 #if defined(BOOST_MSVC)
0051     // For some reason MSVC 9.0 fails to link the library if static integral constants are defined in cpp
0052 #   define BOOST_LOG_BROKEN_STATIC_CONSTANTS_LINKAGE
0053 #   if _MSC_VER <= 1310
0054         // MSVC 7.1 sometimes fails to match out-of-class template function definitions with
0055         // their declarations if the return type or arguments of the functions involve typename keyword
0056         // and depend on the template parameters.
0057 #       define BOOST_LOG_BROKEN_TEMPLATE_DEFINITION_MATCHING
0058 #   endif
0059 #   if _MSC_VER <= 1400
0060         // Older MSVC versions reject friend declarations for class template specializations
0061 #       define BOOST_LOG_BROKEN_FRIEND_TEMPLATE_SPECIALIZATIONS
0062 #   endif
0063 #   if _MSC_VER <= 1600
0064         // MSVC up to 10.0 attempts to invoke copy constructor when initializing a const reference from rvalue returned from a function.
0065         // This fails when the returned value cannot be copied (only moved):
0066         //
0067         // class base {};
0068         // class derived : public base { BOOST_MOVABLE_BUT_NOT_COPYABLE(derived) };
0069         // derived foo();
0070         // base const& var = foo(); // attempts to call copy constructor of derived
0071 #       define BOOST_LOG_BROKEN_REFERENCE_FROM_RVALUE_INIT
0072 #   endif
0073 #   if !defined(_STLPORT_VERSION)
0074         // MSVC 9.0 mandates packaging of STL classes, which apparently affects alignment and
0075         // makes alignment_of< T >::value no longer be a power of 2 for types that derive from STL classes.
0076         // This breaks type_with_alignment and everything that relies on it.
0077         // This doesn't happen with non-native STLs, such as STLPort. Strangely, this doesn't show with
0078         // STL classes themselves or most of the user-defined derived classes.
0079         // Not sure if that happens with other MSVC versions.
0080         // See: http://svn.boost.org/trac/boost/ticket/1946
0081 #       define BOOST_LOG_BROKEN_STL_ALIGNMENT
0082 #   endif
0083 #endif
0084 
0085 #if defined(BOOST_INTEL) || defined(__SUNPRO_CC)
0086     // Intel compiler and Sun Studio 12.3 have problems with friend declarations for nested class templates
0087 #   define BOOST_LOG_NO_MEMBER_TEMPLATE_FRIENDS
0088 #endif
0089 
0090 #if defined(BOOST_MSVC) && BOOST_MSVC <= 1600
0091     // MSVC cannot interpret constant expressions in certain contexts, such as non-type template parameters
0092 #   define BOOST_LOG_BROKEN_CONSTANT_EXPRESSIONS
0093 #endif
0094 
0095 #if (defined(BOOST_NO_CXX11_HDR_CODECVT) && BOOST_CXX_VERSION < 201703) || (defined(_MSVC_STL_VERSION) && _MSVC_STL_VERSION < 142)
0096     // The compiler does not support std::codecvt<char16_t> and std::codecvt<char32_t> specializations.
0097     // The BOOST_NO_CXX11_HDR_CODECVT means there's no usable <codecvt>, which is slightly different from this macro.
0098     // But in order for <codecvt> to be implemented the std::codecvt specializations have to be implemented as well.
0099     // We need to check the C++ version as well, since <codecvt> is deprecated from C++17 onwards which may cause
0100     // BOOST_NO_CXX11_HDR_CODECVT to be set, even though std::codecvt in <locale> is just fine.
0101 #   define BOOST_LOG_NO_CXX11_CODECVT_FACETS
0102 #endif
0103 
0104 #if defined(__CYGWIN__)
0105     // Boost.ASIO is broken on Cygwin
0106 #   define BOOST_LOG_NO_ASIO
0107 #endif
0108 
0109 #if defined(__VXWORKS__)
0110 #   define BOOST_LOG_NO_GETPGRP
0111 #   define BOOST_LOG_NO_GETSID
0112     // for _WRS_CONFIG_USER_MANAGEMENT used below
0113 #   include <vsbConfig.h>
0114 #endif
0115 
0116 #if (!defined(__CRYSTAX__) && defined(__ANDROID__) && (__ANDROID_API__ < 21)) \
0117      || (defined(__VXWORKS__) && !defined(_WRS_CONFIG_USER_MANAGEMENT))
0118 // Until Android API version 21 Google NDK does not provide getpwuid_r
0119 #    define BOOST_LOG_NO_GETPWUID_R
0120 #endif
0121 
0122 #if !defined(BOOST_LOG_USE_NATIVE_SYSLOG) && defined(BOOST_LOG_NO_ASIO)
0123 #   ifndef BOOST_LOG_WITHOUT_SYSLOG
0124 #       define BOOST_LOG_WITHOUT_SYSLOG
0125 #   endif
0126 #endif
0127 
0128 #if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ <= 2)
0129     // GCC 4.1 and 4.2 have buggy anonymous namespaces support, which interferes with symbol linkage
0130 #   define BOOST_LOG_ANONYMOUS_NAMESPACE namespace anonymous {} using namespace anonymous; namespace anonymous
0131 #else
0132 #   define BOOST_LOG_ANONYMOUS_NAMESPACE namespace
0133 #endif
0134 
0135 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || (defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ <= 6))
0136 // GCC up to 4.6 (inclusively) did not support expanding template argument packs into non-variadic template arguments
0137 #define BOOST_LOG_NO_CXX11_ARG_PACKS_TO_NON_VARIADIC_ARGS_EXPANSION
0138 #endif
0139 
0140 #if defined(BOOST_NO_CXX11_CONSTEXPR) || (defined(BOOST_GCC) && (BOOST_GCC / 100) <= 406)
0141 // GCC 4.6 does not support in-class brace initializers for static constexpr array members
0142 #define BOOST_LOG_NO_CXX11_CONSTEXPR_DATA_MEMBER_BRACE_INITIALIZERS
0143 #endif
0144 
0145 #if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || (defined(BOOST_GCC) && (BOOST_GCC / 100) <= 406)
0146 // GCC 4.6 cannot handle defaulted functions with noexcept specifier or virtual functions
0147 #define BOOST_LOG_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS
0148 #define BOOST_LOG_NO_CXX11_DEFAULTED_VIRTUAL_FUNCTIONS
0149 #endif
0150 
0151 #if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || (defined(BOOST_CLANG) && ((__clang_major__ == 3) && (__clang_minor__ <= 1)))
0152 // Clang 3.1 cannot handle a defaulted constexpr constructor in some cases (presumably, if the class contains a member with a constexpr constructor)
0153 #define BOOST_LOG_NO_CXX11_DEFAULTED_CONSTEXPR_CONSTRUCTORS
0154 #endif
0155 
0156 // The macro indicates that the compiler does not support C++20 pack expansions in lambda init-captures.
0157 // Early gcc, clang and MSVC versions support C++20 pack expansions in lambda init-captures,
0158 // but define __cpp_init_captures to a lower value.
0159 #if (!defined(__cpp_init_captures) || (__cpp_init_captures < 201803)) && \
0160     !(\
0161         BOOST_CXX_VERSION > 201703 && \
0162         (\
0163             (defined(BOOST_GCC) && (BOOST_GCC >= 90000)) || \
0164             (defined(BOOST_CLANG) && (BOOST_CLANG_VERSION >= 90000)) || \
0165             (defined(BOOST_MSVC) && (BOOST_MSVC >= 1922))\
0166         )\
0167     )
0168 #define BOOST_LOG_NO_CXX20_PACK_EXPANSION_IN_LAMBDA_INIT_CAPTURE
0169 #endif
0170 
0171 #if defined(_MSC_VER)
0172 #   define BOOST_LOG_NO_VTABLE __declspec(novtable)
0173 #else
0174 #   define BOOST_LOG_NO_VTABLE
0175 #endif
0176 
0177 // An MS-like compilers' extension that allows to optimize away the needless code
0178 #if defined(_MSC_VER)
0179 #   define BOOST_LOG_ASSUME(expr) __assume(expr)
0180 #elif defined(__has_builtin)
0181 // Clang 3.6 adds __builtin_assume, but enabling it causes weird compilation errors, where the compiler
0182 // doesn't see one of attachable_sstream_buf::append overloads. It works fine with Clang 3.7 and later.
0183 #   if __has_builtin(__builtin_assume) && (!defined(__clang__) || (__clang_major__ * 100 + __clang_minor__) >= 307)
0184 #       define BOOST_LOG_ASSUME(expr) __builtin_assume(expr)
0185 #   else
0186 #       define BOOST_LOG_ASSUME(expr)
0187 #   endif
0188 #else
0189 #   define BOOST_LOG_ASSUME(expr)
0190 #endif
0191 
0192 // The statement marking unreachable branches of code to avoid warnings
0193 #if defined(BOOST_CLANG)
0194 #   if __has_builtin(__builtin_unreachable)
0195 #       define BOOST_LOG_UNREACHABLE() __builtin_unreachable()
0196 #   endif
0197 #elif defined(__GNUC__)
0198 #   if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
0199 #       define BOOST_LOG_UNREACHABLE() __builtin_unreachable()
0200 #   endif
0201 #elif defined(_MSC_VER)
0202 #   define BOOST_LOG_UNREACHABLE() __assume(0)
0203 #endif
0204 #if !defined(BOOST_LOG_UNREACHABLE)
0205 #   define BOOST_LOG_UNREACHABLE()
0206 #   define BOOST_LOG_UNREACHABLE_RETURN(r) return r
0207 #else
0208 #   define BOOST_LOG_UNREACHABLE_RETURN(r) BOOST_LOG_UNREACHABLE()
0209 #endif
0210 
0211 // The macro efficiently returns a local lvalue from a function.
0212 // It employs NRVO, if supported by compiler, or uses a move constructor otherwise.
0213 #if defined(BOOST_HAS_NRVO)
0214 #define BOOST_LOG_NRVO_RESULT(x) x
0215 #else
0216 #define BOOST_LOG_NRVO_RESULT(x) boost::move(x)
0217 #endif
0218 
0219 // Some compilers support a special attribute that shows that a function won't return
0220 #if defined(__GNUC__) || (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590)
0221     // GCC and Sun Studio 12 support attribute syntax
0222 #   define BOOST_LOG_NORETURN __attribute__((noreturn))
0223 #elif defined (_MSC_VER)
0224     // Microsoft-compatible compilers go here
0225 #   define BOOST_LOG_NORETURN __declspec(noreturn)
0226 #else
0227     // The rest compilers might emit bogus warnings about missing return statements
0228     // in functions with non-void return types when throw_exception is used.
0229 #   define BOOST_LOG_NORETURN
0230 #endif
0231 
0232 // Some compilers may require marking types that may alias other types
0233 #define BOOST_LOG_MAY_ALIAS BOOST_MAY_ALIAS
0234 
0235 #if !defined(BOOST_LOG_BUILDING_THE_LIB)
0236 
0237 // Detect if we're dealing with dll
0238 #   if defined(BOOST_LOG_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
0239 #       define BOOST_LOG_DLL
0240 #   endif
0241 
0242 #   if defined(BOOST_LOG_DLL)
0243 #       define BOOST_LOG_API BOOST_SYMBOL_IMPORT
0244 #   else
0245 #       define BOOST_LOG_API
0246 #   endif
0247 //
0248 // Automatically link to the correct build variant where possible.
0249 //
0250 #   if !defined(BOOST_ALL_NO_LIB)
0251 #       if !defined(BOOST_LOG_NO_LIB)
0252 #          define BOOST_LIB_NAME boost_log
0253 #          if defined(BOOST_LOG_DLL)
0254 #              define BOOST_DYN_LINK
0255 #          endif
0256 #          include <boost/config/auto_link.hpp>
0257 #       endif
0258         // In static-library builds compilers ignore auto-link comments from Boost.Log binary to
0259         // other Boost libraries. We explicitly add comments here for other libraries.
0260         // In dynamic-library builds this is not needed.
0261 #       if !defined(BOOST_LOG_DLL)
0262 #           include <boost/filesystem/config.hpp>
0263             // Boost.Thread's config is included below, if needed
0264 #       endif
0265 #   endif  // auto-linking disabled
0266 
0267 #else // !defined(BOOST_LOG_BUILDING_THE_LIB)
0268 
0269 #   if defined(BOOST_LOG_DLL)
0270 #       define BOOST_LOG_API BOOST_SYMBOL_EXPORT
0271 #   else
0272 #       define BOOST_LOG_API BOOST_SYMBOL_VISIBLE
0273 #   endif
0274 
0275 #endif // !defined(BOOST_LOG_BUILDING_THE_LIB)
0276 
0277 // By default we provide support for both char and wchar_t
0278 #if !defined(BOOST_LOG_WITHOUT_CHAR)
0279 #   define BOOST_LOG_USE_CHAR
0280 #endif
0281 #if !defined(BOOST_LOG_WITHOUT_WCHAR_T)
0282 #   define BOOST_LOG_USE_WCHAR_T
0283 #endif
0284 
0285 #if !defined(BOOST_LOG_DOXYGEN_PASS)
0286     // Check if multithreading is supported
0287 #   if !defined(BOOST_LOG_NO_THREADS) && !defined(BOOST_HAS_THREADS)
0288 #       define BOOST_LOG_NO_THREADS
0289 #   endif // !defined(BOOST_LOG_NO_THREADS) && !defined(BOOST_HAS_THREADS)
0290 #endif // !defined(BOOST_LOG_DOXYGEN_PASS)
0291 
0292 #if !defined(BOOST_LOG_NO_THREADS)
0293     // We need this header to (i) enable auto-linking with Boost.Thread and
0294     // (ii) to bring in configuration macros of Boost.Thread.
0295 #   include <boost/thread/detail/config.hpp>
0296 #endif // !defined(BOOST_LOG_NO_THREADS)
0297 
0298 #if !defined(BOOST_LOG_NO_THREADS)
0299 #   define BOOST_LOG_EXPR_IF_MT(expr) expr
0300 #else
0301 #   undef BOOST_LOG_USE_COMPILER_TLS
0302 #   define BOOST_LOG_EXPR_IF_MT(expr)
0303 #endif // !defined(BOOST_LOG_NO_THREADS)
0304 
0305 #if defined(BOOST_LOG_USE_COMPILER_TLS)
0306 #   if defined(__GNUC__) || defined(__SUNPRO_CC)
0307 #       define BOOST_LOG_TLS __thread
0308 #   elif defined(BOOST_MSVC)
0309 #       define BOOST_LOG_TLS __declspec(thread)
0310 #   else
0311 #       undef BOOST_LOG_USE_COMPILER_TLS
0312 #   endif
0313 #endif // defined(BOOST_LOG_USE_COMPILER_TLS)
0314 
0315 #ifndef BOOST_LOG_CPU_CACHE_LINE_SIZE
0316 //! The macro defines the CPU cache line size for the target architecture. This is mostly used for optimization.
0317 #if defined(__s390__) || defined(__s390x__)
0318 #define BOOST_LOG_CPU_CACHE_LINE_SIZE 256
0319 #elif defined(powerpc) || defined(__powerpc__) || defined(__ppc__)
0320 #define BOOST_LOG_CPU_CACHE_LINE_SIZE 128
0321 #else
0322 #define BOOST_LOG_CPU_CACHE_LINE_SIZE 64
0323 #endif
0324 #endif
0325 
0326 namespace boost {
0327 
0328 // Setup namespace name
0329 #if !defined(BOOST_LOG_DOXYGEN_PASS)
0330 #   if defined(BOOST_LOG_DLL)
0331 #       if defined(BOOST_LOG_NO_THREADS)
0332 #           define BOOST_LOG_VERSION_NAMESPACE v2_st
0333 #       else
0334 #           if defined(BOOST_THREAD_PLATFORM_PTHREAD)
0335 #               define BOOST_LOG_VERSION_NAMESPACE v2_mt_posix
0336 #           elif defined(BOOST_THREAD_PLATFORM_WIN32)
0337 #               if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN8
0338 #                   define BOOST_LOG_VERSION_NAMESPACE v2_mt_nt62
0339 #               elif BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0340 #                   define BOOST_LOG_VERSION_NAMESPACE v2_mt_nt6
0341 #               else
0342 #                   define BOOST_LOG_VERSION_NAMESPACE v2_mt_nt5
0343 #               endif
0344 #           else
0345 #               define BOOST_LOG_VERSION_NAMESPACE v2_mt
0346 #           endif
0347 #       endif // defined(BOOST_LOG_NO_THREADS)
0348 #   else
0349 #       if defined(BOOST_LOG_NO_THREADS)
0350 #           define BOOST_LOG_VERSION_NAMESPACE v2s_st
0351 #       else
0352 #           if defined(BOOST_THREAD_PLATFORM_PTHREAD)
0353 #               define BOOST_LOG_VERSION_NAMESPACE v2s_mt_posix
0354 #           elif defined(BOOST_THREAD_PLATFORM_WIN32)
0355 #               if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN8
0356 #                   define BOOST_LOG_VERSION_NAMESPACE v2s_mt_nt62
0357 #               elif BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0358 #                   define BOOST_LOG_VERSION_NAMESPACE v2s_mt_nt6
0359 #               else
0360 #                   define BOOST_LOG_VERSION_NAMESPACE v2s_mt_nt5
0361 #               endif
0362 #           else
0363 #               define BOOST_LOG_VERSION_NAMESPACE v2s_mt
0364 #           endif
0365 #       endif // defined(BOOST_LOG_NO_THREADS)
0366 #   endif // defined(BOOST_LOG_DLL)
0367 
0368 
0369 namespace log {
0370 
0371 #   if !defined(BOOST_NO_CXX11_INLINE_NAMESPACES)
0372 
0373 inline namespace BOOST_LOG_VERSION_NAMESPACE {}
0374 
0375 #       define BOOST_LOG_OPEN_NAMESPACE namespace log { inline namespace BOOST_LOG_VERSION_NAMESPACE {
0376 #       define BOOST_LOG_CLOSE_NAMESPACE }}
0377 
0378 #   elif defined(BOOST_GCC) && (BOOST_GCC >= 40400)
0379 
0380 // GCC 7 deprecated strong using directives but allows inline namespaces in C++03 mode since GCC 4.4.
0381 __extension__ inline namespace BOOST_LOG_VERSION_NAMESPACE {}
0382 
0383 #       define BOOST_LOG_OPEN_NAMESPACE namespace log { __extension__ inline namespace BOOST_LOG_VERSION_NAMESPACE {
0384 #       define BOOST_LOG_CLOSE_NAMESPACE }}
0385 
0386 #   else
0387 
0388 namespace BOOST_LOG_VERSION_NAMESPACE {}
0389 
0390 using namespace BOOST_LOG_VERSION_NAMESPACE
0391 #       if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && !defined(__clang__)
0392 __attribute__((__strong__))
0393 #       endif
0394 ;
0395 
0396 #       define BOOST_LOG_OPEN_NAMESPACE namespace log { namespace BOOST_LOG_VERSION_NAMESPACE {
0397 #       define BOOST_LOG_CLOSE_NAMESPACE }}
0398 #   endif
0399 
0400 } // namespace log
0401 
0402 #else // !defined(BOOST_LOG_DOXYGEN_PASS)
0403 
0404 namespace log {}
0405 #   define BOOST_LOG_OPEN_NAMESPACE namespace log {
0406 #   define BOOST_LOG_CLOSE_NAMESPACE }
0407 
0408 #endif // !defined(BOOST_LOG_DOXYGEN_PASS)
0409 
0410 #if defined(BOOST_LOG_HAS_PRAGMA_DETECT_MISMATCH)
0411 #pragma detect_mismatch("boost_log_abi", BOOST_STRINGIZE(BOOST_LOG_VERSION_NAMESPACE))
0412 #endif
0413 
0414 } // namespace boost
0415 
0416 #endif // BOOST_LOG_DETAIL_CONFIG_HPP_INCLUDED_