comparison DEPENDENCIES/generic/include/boost/log/detail/config.hpp @ 16:2665513ce2d3

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