1 /*=============================================================================
2 Boost.Wave: A Standard compliant C++ preprocessor library
4 Global application configuration
8 Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
9 Software License, Version 1.0. (See accompanying file
10 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 =============================================================================*/
13 #if !defined(BOOST_WAVE_CONFIG_HPP_F143F90A_A63F_4B27_AC41_9CA4F14F538D_INCLUDED)
14 #define BOOST_WAVE_CONFIG_HPP_F143F90A_A63F_4B27_AC41_9CA4F14F538D_INCLUDED
16 #include <boost/config.hpp>
17 #include <boost/config/pragma_message.hpp>
18 #include <boost/detail/workaround.hpp>
19 #include <boost/version.hpp>
20 #include <boost/spirit/include/classic_version.hpp>
21 #include <boost/wave/wave_version.hpp>
23 ///////////////////////////////////////////////////////////////////////////////
24 // Define the maximal include nesting depth allowed. If this value isn't
25 // defined it defaults to 1024
27 // To define a new initial include nesting define the following constant
28 // before including this file.
30 #if !defined(BOOST_WAVE_MAX_INCLUDE_LEVEL_DEPTH)
31 #define BOOST_WAVE_MAX_INCLUDE_LEVEL_DEPTH 1024
34 ///////////////////////////////////////////////////////////////////////////////
35 // Decide, whether to support variadics and placemarkers
37 // To implement support variadics and placemarkers define the following to
38 // something not equal to zero.
40 #if !defined(BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS)
41 #define BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS 1
44 ///////////////////////////////////////////////////////////////////////////////
45 // Decide whether to support the C++20 __VA_OPT__ variadics feature
48 #if !defined(BOOST_WAVE_SUPPORT_VA_OPT) && BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS
49 #define BOOST_WAVE_SUPPORT_VA_OPT 1
52 ///////////////////////////////////////////////////////////////////////////////
53 // Decide, whether to implement a #warning directive as an extension to the
54 // C++ Standard (same as #error, but emits a warning, not an error)
56 // To disable the implementation of #warning directives, define the following
57 // constant as zero before including this file.
59 #if !defined(BOOST_WAVE_SUPPORT_WARNING_DIRECTIVE)
60 #define BOOST_WAVE_SUPPORT_WARNING_DIRECTIVE 1
63 ///////////////////////////////////////////////////////////////////////////////
64 // Decide, whether to implement #pragma once
66 // To disable the implementation of #pragma once, define the following
67 // constant as zero before including this file.
69 #if !defined(BOOST_WAVE_SUPPORT_PRAGMA_ONCE)
70 #define BOOST_WAVE_SUPPORT_PRAGMA_ONCE 1
73 ///////////////////////////////////////////////////////////////////////////////
74 // Decide, whether to implement #pragma message("")
76 // To disable the implementation of #pragma message(""), define the following
77 // constant as zero before including this file.
79 #if !defined(BOOST_WAVE_SUPPORT_PRAGMA_MESSAGE)
80 #define BOOST_WAVE_SUPPORT_PRAGMA_MESSAGE 1
83 ///////////////////////////////////////////////////////////////////////////////
84 // Decide, whether to implement #include_next
85 // Please note, that this is an extension to the C++ Standard.
87 // To disable the implementation of #include_next, define the following
88 // constant as zero before including this file.
90 #if !defined(BOOST_WAVE_SUPPORT_INCLUDE_NEXT)
91 #define BOOST_WAVE_SUPPORT_INCLUDE_NEXT 1
94 ///////////////////////////////////////////////////////////////////////////////
95 // Decide, whether to support C++11
97 // To implement C++11 keywords and preprocessor semantics define the following
98 // to something not equal to zero.
100 #if !defined(BOOST_WAVE_SUPPORT_CPP0X)
101 #define BOOST_WAVE_SUPPORT_CPP0X 1
102 #undef BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS
103 #define BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS 1
106 ///////////////////////////////////////////////////////////////////////////////
107 // Decide whether to support C++17
109 #if !defined(BOOST_WAVE_SUPPORT_CPP1Z)
110 # define BOOST_WAVE_SUPPORT_CPP1Z 1
111 # undef BOOST_WAVE_SUPPORT_CPP0X
112 # define BOOST_WAVE_SUPPORT_CPP0X 1
113 # undef BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS
114 # define BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS 1
115 # if !defined(BOOST_WAVE_SUPPORT_HAS_INCLUDE)
116 # define BOOST_WAVE_SUPPORT_HAS_INCLUDE 1
118 #elif BOOST_WAVE_SUPPORT_CPP1Z == 0
119 # undef BOOST_WAVE_SUPPORT_HAS_INCLUDE
120 # define BOOST_WAVE_SUPPORT_HAS_INCLUDE 0
123 ///////////////////////////////////////////////////////////////////////////////
124 // Decide whether to support C++20
126 #if !defined(BOOST_WAVE_SUPPORT_CPP2A)
127 # define BOOST_WAVE_SUPPORT_CPP2A 1
128 # undef BOOST_WAVE_SUPPORT_CPP0X
129 # define BOOST_WAVE_SUPPORT_CPP0X 1
130 # undef BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS
131 # define BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS 1
132 # undef BOOST_WAVE_SUPPORT_CPP1Z
133 # define BOOST_WAVE_SUPPORT_CPP1Z 1
134 # if !defined(BOOST_WAVE_SUPPORT_HAS_INCLUDE)
135 # define BOOST_WAVE_SUPPORT_HAS_INCLUDE 1
137 # if !defined(BOOST_WAVE_SUPPORT_VA_OPT)
138 # define BOOST_WAVE_SUPPORT_VA_OPT 1
140 #elif BOOST_WAVE_SUPPORT_CPP2A == 0
141 # undef BOOST_WAVE_SUPPORT_VA_OPT
142 # define BOOST_WAVE_SUPPORT_VA_OPT 0
145 ///////////////////////////////////////////////////////////////////////////////
146 // Undefine the following, to enable some MS specific language extensions:
147 // __int8, __int16, __int32, __int64, __based, __declspec, __cdecl,
148 // __fastcall, __stdcall, __try, __except, __finally, __leave, __inline,
149 // __asm, #region, #endregion
151 // Note: By default this is enabled for Windows based systems, otherwise it's
153 #if !defined(BOOST_WAVE_SUPPORT_MS_EXTENSIONS)
154 #if defined(BOOST_WINDOWS)
155 #define BOOST_WAVE_SUPPORT_MS_EXTENSIONS 1
157 #define BOOST_WAVE_SUPPORT_MS_EXTENSIONS 0
161 ///////////////////////////////////////////////////////////////////////////////
162 // Allow the message body of the #error and #warning directives to be
163 // preprocessed before the diagnostic is issued.
165 // To disable preprocessing of the body of #error and #warning directives,
166 // define the following constant as zero before including this file.
168 #if !defined(BOOST_WAVE_PREPROCESS_ERROR_MESSAGE_BODY)
169 #define BOOST_WAVE_PREPROCESS_ERROR_MESSAGE_BODY 1
172 ///////////////////////////////////////////////////////////////////////////////
173 // Allow the #pragma directives to be returned to the caller (optionally after
174 // preprocessing the body)
176 // To disable the library to emit unknown #pragma directives, define the
177 // following constant as zero before including this file.
179 #if !defined(BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES)
180 #define BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES 1
183 ///////////////////////////////////////////////////////////////////////////////
184 // Allow the body of a #pragma directive to be preprocessed before the
185 // directive is returned to the caller.
187 // To disable the preprocessing of the body of #pragma directives, define the
188 // following constant as zero before including this file.
190 #if !defined(BOOST_WAVE_PREPROCESS_PRAGMA_BODY)
191 #define BOOST_WAVE_PREPROCESS_PRAGMA_BODY 1
194 ///////////////////////////////////////////////////////////////////////////////
195 // Allow to define macros with the command line syntax (-DMACRO(x)=definition)
197 // To disable the possibility to define macros based on the command line
198 // syntax, define the following constant as zero before including this file.
200 #if !defined(BOOST_WAVE_ENABLE_COMMANDLINE_MACROS)
201 #define BOOST_WAVE_ENABLE_COMMANDLINE_MACROS 1
204 ///////////////////////////////////////////////////////////////////////////////
205 // Define the pragma keyword to be used by the library to recognize its own
206 // pragma's. If nothing else is defined, then 'wave' will be used as the
207 // default keyword, i.e. the library recognizes all
209 // #pragma wave option [(argument)]
211 // and dispatches the handling to the interpret_pragma() preprocessing hook
212 // function (see file: preprocessing_hooks.hpp). The arguments part of the
213 // pragma is optional.
214 // The BOOST_WAVE_PRAGMA_KEYWORD constant needs to be defined to
215 // resolve as a string literal value.
216 #if !defined(BOOST_WAVE_PRAGMA_KEYWORD)
217 #define BOOST_WAVE_PRAGMA_KEYWORD "wave"
220 ///////////////////////////////////////////////////////////////////////////////
221 // Configure Wave thread support, Boost.Spirit and Boost.Pool are configured
222 // based on these settings automatically
224 // If BOOST_WAVE_SUPPORT_THREADING is not defined, Wave will use the global
225 // Boost build settings (BOOST_HAS_THREADS), if it is defined its value
226 // defines, whether threading will be enabled or not (should be set to '0'
228 #if !defined(BOOST_WAVE_SUPPORT_THREADING)
229 #if defined(BOOST_HAS_THREADS)
230 #define BOOST_WAVE_SUPPORT_THREADING 1
232 #define BOOST_WAVE_SUPPORT_THREADING 0
236 #if BOOST_WAVE_SUPPORT_THREADING != 0
237 #ifndef BOOST_SPIRIT_THREADSAFE
238 #define BOOST_SPIRIT_THREADSAFE
240 #define PHOENIX_THREADSAFE 1
242 // disable thread support in Boost.Pool
243 #define BOOST_NO_MT 1
246 ///////////////////////////////////////////////////////////////////////////////
247 // Define the string type to be used to store the token values and the file
248 // names inside a file_position template class
250 #if !defined(BOOST_WAVE_STRINGTYPE)
252 // VC7 isn't able to compile the flex_string class, fall back to std::string
253 // CW up to 8.3 chokes as well *sigh*
254 // Tru64/CXX has linker problems when using flex_string
255 #if BOOST_WORKAROUND(__MWERKS__, < 0x3200) || \
256 (defined(__DECCXX) && defined(__alpha)) || \
257 defined(BOOST_WAVE_STRINGTYPE_USE_STDSTRING)
259 #define BOOST_WAVE_STRINGTYPE std::string
261 #if !defined(BOOST_WAVE_STRINGTYPE_USE_STDSTRING)
262 #define BOOST_WAVE_STRINGTYPE_USE_STDSTRING 1
267 // use the following, if you have a fast std::allocator<char>
268 #define BOOST_WAVE_STRINGTYPE boost::wave::util::flex_string< \
269 char, std::char_traits<char>, std::allocator<char>, \
270 boost::wave::util::CowString< \
271 boost::wave::util::AllocatorStringStorage<char> \
276 // This include is needed for the flex_string class used in the
277 // BOOST_WAVE_STRINGTYPE above.
278 #include <boost/wave/util/flex_string.hpp>
280 #endif // BOOST_WORKAROUND(__MWERKS__, < 0x3200) et.al.
281 #endif // !defined(BOOST_WAVE_STRINGTYPE)
283 ///////////////////////////////////////////////////////////////////////////////
284 // The following definition forces the Spirit tree code to use list's instead
285 // of vectors, which may be more efficient on some platforms
286 // #define BOOST_SPIRIT_USE_LIST_FOR_TREES
288 ///////////////////////////////////////////////////////////////////////////////
289 // The following definition forces the Spirit tree code to use boost pool
290 // allocators instead of the std::allocator for the vector/list's.
291 // #define BOOST_SPIRIT_USE_BOOST_ALLOCATOR_FOR_TREES
293 ///////////////////////////////////////////////////////////////////////////////
294 // Uncomment the following, if you need debug output, the
295 // BOOST_SPIRIT_DEBUG_FLAGS_CPP constants below help to fine control the
296 // amount of the generated debug output.
297 //#define BOOST_SPIRIT_DEBUG
299 ///////////////////////////////////////////////////////////////////////////////
300 // Debug flags for the Wave library, possible flags specified below.
302 // Note: These flags take effect only if the BOOST_SPIRIT_DEBUG constant
303 // above is defined as well.
304 #define BOOST_SPIRIT_DEBUG_FLAGS_CPP_GRAMMAR 0x0001
305 #define BOOST_SPIRIT_DEBUG_FLAGS_TIME_CONVERSION 0x0002
306 #define BOOST_SPIRIT_DEBUG_FLAGS_CPP_EXPR_GRAMMAR 0x0004
307 #define BOOST_SPIRIT_DEBUG_FLAGS_INTLIT_GRAMMAR 0x0008
308 #define BOOST_SPIRIT_DEBUG_FLAGS_CHLIT_GRAMMAR 0x0010
309 #define BOOST_SPIRIT_DEBUG_FLAGS_DEFINED_GRAMMAR 0x0020
310 #define BOOST_SPIRIT_DEBUG_FLAGS_PREDEF_MACROS_GRAMMAR 0x0040
311 #define BOOST_SPIRIT_DEBUG_FLAGS_HAS_INCLUDE_GRAMMAR 0x0080
313 #if !defined(BOOST_SPIRIT_DEBUG_FLAGS_CPP)
314 #define BOOST_SPIRIT_DEBUG_FLAGS_CPP 0 // default is no debugging
317 ///////////////////////////////////////////////////////////////////////////////
319 // For all recognized preprocessor statements the output parse trees
320 // formatted as xml are printed. The formatted parse trees are streamed to the
321 // std::ostream defined by the WAVE_DUMP_PARSE_TREE_OUT constant.
323 // To enable the output of these parse trees, define the following constant
324 // as zero something not equal to zero before including this file.
326 #if !defined(BOOST_WAVE_DUMP_PARSE_TREE)
327 #define BOOST_WAVE_DUMP_PARSE_TREE 0
329 #if BOOST_WAVE_DUMP_PARSE_TREE != 0 && !defined(BOOST_WAVE_DUMP_PARSE_TREE_OUT)
330 #define BOOST_WAVE_DUMP_PARSE_TREE_OUT std::cerr
333 ///////////////////////////////////////////////////////////////////////////////
335 // For all #if and #elif directives the preprocessed expressions are printed.
336 // These expressions are streamed to the std::ostream defined by the
337 // BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS_OUT constant.
339 // To enable the output of the preprocessed expressions, define the following
340 // constant as something not equal to zero before including this file.
342 #if !defined(BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS)
343 #define BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS 0
345 #if BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS != 0 && \
346 !defined(BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS_OUT)
347 #define BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS_OUT std::cerr
350 ///////////////////////////////////////////////////////////////////////////////
351 // Decide, whether to use the separate compilation model for the instantiation
352 // of the C++ lexer objects.
354 // If this is defined, you should explicitly instantiate the C++ lexer
355 // template with the correct parameters in a separate compilation unit of
356 // your program (see the file instantiate_re2c_lexer.cpp).
358 // To use the lexer inclusion model, define the following constant as
359 // something not equal to zero before including this file.
361 #if !defined(BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION)
362 #define BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION 1
365 ///////////////////////////////////////////////////////////////////////////////
366 // Decide, whether to use the separate compilation model for the instantiation
367 // of the grammar objects.
369 // If this is defined, you should explicitly instantiate the grammar
370 // templates with the correct parameters in a separate compilation unit of
371 // your program (see the files instantiate_cpp_grammar.cpp et.al.).
373 // To use the grammar inclusion model, define the following constant as
374 // something not equal to zero before including this file.
376 #if !defined(BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION)
377 #define BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION 1
380 ///////////////////////////////////////////////////////////////////////////////
381 // Decide whether to use a strict C++ lexer.
383 // If this is defined to something != 0, then the C++ lexers recognize the
384 // strict C99/C++ basic source character set. If it is not defined or defined
385 // to zero, the C++ lexers recognize the '$' character as part of identifiers.
387 // The default is to recognize the '$' character as part of identifiers.
389 #if !defined(BOOST_WAVE_USE_STRICT_LEXER)
390 #define BOOST_WAVE_USE_STRICT_LEXER 0
393 ///////////////////////////////////////////////////////////////////////////////
394 // Decide, whether the serialization of the wave::context class should be
397 // If this is defined to something not equal to zero the generated code will
398 // expose routines allowing to store and reload the internal state of the
399 // wave::context object.
401 // To enable the availability of the serialization functionality, define the
402 // following constant as something not equal to zero before including this file.
404 #if !defined(BOOST_WAVE_SERIALIZATION)
405 #define BOOST_WAVE_SERIALIZATION 0
408 ///////////////////////////////////////////////////////////////////////////////
409 // Decide, whether the import keyword is recognized as such
411 // If this is defined to something not equal to zero the Wave will recognize
412 // import as a keyword (T_IMPORT token id)
414 #if !defined(BOOST_WAVE_SUPPORT_IMPORT_KEYWORD)
415 #define BOOST_WAVE_SUPPORT_IMPORT_KEYWORD 0
418 ///////////////////////////////////////////////////////////////////////////////
419 // Decide, whether to support long long integers in the preprocessor.
421 // The C++ standard requires the preprocessor to use one of the following
422 // types for integer literals: long or unsigned long depending on an optional
423 // suffix ('u', 'l', 'ul', or 'lu')
425 // Sometimes it's required to preprocess integer literals bigger than that
426 // (i.e. long long or unsigned long long). In this case you need to define the
427 // BOOST_WAVE_SUPPORT_LONGLONG_INTEGER_LITERALS to something not equal to zero.
429 // This pp constant is effective only, if your target platform supports
430 // long long integers (BOOST_HAS_LONG_LONG is defined).
432 // Please note, that this setting doesn't relate to the Wave support option
433 // support_option_long_long, which enables the recognition of 'll' suffixes
436 // Defining this pp constant enables the recognition of long long integers
437 // even if these do not have the 'll' suffix.
439 #if !defined(BOOST_WAVE_SUPPORT_LONGLONG_INTEGER_LITERALS)
440 #define BOOST_WAVE_SUPPORT_LONGLONG_INTEGER_LITERALS 0
443 namespace boost { namespace wave
445 #if defined(BOOST_HAS_LONG_LONG) && \
446 BOOST_WAVE_SUPPORT_LONGLONG_INTEGER_LITERALS != 0
447 typedef boost::long_long_type int_literal_type;
448 typedef boost::ulong_long_type uint_literal_type;
450 typedef long int_literal_type;
451 typedef unsigned long uint_literal_type;
455 ///////////////////////////////////////////////////////////////////////////////
456 // On some platforms Wave will not be able to properly detect whether wchar_t
457 // is representing a signed or unsigned integral data type. Use the
458 // configuration constants below to force wchar_t being signed or unsigned, as
461 // The default is to use std::numeric_limits<wchar_t>::is_signed.
463 #define BOOST_WAVE_WCHAR_T_AUTOSELECT 1
464 #define BOOST_WAVE_WCHAR_T_FORCE_SIGNED 2
465 #define BOOST_WAVE_WCHAR_T_FORCE_UNSIGNED 3
467 #if !defined(BOOST_WAVE_WCHAR_T_SIGNEDNESS)
468 #define BOOST_WAVE_WCHAR_T_SIGNEDNESS BOOST_WAVE_WCHAR_T_AUTOSELECT
471 ///////////////////////////////////////////////////////////////////////////////
472 // Wave needs at least 4 parameters for phoenix actors
473 #if !defined(PHOENIX_LIMIT)
474 #define PHOENIX_LIMIT 6
476 #if PHOENIX_LIMIT < 6
477 // boost/home/classic/spirit/classic_attribute.hpp sets PHOENIX_LIMIT to 3!
478 #error "Boost.Wave: the constant PHOENIX_LIMIT must be at least defined to 6" \
479 " to compile the library."
482 ///////////////////////////////////////////////////////////////////////////////
483 // Set up dll import/export options
484 #if (defined(BOOST_WAVE_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && \
485 !defined(BOOST_WAVE_STATIC_LINK)
487 #if defined(BOOST_WAVE_SOURCE)
488 #define BOOST_WAVE_DECL BOOST_SYMBOL_EXPORT
489 #define BOOST_WAVE_BUILD_DLL
491 #define BOOST_WAVE_DECL BOOST_SYMBOL_IMPORT
494 #endif // building a shared library
496 #ifndef BOOST_WAVE_DECL
497 #define BOOST_WAVE_DECL
500 ///////////////////////////////////////////////////////////////////////////////
501 // Auto library naming
502 #if BOOST_VERSION >= 103100
503 // auto link features work beginning from Boost V1.31.0
504 #if !defined(BOOST_WAVE_SOURCE) && !defined(BOOST_ALL_NO_LIB) && \
505 !defined(BOOST_WAVE_NO_LIB)
507 #define BOOST_LIB_NAME boost_wave
509 // tell the auto-link code to select a dll when required:
510 #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_WAVE_DYN_LINK)
511 #define BOOST_DYN_LINK
514 #include <boost/config/auto_link.hpp>
516 #endif // auto-linking disabled
517 #endif // BOOST_VERSION
519 ///////////////////////////////////////////////////////////////////////////////
521 ///////////////////////////////////////////////////////////////////////////////
523 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_NO_CXX11_RVALUE_REFERENCES) \
524 || defined(BOOST_NO_CXX11_HDR_THREAD) \
525 || defined(BOOST_NO_CXX11_HDR_MUTEX) || defined(BOOST_NO_CXX11_HDR_REGEX) \
526 || defined(BOOST_NO_CXX11_CONSTEXPR)
528 #error "C++03 support is deprecated in Boost.Wave 1.74 and was removed in Boost.Wave 1.79."
532 ///////////////////////////////////////////////////////////////////////////////
533 // Compatibility macros
534 // (ensure interface compatibility to older Wave versions)
535 ///////////////////////////////////////////////////////////////////////////////
537 ///////////////////////////////////////////////////////////////////////////////
538 // The preprocessing hook signatures changed after the Boost V1.34.0 release
540 // The old hook signatures are no longer available as of Boost 1.76.
542 #if defined(BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS) && \
543 BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
544 #error "The old preprocessing hooks were deprecated in Boost 1.35 and removed in 1.76."
547 #endif // !defined(BOOST_WAVE_CONFIG_HPP_F143F90A_A63F_4B27_AC41_9CA4F14F538D_INCLUDED)