Chris@16
|
1 /*
|
Chris@16
|
2 * Copyright Andrey Semashev 2007 - 2013.
|
Chris@16
|
3 * Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
4 * (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
5 * http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 */
|
Chris@16
|
7 /*!
|
Chris@16
|
8 * \file config.hpp
|
Chris@16
|
9 * \author Andrey Semashev
|
Chris@16
|
10 * \date 08.03.2007
|
Chris@16
|
11 *
|
Chris@16
|
12 * \brief This header is the Boost.Log library implementation, see the library documentation
|
Chris@16
|
13 * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html. In this file
|
Chris@16
|
14 * internal configuration macros are defined.
|
Chris@16
|
15 */
|
Chris@16
|
16
|
Chris@16
|
17 #ifndef BOOST_LOG_DETAIL_CONFIG_HPP_INCLUDED_
|
Chris@16
|
18 #define BOOST_LOG_DETAIL_CONFIG_HPP_INCLUDED_
|
Chris@16
|
19
|
Chris@16
|
20 // This check must be before any system headers are included, or __MSVCRT_VERSION__ may get defined to 0x0600
|
Chris@16
|
21 #if defined(__MINGW32__) && !defined(__MSVCRT_VERSION__)
|
Chris@16
|
22 // Target MinGW headers to at least MSVC 7.0 runtime by default. This will enable some useful functions.
|
Chris@16
|
23 #define __MSVCRT_VERSION__ 0x0700
|
Chris@16
|
24 #endif
|
Chris@16
|
25
|
Chris@16
|
26 #include <limits.h> // To bring in libc macros
|
Chris@16
|
27 #include <boost/config.hpp>
|
Chris@16
|
28
|
Chris@16
|
29 #if defined(BOOST_NO_RTTI)
|
Chris@16
|
30 # error Boost.Log: RTTI is required by the library
|
Chris@16
|
31 #endif
|
Chris@16
|
32
|
Chris@16
|
33 #if !defined(BOOST_WINDOWS)
|
Chris@16
|
34 # ifndef BOOST_LOG_WITHOUT_DEBUG_OUTPUT
|
Chris@16
|
35 # define BOOST_LOG_WITHOUT_DEBUG_OUTPUT
|
Chris@16
|
36 # endif
|
Chris@16
|
37 # ifndef BOOST_LOG_WITHOUT_EVENT_LOG
|
Chris@16
|
38 # define BOOST_LOG_WITHOUT_EVENT_LOG
|
Chris@16
|
39 # endif
|
Chris@16
|
40 #endif
|
Chris@16
|
41
|
Chris@16
|
42 #ifdef BOOST_HAS_PRAGMA_ONCE
|
Chris@16
|
43 #pragma once
|
Chris@16
|
44 #endif
|
Chris@16
|
45
|
Chris@16
|
46 #if defined(BOOST_MSVC)
|
Chris@16
|
47 // For some reason MSVC 9.0 fails to link the library if static integral constants are defined in cpp
|
Chris@16
|
48 # define BOOST_LOG_BROKEN_STATIC_CONSTANTS_LINKAGE
|
Chris@16
|
49 # if _MSC_VER <= 1310
|
Chris@16
|
50 // MSVC 7.1 sometimes fails to match out-of-class template function definitions with
|
Chris@16
|
51 // their declarations if the return type or arguments of the functions involve typename keyword
|
Chris@16
|
52 // and depend on the template parameters.
|
Chris@16
|
53 # define BOOST_LOG_BROKEN_TEMPLATE_DEFINITION_MATCHING
|
Chris@16
|
54 # endif
|
Chris@16
|
55 # if _MSC_VER <= 1400
|
Chris@16
|
56 // Older MSVC versions reject friend declarations for class template specializations
|
Chris@16
|
57 # define BOOST_LOG_BROKEN_FRIEND_TEMPLATE_SPECIALIZATIONS
|
Chris@16
|
58 # endif
|
Chris@16
|
59 # if _MSC_VER <= 1600
|
Chris@16
|
60 // MSVC up to 10.0 attempts to invoke copy constructor when initializing a const reference from rvalue returned from a function.
|
Chris@16
|
61 // This fails when the returned value cannot be copied (only moved):
|
Chris@16
|
62 //
|
Chris@16
|
63 // class base {};
|
Chris@16
|
64 // class derived : public base { BOOST_MOVABLE_BUT_NOT_COPYABLE(derived) };
|
Chris@16
|
65 // derived foo();
|
Chris@16
|
66 // base const& var = foo(); // attempts to call copy constructor of derived
|
Chris@16
|
67 # define BOOST_LOG_BROKEN_REFERENCE_FROM_RVALUE_INIT
|
Chris@16
|
68 # endif
|
Chris@16
|
69 # if !defined(_STLPORT_VERSION)
|
Chris@16
|
70 // MSVC 9.0 mandates packaging of STL classes, which apparently affects alignment and
|
Chris@16
|
71 // makes alignment_of< T >::value no longer be a power of 2 for types that derive from STL classes.
|
Chris@16
|
72 // This breaks type_with_alignment and everything that relies on it.
|
Chris@16
|
73 // This doesn't happen with non-native STLs, such as STLPort. Strangely, this doesn't show with
|
Chris@16
|
74 // STL classes themselves or most of the user-defined derived classes.
|
Chris@16
|
75 // Not sure if that happens with other MSVC versions.
|
Chris@16
|
76 // See: http://svn.boost.org/trac/boost/ticket/1946
|
Chris@16
|
77 # define BOOST_LOG_BROKEN_STL_ALIGNMENT
|
Chris@16
|
78 # endif
|
Chris@16
|
79 #endif
|
Chris@16
|
80
|
Chris@16
|
81 #if defined(BOOST_INTEL) || defined(__SUNPRO_CC)
|
Chris@16
|
82 // Intel compiler and Sun Studio 12.3 have problems with friend declarations for nested class templates
|
Chris@16
|
83 # define BOOST_LOG_NO_MEMBER_TEMPLATE_FRIENDS
|
Chris@16
|
84 #endif
|
Chris@16
|
85
|
Chris@16
|
86 #if defined(BOOST_MSVC) && BOOST_MSVC <= 1600
|
Chris@16
|
87 // MSVC cannot interpret constant expressions in certain contexts, such as non-type template parameters
|
Chris@16
|
88 # define BOOST_LOG_BROKEN_CONSTANT_EXPRESSIONS
|
Chris@16
|
89 #endif
|
Chris@16
|
90
|
Chris@16
|
91 #if defined(__CYGWIN__)
|
Chris@16
|
92 // Boost.ASIO is broken on Cygwin
|
Chris@16
|
93 # define BOOST_LOG_NO_ASIO
|
Chris@16
|
94 #endif
|
Chris@16
|
95
|
Chris@16
|
96 #if !defined(BOOST_LOG_USE_NATIVE_SYSLOG) && defined(BOOST_LOG_NO_ASIO)
|
Chris@16
|
97 # ifndef BOOST_LOG_WITHOUT_SYSLOG
|
Chris@16
|
98 # define BOOST_LOG_WITHOUT_SYSLOG
|
Chris@16
|
99 # endif
|
Chris@16
|
100 #endif
|
Chris@16
|
101
|
Chris@16
|
102 #if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ <= 2)
|
Chris@16
|
103 // GCC 4.1 and 4.2 have buggy anonymous namespaces support, which interferes with symbol linkage
|
Chris@16
|
104 # define BOOST_LOG_ANONYMOUS_NAMESPACE namespace anonymous {} using namespace anonymous; namespace anonymous
|
Chris@16
|
105 #else
|
Chris@16
|
106 # define BOOST_LOG_ANONYMOUS_NAMESPACE namespace
|
Chris@16
|
107 #endif
|
Chris@16
|
108
|
Chris@16
|
109 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || (defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ <= 6))
|
Chris@16
|
110 // GCC up to 4.6 (inclusively) did not support expanding template argument packs into non-variadic template arguments
|
Chris@16
|
111 #define BOOST_LOG_NO_CXX11_ARG_PACKS_TO_NON_VARIADIC_ARGS_EXPANSION
|
Chris@16
|
112 #endif
|
Chris@16
|
113
|
Chris@16
|
114 #if defined(_MSC_VER)
|
Chris@16
|
115 # define BOOST_LOG_NO_VTABLE __declspec(novtable)
|
Chris@16
|
116 #elif defined(__GNUC__)
|
Chris@16
|
117 # define BOOST_LOG_NO_VTABLE
|
Chris@16
|
118 #else
|
Chris@16
|
119 # define BOOST_LOG_NO_VTABLE
|
Chris@16
|
120 #endif
|
Chris@16
|
121
|
Chris@16
|
122 // An MS-like compilers' extension that allows to optimize away the needless code
|
Chris@16
|
123 #if defined(_MSC_VER)
|
Chris@16
|
124 # define BOOST_LOG_ASSUME(expr) __assume(expr)
|
Chris@16
|
125 #else
|
Chris@16
|
126 # define BOOST_LOG_ASSUME(expr)
|
Chris@16
|
127 #endif
|
Chris@16
|
128
|
Chris@16
|
129 // The statement marking unreachable branches of code to avoid warnings
|
Chris@16
|
130 #if defined(BOOST_CLANG)
|
Chris@16
|
131 # if __has_builtin(__builtin_unreachable)
|
Chris@16
|
132 # define BOOST_LOG_UNREACHABLE() __builtin_unreachable()
|
Chris@16
|
133 # endif
|
Chris@16
|
134 #elif defined(__GNUC__)
|
Chris@16
|
135 # if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
|
Chris@16
|
136 # define BOOST_LOG_UNREACHABLE() __builtin_unreachable()
|
Chris@16
|
137 # endif
|
Chris@16
|
138 #elif defined(_MSC_VER)
|
Chris@16
|
139 # define BOOST_LOG_UNREACHABLE() __assume(0)
|
Chris@16
|
140 #endif
|
Chris@16
|
141 #if !defined(BOOST_LOG_UNREACHABLE)
|
Chris@16
|
142 # define BOOST_LOG_UNREACHABLE()
|
Chris@16
|
143 #endif
|
Chris@16
|
144
|
Chris@16
|
145 // Some compilers support a special attribute that shows that a function won't return
|
Chris@16
|
146 #if defined(__GNUC__) || (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590)
|
Chris@16
|
147 // GCC and Sun Studio 12 support attribute syntax
|
Chris@16
|
148 # define BOOST_LOG_NORETURN __attribute__((noreturn))
|
Chris@16
|
149 #elif defined (_MSC_VER)
|
Chris@16
|
150 // Microsoft-compatible compilers go here
|
Chris@16
|
151 # define BOOST_LOG_NORETURN __declspec(noreturn)
|
Chris@16
|
152 #else
|
Chris@16
|
153 // The rest compilers might emit bogus warnings about missing return statements
|
Chris@16
|
154 // in functions with non-void return types when throw_exception is used.
|
Chris@16
|
155 # define BOOST_LOG_NORETURN
|
Chris@16
|
156 #endif
|
Chris@16
|
157
|
Chris@16
|
158 // cxxabi.h availability macro
|
Chris@16
|
159 #if defined(BOOST_CLANG)
|
Chris@16
|
160 # if defined(__has_include) && __has_include(<cxxabi.h>)
|
Chris@16
|
161 # define BOOST_LOG_HAS_CXXABI_H
|
Chris@16
|
162 # endif
|
Chris@16
|
163 #elif defined(__GNUC__) && !defined(__QNX__)
|
Chris@16
|
164 # define BOOST_LOG_HAS_CXXABI_H
|
Chris@16
|
165 #endif
|
Chris@16
|
166
|
Chris@16
|
167 #if !defined(BOOST_LOG_BUILDING_THE_LIB)
|
Chris@16
|
168
|
Chris@16
|
169 // Detect if we're dealing with dll
|
Chris@16
|
170 # if defined(BOOST_LOG_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
|
Chris@16
|
171 # define BOOST_LOG_DLL
|
Chris@16
|
172 # endif
|
Chris@16
|
173
|
Chris@16
|
174 # if defined(BOOST_LOG_DLL)
|
Chris@16
|
175 # if defined(BOOST_SYMBOL_IMPORT)
|
Chris@16
|
176 # define BOOST_LOG_API BOOST_SYMBOL_IMPORT
|
Chris@16
|
177 # elif defined(BOOST_HAS_DECLSPEC)
|
Chris@16
|
178 # define BOOST_LOG_API __declspec(dllimport)
|
Chris@16
|
179 # endif
|
Chris@16
|
180 # endif
|
Chris@16
|
181 # ifndef BOOST_LOG_API
|
Chris@16
|
182 # define BOOST_LOG_API
|
Chris@16
|
183 # endif
|
Chris@16
|
184 //
|
Chris@16
|
185 // Automatically link to the correct build variant where possible.
|
Chris@16
|
186 //
|
Chris@16
|
187 # if !defined(BOOST_ALL_NO_LIB)
|
Chris@16
|
188 # if !defined(BOOST_LOG_NO_LIB)
|
Chris@16
|
189 # define BOOST_LIB_NAME boost_log
|
Chris@16
|
190 # if defined(BOOST_LOG_DLL)
|
Chris@16
|
191 # define BOOST_DYN_LINK
|
Chris@16
|
192 # endif
|
Chris@16
|
193 # include <boost/config/auto_link.hpp>
|
Chris@16
|
194 # endif
|
Chris@16
|
195 // In static-library builds compilers ignore auto-link comments from Boost.Log binary to
|
Chris@16
|
196 // other Boost libraries. We explicitly add comments here for other libraries.
|
Chris@16
|
197 // In dynamic-library builds this is not needed.
|
Chris@16
|
198 # if !defined(BOOST_LOG_DLL)
|
Chris@16
|
199 # include <boost/system/config.hpp>
|
Chris@16
|
200 # include <boost/filesystem/config.hpp>
|
Chris@16
|
201 # if !defined(BOOST_DATE_TIME_NO_LIB) && !defined(BOOST_DATE_TIME_SOURCE)
|
Chris@16
|
202 # define BOOST_LIB_NAME boost_date_time
|
Chris@16
|
203 # if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK)
|
Chris@16
|
204 # define BOOST_DYN_LINK
|
Chris@16
|
205 # endif
|
Chris@16
|
206 # include <boost/config/auto_link.hpp>
|
Chris@16
|
207 # endif
|
Chris@16
|
208 // Boost.Thread's config is included below, if needed
|
Chris@16
|
209 # endif
|
Chris@16
|
210 # endif // auto-linking disabled
|
Chris@16
|
211
|
Chris@16
|
212 #else // !defined(BOOST_LOG_BUILDING_THE_LIB)
|
Chris@16
|
213
|
Chris@16
|
214 # if defined(BOOST_LOG_DLL)
|
Chris@16
|
215 # if defined(BOOST_SYMBOL_EXPORT)
|
Chris@16
|
216 # define BOOST_LOG_API BOOST_SYMBOL_EXPORT
|
Chris@16
|
217 # elif defined(BOOST_HAS_DECLSPEC)
|
Chris@16
|
218 # define BOOST_LOG_API __declspec(dllexport)
|
Chris@16
|
219 # endif
|
Chris@16
|
220 # endif
|
Chris@16
|
221 # ifndef BOOST_LOG_API
|
Chris@16
|
222 # define BOOST_LOG_API BOOST_SYMBOL_VISIBLE
|
Chris@16
|
223 # endif
|
Chris@16
|
224
|
Chris@16
|
225 #endif // !defined(BOOST_LOG_BUILDING_THE_LIB)
|
Chris@16
|
226
|
Chris@16
|
227 // By default we provide support for both char and wchar_t
|
Chris@16
|
228 #if !defined(BOOST_LOG_WITHOUT_CHAR)
|
Chris@16
|
229 # define BOOST_LOG_USE_CHAR
|
Chris@16
|
230 #endif
|
Chris@16
|
231 #if !defined(BOOST_LOG_WITHOUT_WCHAR_T)
|
Chris@16
|
232 # define BOOST_LOG_USE_WCHAR_T
|
Chris@16
|
233 #endif
|
Chris@16
|
234
|
Chris@16
|
235 #if !defined(BOOST_LOG_DOXYGEN_PASS)
|
Chris@16
|
236 // Check if multithreading is supported
|
Chris@16
|
237 # if !defined(BOOST_LOG_NO_THREADS) && !defined(BOOST_HAS_THREADS)
|
Chris@16
|
238 # define BOOST_LOG_NO_THREADS
|
Chris@16
|
239 # endif // !defined(BOOST_LOG_NO_THREADS) && !defined(BOOST_HAS_THREADS)
|
Chris@16
|
240 #endif // !defined(BOOST_LOG_DOXYGEN_PASS)
|
Chris@16
|
241
|
Chris@16
|
242 #if !defined(BOOST_LOG_NO_THREADS)
|
Chris@16
|
243 // We need this header to (i) enable auto-linking with Boost.Thread and
|
Chris@16
|
244 // (ii) to bring in configuration macros of Boost.Thread.
|
Chris@16
|
245 # include <boost/thread/detail/config.hpp>
|
Chris@16
|
246 #endif // !defined(BOOST_LOG_NO_THREADS)
|
Chris@16
|
247
|
Chris@16
|
248 #if !defined(BOOST_LOG_NO_THREADS)
|
Chris@16
|
249 # define BOOST_LOG_EXPR_IF_MT(expr) expr
|
Chris@16
|
250 #else
|
Chris@16
|
251 # undef BOOST_LOG_USE_COMPILER_TLS
|
Chris@16
|
252 # define BOOST_LOG_EXPR_IF_MT(expr)
|
Chris@16
|
253 #endif // !defined(BOOST_LOG_NO_THREADS)
|
Chris@16
|
254
|
Chris@16
|
255 #if defined(BOOST_LOG_USE_COMPILER_TLS)
|
Chris@16
|
256 # if defined(__GNUC__) || defined(__SUNPRO_CC)
|
Chris@16
|
257 # define BOOST_LOG_TLS __thread
|
Chris@16
|
258 # elif defined(BOOST_MSVC)
|
Chris@16
|
259 # define BOOST_LOG_TLS __declspec(thread)
|
Chris@16
|
260 # else
|
Chris@16
|
261 # undef BOOST_LOG_USE_COMPILER_TLS
|
Chris@16
|
262 # endif
|
Chris@16
|
263 #endif // defined(BOOST_LOG_USE_COMPILER_TLS)
|
Chris@16
|
264
|
Chris@16
|
265 namespace boost {
|
Chris@16
|
266
|
Chris@16
|
267 // Setup namespace name
|
Chris@16
|
268 #if !defined(BOOST_LOG_DOXYGEN_PASS)
|
Chris@16
|
269 # if defined(BOOST_LOG_DLL)
|
Chris@16
|
270 # if defined(BOOST_LOG_NO_THREADS)
|
Chris@16
|
271 # define BOOST_LOG_VERSION_NAMESPACE v2_st
|
Chris@16
|
272 # else
|
Chris@16
|
273 # if defined(BOOST_THREAD_PLATFORM_PTHREAD)
|
Chris@16
|
274 # define BOOST_LOG_VERSION_NAMESPACE v2_mt_posix
|
Chris@16
|
275 # elif defined(BOOST_THREAD_PLATFORM_WIN32)
|
Chris@16
|
276 # if defined(BOOST_LOG_USE_WINNT6_API)
|
Chris@16
|
277 # define BOOST_LOG_VERSION_NAMESPACE v2_mt_nt6
|
Chris@16
|
278 # else
|
Chris@16
|
279 # define BOOST_LOG_VERSION_NAMESPACE v2_mt_nt5
|
Chris@16
|
280 # endif // defined(BOOST_LOG_USE_WINNT6_API)
|
Chris@16
|
281 # else
|
Chris@16
|
282 # define BOOST_LOG_VERSION_NAMESPACE v2_mt
|
Chris@16
|
283 # endif
|
Chris@16
|
284 # endif // defined(BOOST_LOG_NO_THREADS)
|
Chris@16
|
285 # else
|
Chris@16
|
286 # if defined(BOOST_LOG_NO_THREADS)
|
Chris@16
|
287 # define BOOST_LOG_VERSION_NAMESPACE v2s_st
|
Chris@16
|
288 # else
|
Chris@16
|
289 # if defined(BOOST_THREAD_PLATFORM_PTHREAD)
|
Chris@16
|
290 # define BOOST_LOG_VERSION_NAMESPACE v2s_mt_posix
|
Chris@16
|
291 # elif defined(BOOST_THREAD_PLATFORM_WIN32)
|
Chris@16
|
292 # if defined(BOOST_LOG_USE_WINNT6_API)
|
Chris@16
|
293 # define BOOST_LOG_VERSION_NAMESPACE v2s_mt_nt6
|
Chris@16
|
294 # else
|
Chris@16
|
295 # define BOOST_LOG_VERSION_NAMESPACE v2s_mt_nt5
|
Chris@16
|
296 # endif // defined(BOOST_LOG_USE_WINNT6_API)
|
Chris@16
|
297 # else
|
Chris@16
|
298 # define BOOST_LOG_VERSION_NAMESPACE v2s_mt
|
Chris@16
|
299 # endif
|
Chris@16
|
300 # endif // defined(BOOST_LOG_NO_THREADS)
|
Chris@16
|
301 # endif // defined(BOOST_LOG_DLL)
|
Chris@16
|
302
|
Chris@16
|
303
|
Chris@16
|
304 namespace log {
|
Chris@16
|
305
|
Chris@16
|
306 # if !defined(BOOST_NO_CXX11_INLINE_NAMESPACES)
|
Chris@16
|
307
|
Chris@16
|
308 inline namespace BOOST_LOG_VERSION_NAMESPACE {}
|
Chris@16
|
309 }
|
Chris@16
|
310
|
Chris@16
|
311 # define BOOST_LOG_OPEN_NAMESPACE namespace log { inline namespace BOOST_LOG_VERSION_NAMESPACE {
|
Chris@16
|
312 # define BOOST_LOG_CLOSE_NAMESPACE }}
|
Chris@16
|
313
|
Chris@16
|
314 # else
|
Chris@16
|
315
|
Chris@16
|
316 namespace BOOST_LOG_VERSION_NAMESPACE {}
|
Chris@16
|
317
|
Chris@16
|
318 using namespace BOOST_LOG_VERSION_NAMESPACE
|
Chris@16
|
319 # if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && !defined(__clang__)
|
Chris@16
|
320 __attribute__((__strong__))
|
Chris@16
|
321 # endif
|
Chris@16
|
322 ;
|
Chris@16
|
323
|
Chris@16
|
324 }
|
Chris@16
|
325
|
Chris@16
|
326 # define BOOST_LOG_OPEN_NAMESPACE namespace log { namespace BOOST_LOG_VERSION_NAMESPACE {
|
Chris@16
|
327 # define BOOST_LOG_CLOSE_NAMESPACE }}
|
Chris@16
|
328 # endif
|
Chris@16
|
329
|
Chris@16
|
330 #else // !defined(BOOST_LOG_DOXYGEN_PASS)
|
Chris@16
|
331
|
Chris@16
|
332 namespace log {}
|
Chris@16
|
333 # define BOOST_LOG_OPEN_NAMESPACE namespace log {
|
Chris@16
|
334 # define BOOST_LOG_CLOSE_NAMESPACE }
|
Chris@16
|
335
|
Chris@16
|
336 #endif // !defined(BOOST_LOG_DOXYGEN_PASS)
|
Chris@16
|
337
|
Chris@16
|
338 } // namespace boost
|
Chris@16
|
339
|
Chris@16
|
340 #endif // BOOST_LOG_DETAIL_CONFIG_HPP_INCLUDED_
|