]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/regex/config.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / regex / config.hpp
1 /*
2 *
3 * Copyright (c) 1998-2002
4 * John Maddock
5 *
6 * Use, modification and distribution are subject to the
7 * Boost Software License, Version 1.0. (See accompanying file
8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 *
10 */
11
12 /*
13 * LOCATION: see http://www.boost.org for most recent version.
14 * FILE config.hpp
15 * VERSION see <boost/version.hpp>
16 * DESCRIPTION: regex extended config setup.
17 */
18
19 #ifndef BOOST_REGEX_CONFIG_HPP
20 #define BOOST_REGEX_CONFIG_HPP
21 /*
22 * Borland C++ Fix/error check
23 * this has to go *before* we include any std lib headers:
24 */
25 #if defined(__BORLANDC__)
26 # include <boost/regex/config/borland.hpp>
27 #endif
28 #include <boost/version.hpp>
29
30 /*****************************************************************************
31 *
32 * Include all the headers we need here:
33 *
34 ****************************************************************************/
35
36 #ifdef __cplusplus
37
38 # ifndef BOOST_REGEX_USER_CONFIG
39 # define BOOST_REGEX_USER_CONFIG <boost/regex/user.hpp>
40 # endif
41
42 # include BOOST_REGEX_USER_CONFIG
43
44 # include <boost/config.hpp>
45 # include <boost/predef.h>
46
47 #else
48 /*
49 * C build,
50 * don't include <boost/config.hpp> because that may
51 * do C++ specific things in future...
52 */
53 # include <stdlib.h>
54 # include <stddef.h>
55 # ifdef _MSC_VER
56 # define BOOST_MSVC _MSC_VER
57 # endif
58 #endif
59
60 /*****************************************************************************
61 *
62 * Boilerplate regex config options:
63 *
64 ****************************************************************************/
65
66 /* Obsolete macro, use BOOST_VERSION instead: */
67 #define BOOST_RE_VERSION 320
68
69 /* fix: */
70 #if defined(_UNICODE) && !defined(UNICODE)
71 #define UNICODE
72 #endif
73
74
75 /*
76 * Define a macro for the namespace that details are placed in, this includes the Boost
77 * version number to avoid mismatched header and library versions:
78 */
79 #define BOOST_REGEX_DETAIL_NS BOOST_JOIN(re_detail_, BOOST_VERSION)
80
81 /*
82 * Fix for gcc prior to 3.4: std::ctype<wchar_t> doesn't allow
83 * masks to be combined, for example:
84 * std::use_facet<std::ctype<wchar_t> >.is(std::ctype_base::lower|std::ctype_base::upper, L'a');
85 * returns *false*.
86 */
87 #ifdef __GLIBCPP__
88 # define BOOST_REGEX_BUGGY_CTYPE_FACET
89 #endif
90
91 /*
92 * Intel C++ before 8.0 ends up with unresolved externals unless we turn off
93 * extern template support:
94 */
95 #if defined(BOOST_INTEL) && defined(__cplusplus) && (BOOST_INTEL <= 800)
96 # define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
97 #endif
98 /*
99 * Visual C++ doesn't support external templates with C++ extensions turned off:
100 */
101 #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
102 # define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
103 #endif
104 /*
105 * Oracle compiler in C++11 mode doesn't like external templates for some reason:
106 */
107 #ifdef __SUNPRO_CC
108 # define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
109 #endif
110 /*
111 * Shared regex lib will crash without this, frankly it looks a lot like a gcc bug:
112 */
113 #if defined(__MINGW32__)
114 # define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
115 #endif
116 /*
117 * Clang fails to export template instances with -fvisibility=hidden, see
118 * https://github.com/boostorg/regex/issues/49
119 */
120 #ifdef __clang__
121 # define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
122 #endif
123 #ifdef __CYGWIN__
124 /* We get multiply defined symbols without this: */
125 # define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
126 #endif
127
128 /*
129 * If there isn't good enough wide character support then there will
130 * be no wide character regular expressions:
131 */
132 #if (defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_CWCTYPE) || defined(BOOST_NO_STD_WSTRING))
133 # if !defined(BOOST_NO_WREGEX)
134 # define BOOST_NO_WREGEX
135 # endif
136 #else
137 # if defined(__sgi) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
138 /* STLPort on IRIX is misconfigured: <cwctype> does not compile
139 * as a temporary fix include <wctype.h> instead and prevent inclusion
140 * of STLPort version of <cwctype> */
141 # include <wctype.h>
142 # define __STLPORT_CWCTYPE
143 # define _STLP_CWCTYPE
144 # endif
145
146 #ifdef __cplusplus
147 # include <boost/regex/config/cwchar.hpp>
148 #endif
149
150 #endif
151
152 /*
153 * If Win32 support has been disabled for boost in general, then
154 * it is for regex in particular:
155 */
156 #if defined(BOOST_DISABLE_WIN32) && !defined(BOOST_REGEX_NO_W32)
157 # define BOOST_REGEX_NO_W32
158 #endif
159
160 /* disable our own file-iterators and mapfiles if we can't
161 * support them: */
162 #if defined(_WIN32)
163 # if defined(BOOST_REGEX_NO_W32) || BOOST_PLAT_WINDOWS_RUNTIME
164 # define BOOST_REGEX_NO_FILEITER
165 # endif
166 #else /* defined(_WIN32) */
167 # if !defined(BOOST_HAS_DIRENT_H)
168 # define BOOST_REGEX_NO_FILEITER
169 # endif
170 #endif
171
172 /* backwards compatibitity: */
173 #if defined(BOOST_RE_NO_LIB)
174 # define BOOST_REGEX_NO_LIB
175 #endif
176
177 #if defined(__GNUC__) && !defined(_MSC_VER) && (defined(_WIN32) || defined(__CYGWIN__))
178 /* gcc on win32 has problems if you include <windows.h>
179 (sporadically generates bad code). */
180 # define BOOST_REGEX_NO_W32
181 #endif
182 #if defined(__COMO__) && !defined(BOOST_REGEX_NO_W32) && !defined(_MSC_EXTENSIONS)
183 # define BOOST_REGEX_NO_W32
184 #endif
185
186 /*****************************************************************************
187 *
188 * Wide character workarounds:
189 *
190 ****************************************************************************/
191
192 /*
193 * define BOOST_REGEX_HAS_OTHER_WCHAR_T when wchar_t is a native type, but the users
194 * code may be built with wchar_t as unsigned short: basically when we're building
195 * with MSVC and the /Zc:wchar_t option we place some extra unsigned short versions
196 * of the non-inline functions in the library, so that users can still link to the lib,
197 * irrespective of whether their own code is built with /Zc:wchar_t.
198 * Note that this does NOT WORK with VC10 and VC14 when the C++ locale is in effect as
199 * the locale's <unsigned short> facets simply do not compile in that case.
200 * As we default to the C++ locale when compiling for the windows runtime we
201 * skip in this case aswell.
202 */
203 #if defined(__cplusplus) && \
204 (defined(BOOST_MSVC) || defined(__ICL)) && \
205 !defined(BOOST_NO_INTRINSIC_WCHAR_T) && \
206 defined(BOOST_WINDOWS) && \
207 !defined(__SGI_STL_PORT) && \
208 !defined(_STLPORT_VERSION) && \
209 !defined(BOOST_RWSTD_VER) && \
210 ((_MSC_VER < 1600) || !defined(BOOST_REGEX_USE_CPP_LOCALE)) && \
211 !BOOST_PLAT_WINDOWS_RUNTIME
212 # define BOOST_REGEX_HAS_OTHER_WCHAR_T
213 # ifdef BOOST_MSVC
214 # pragma warning(push)
215 # pragma warning(disable : 4251)
216 #if BOOST_MSVC < 1700
217 # pragma warning(disable : 4231)
218 #endif
219 # if BOOST_MSVC < 1600
220 # pragma warning(disable : 4660)
221 # endif
222 # endif
223 # if defined(_DLL) && defined(BOOST_MSVC) && (BOOST_MSVC < 1600)
224 # include <string>
225 extern template class __declspec(dllimport) std::basic_string<unsigned short>;
226 # endif
227 # ifdef BOOST_MSVC
228 # pragma warning(pop)
229 # endif
230 #endif
231
232
233 /*****************************************************************************
234 *
235 * Set up dll import/export options:
236 *
237 ****************************************************************************/
238
239 #ifndef BOOST_SYMBOL_EXPORT
240 # define BOOST_SYMBOL_EXPORT
241 # define BOOST_SYMBOL_IMPORT
242 #endif
243
244 #if (defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_REGEX_STATIC_LINK)
245 # if defined(BOOST_REGEX_SOURCE)
246 # define BOOST_REGEX_DECL BOOST_SYMBOL_EXPORT
247 # define BOOST_REGEX_BUILD_DLL
248 # else
249 # define BOOST_REGEX_DECL BOOST_SYMBOL_IMPORT
250 # endif
251 #else
252 # define BOOST_REGEX_DECL
253 #endif
254
255 #if !defined(BOOST_REGEX_NO_LIB) && !defined(BOOST_REGEX_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus)
256 # define BOOST_LIB_NAME boost_regex
257 # if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
258 # define BOOST_DYN_LINK
259 # endif
260 # ifdef BOOST_REGEX_DIAG
261 # define BOOST_LIB_DIAGNOSTIC
262 # endif
263 # include <boost/config/auto_link.hpp>
264 #endif
265
266 /*****************************************************************************
267 *
268 * Set up function call type:
269 *
270 ****************************************************************************/
271
272 #if defined(_MSC_VER) && defined(_MSC_EXTENSIONS)
273 #if defined(_DEBUG) || defined(__MSVC_RUNTIME_CHECKS) || defined(_MANAGED) || defined(BOOST_REGEX_NO_FASTCALL)
274 # define BOOST_REGEX_CALL __cdecl
275 #else
276 # define BOOST_REGEX_CALL __fastcall
277 #endif
278 # define BOOST_REGEX_CCALL __cdecl
279 #endif
280
281 #if defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)
282 # define BOOST_REGEX_CALL __fastcall
283 # define BOOST_REGEX_CCALL __stdcall
284 #endif
285
286 #ifndef BOOST_REGEX_CALL
287 # define BOOST_REGEX_CALL
288 #endif
289 #ifndef BOOST_REGEX_CCALL
290 #define BOOST_REGEX_CCALL
291 #endif
292
293 /*****************************************************************************
294 *
295 * Set up localisation model:
296 *
297 ****************************************************************************/
298
299 /* backwards compatibility: */
300 #ifdef BOOST_RE_LOCALE_C
301 # define BOOST_REGEX_USE_C_LOCALE
302 #endif
303
304 #ifdef BOOST_RE_LOCALE_CPP
305 # define BOOST_REGEX_USE_CPP_LOCALE
306 #endif
307
308 #if defined(__CYGWIN__)
309 # define BOOST_REGEX_USE_C_LOCALE
310 #endif
311
312 /* use C++ locale when targeting windows store */
313 #if BOOST_PLAT_WINDOWS_RUNTIME
314 # define BOOST_REGEX_USE_CPP_LOCALE
315 # define BOOST_REGEX_NO_WIN32_LOCALE
316 #endif
317
318 /* Win32 defaults to native Win32 locale: */
319 #if defined(_WIN32) && \
320 !defined(BOOST_REGEX_USE_WIN32_LOCALE) && \
321 !defined(BOOST_REGEX_USE_C_LOCALE) && \
322 !defined(BOOST_REGEX_USE_CPP_LOCALE) && \
323 !defined(BOOST_REGEX_NO_W32) && \
324 !defined(BOOST_REGEX_NO_WIN32_LOCALE)
325 # define BOOST_REGEX_USE_WIN32_LOCALE
326 #endif
327 /* otherwise use C++ locale if supported: */
328 #if !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE) && !defined(BOOST_NO_STD_LOCALE)
329 # define BOOST_REGEX_USE_CPP_LOCALE
330 #endif
331 /* otherwise use C+ locale: */
332 #if !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE)
333 # define BOOST_REGEX_USE_C_LOCALE
334 #endif
335
336 #ifndef BOOST_REGEX_MAX_STATE_COUNT
337 # define BOOST_REGEX_MAX_STATE_COUNT 100000000
338 #endif
339
340
341 /*****************************************************************************
342 *
343 * Error Handling for exception free compilers:
344 *
345 ****************************************************************************/
346
347 #ifdef BOOST_NO_EXCEPTIONS
348 /*
349 * If there are no exceptions then we must report critical-errors
350 * the only way we know how; by terminating.
351 */
352 #include <stdexcept>
353 #include <string>
354 #include <boost/throw_exception.hpp>
355
356 # define BOOST_REGEX_NOEH_ASSERT(x)\
357 if(0 == (x))\
358 {\
359 std::string s("Error: critical regex++ failure in: ");\
360 s.append(#x);\
361 std::runtime_error e(s);\
362 boost::throw_exception(e);\
363 }
364 #else
365 /*
366 * With exceptions then error handling is taken care of and
367 * there is no need for these checks:
368 */
369 # define BOOST_REGEX_NOEH_ASSERT(x)
370 #endif
371
372
373 /*****************************************************************************
374 *
375 * Stack protection under MS Windows:
376 *
377 ****************************************************************************/
378
379 #if !defined(BOOST_REGEX_NO_W32) && !defined(BOOST_REGEX_V3)
380 # if(defined(_WIN32) || defined(_WIN64) || defined(_WINCE)) \
381 && !defined(__GNUC__) \
382 && !(defined(__BORLANDC__) && (__BORLANDC__ >= 0x600)) \
383 && !(defined(__MWERKS__) && (__MWERKS__ <= 0x3003))
384 # define BOOST_REGEX_HAS_MS_STACK_GUARD
385 # endif
386 #elif defined(BOOST_REGEX_HAS_MS_STACK_GUARD)
387 # undef BOOST_REGEX_HAS_MS_STACK_GUARD
388 #endif
389
390 #if defined(__cplusplus) && defined(BOOST_REGEX_HAS_MS_STACK_GUARD)
391
392 namespace boost{
393 namespace BOOST_REGEX_DETAIL_NS{
394
395 BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page();
396
397 }
398 }
399
400 #endif
401
402
403 /*****************************************************************************
404 *
405 * Algorithm selection and configuration:
406 *
407 ****************************************************************************/
408
409 #if !defined(BOOST_REGEX_RECURSIVE) && !defined(BOOST_REGEX_NON_RECURSIVE)
410 # if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && !defined(_STLP_DEBUG) && !defined(__STL_DEBUG) && !(defined(_MSC_VER) && (_MSC_VER >= 1400))
411 # define BOOST_REGEX_RECURSIVE
412 # else
413 # define BOOST_REGEX_NON_RECURSIVE
414 # endif
415 #endif
416
417 #ifdef BOOST_REGEX_NON_RECURSIVE
418 # ifdef BOOST_REGEX_RECURSIVE
419 # error "Can't set both BOOST_REGEX_RECURSIVE and BOOST_REGEX_NON_RECURSIVE"
420 # endif
421 # ifndef BOOST_REGEX_BLOCKSIZE
422 # define BOOST_REGEX_BLOCKSIZE 4096
423 # endif
424 # if BOOST_REGEX_BLOCKSIZE < 512
425 # error "BOOST_REGEX_BLOCKSIZE must be at least 512"
426 # endif
427 # ifndef BOOST_REGEX_MAX_BLOCKS
428 # define BOOST_REGEX_MAX_BLOCKS 1024
429 # endif
430 # ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
431 # undef BOOST_REGEX_HAS_MS_STACK_GUARD
432 # endif
433 # ifndef BOOST_REGEX_MAX_CACHE_BLOCKS
434 # define BOOST_REGEX_MAX_CACHE_BLOCKS 16
435 # endif
436 #endif
437
438
439 /*****************************************************************************
440 *
441 * helper memory allocation functions:
442 *
443 ****************************************************************************/
444
445 #if defined(__cplusplus) && defined(BOOST_REGEX_NON_RECURSIVE)
446 namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
447
448 BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block();
449 BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void*);
450
451 }} /* namespaces */
452 #endif
453
454 /*****************************************************************************
455 *
456 * Diagnostics:
457 *
458 ****************************************************************************/
459
460 #ifdef BOOST_REGEX_CONFIG_INFO
461 BOOST_REGEX_DECL void BOOST_REGEX_CALL print_regex_library_info();
462 #endif
463
464 #if defined(BOOST_REGEX_DIAG)
465 # pragma message ("BOOST_REGEX_DECL" BOOST_STRINGIZE(=BOOST_REGEX_DECL))
466 # pragma message ("BOOST_REGEX_CALL" BOOST_STRINGIZE(=BOOST_REGEX_CALL))
467 # pragma message ("BOOST_REGEX_CCALL" BOOST_STRINGIZE(=BOOST_REGEX_CCALL))
468 #ifdef BOOST_REGEX_USE_C_LOCALE
469 # pragma message ("Using C locale in regex traits class")
470 #elif BOOST_REGEX_USE_CPP_LOCALE
471 # pragma message ("Using C++ locale in regex traits class")
472 #else
473 # pragma message ("Using Win32 locale in regex traits class")
474 #endif
475 #if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
476 # pragma message ("Dynamic linking enabled")
477 #endif
478 #if defined(BOOST_REGEX_NO_LIB) || defined(BOOST_ALL_NO_LIB)
479 # pragma message ("Auto-linking disabled")
480 #endif
481 #ifdef BOOST_REGEX_NO_EXTERNAL_TEMPLATES
482 # pragma message ("Extern templates disabled")
483 #endif
484
485 #endif
486
487 #endif
488
489
490
491