wave_config.hpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. /*=============================================================================
  2. Boost.Wave: A Standard compliant C++ preprocessor library
  3. Global application configuration
  4. http://www.boost.org/
  5. Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
  6. Software License, Version 1.0. (See accompanying file
  7. LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  8. =============================================================================*/
  9. #if !defined(WAVE_CONFIG_HPP_F143F90A_A63F_4B27_AC41_9CA4F14F538D_INCLUDED)
  10. #define WAVE_CONFIG_HPP_F143F90A_A63F_4B27_AC41_9CA4F14F538D_INCLUDED
  11. #include <boost/config.hpp>
  12. #include <boost/detail/workaround.hpp>
  13. #include <boost/version.hpp>
  14. #include <boost/spirit/include/classic_version.hpp>
  15. #include <boost/wave/wave_version.hpp>
  16. ///////////////////////////////////////////////////////////////////////////////
  17. // Define the maximal include nesting depth allowed. If this value isn't
  18. // defined it defaults to 1024
  19. //
  20. // To define a new initial include nesting define the following constant
  21. // before including this file.
  22. //
  23. #if !defined(BOOST_WAVE_MAX_INCLUDE_LEVEL_DEPTH)
  24. #define BOOST_WAVE_MAX_INCLUDE_LEVEL_DEPTH 1024
  25. #endif
  26. ///////////////////////////////////////////////////////////////////////////////
  27. // Decide, whether to support variadics and placemarkers
  28. //
  29. // To implement support variadics and placemarkers define the following to
  30. // something not equal to zero.
  31. //
  32. #if !defined(BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS)
  33. #define BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS 1
  34. #endif
  35. ///////////////////////////////////////////////////////////////////////////////
  36. // Decide, whether to implement a #warning directive as an extension to the
  37. // C++ Standard (same as #error, but emits a warning, not an error)
  38. //
  39. // To disable the implementation of #warning directives, define the following
  40. // constant as zero before including this file.
  41. //
  42. #if !defined(BOOST_WAVE_SUPPORT_WARNING_DIRECTIVE)
  43. #define BOOST_WAVE_SUPPORT_WARNING_DIRECTIVE 1
  44. #endif
  45. ///////////////////////////////////////////////////////////////////////////////
  46. // Decide, whether to implement #pragma once
  47. //
  48. // To disable the implementation of #pragma once, define the following
  49. // constant as zero before including this file.
  50. //
  51. #if !defined(BOOST_WAVE_SUPPORT_PRAGMA_ONCE)
  52. #define BOOST_WAVE_SUPPORT_PRAGMA_ONCE 1
  53. #endif
  54. ///////////////////////////////////////////////////////////////////////////////
  55. // Decide, whether to implement #pragma message("")
  56. //
  57. // To disable the implementation of #pragma message(""), define the following
  58. // constant as zero before including this file.
  59. //
  60. #if !defined(BOOST_WAVE_SUPPORT_PRAGMA_MESSAGE)
  61. #define BOOST_WAVE_SUPPORT_PRAGMA_MESSAGE 1
  62. #endif
  63. ///////////////////////////////////////////////////////////////////////////////
  64. // Decide, whether to implement #include_next
  65. // Please note, that this is an extension to the C++ Standard.
  66. //
  67. // To disable the implementation of #include_next, define the following
  68. // constant as zero before including this file.
  69. //
  70. #if !defined(BOOST_WAVE_SUPPORT_INCLUDE_NEXT)
  71. #define BOOST_WAVE_SUPPORT_INCLUDE_NEXT 1
  72. #endif
  73. ///////////////////////////////////////////////////////////////////////////////
  74. // Decide, whether to support C++11
  75. //
  76. // To implement C++11 keywords and preprocessor semantics define the following
  77. // to something not equal to zero.
  78. //
  79. #if !defined(BOOST_WAVE_SUPPORT_CPP0X)
  80. #define BOOST_WAVE_SUPPORT_CPP0X 1
  81. #undef BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS
  82. #define BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS 1
  83. #endif
  84. ///////////////////////////////////////////////////////////////////////////////
  85. // Undefine the following, to enable some MS specific language extensions:
  86. // __int8, __int16, __int32, __int64, __based, __declspec, __cdecl,
  87. // __fastcall, __stdcall, __try, __except, __finally, __leave, __inline,
  88. // __asm, #region, #endregion
  89. //
  90. // Note: By default this is enabled for Windows based systems, otherwise it's
  91. // disabled.
  92. #if !defined(BOOST_WAVE_SUPPORT_MS_EXTENSIONS)
  93. #if defined(BOOST_WINDOWS)
  94. #define BOOST_WAVE_SUPPORT_MS_EXTENSIONS 1
  95. #else
  96. #define BOOST_WAVE_SUPPORT_MS_EXTENSIONS 0
  97. #endif
  98. #endif
  99. ///////////////////////////////////////////////////////////////////////////////
  100. // Allow the message body of the #error and #warning directives to be
  101. // preprocessed before the diagnostic is issued.
  102. //
  103. // To disable preprocessing of the body of #error and #warning directives,
  104. // define the following constant as zero before including this file.
  105. //
  106. #if !defined(BOOST_WAVE_PREPROCESS_ERROR_MESSAGE_BODY)
  107. #define BOOST_WAVE_PREPROCESS_ERROR_MESSAGE_BODY 1
  108. #endif
  109. ///////////////////////////////////////////////////////////////////////////////
  110. // Allow the #pragma directives to be returned to the caller (optionally after
  111. // preprocessing the body)
  112. //
  113. // To disable the library to emit unknown #pragma directives, define the
  114. // following constant as zero before including this file.
  115. //
  116. #if !defined(BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES)
  117. #define BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES 1
  118. #endif
  119. ///////////////////////////////////////////////////////////////////////////////
  120. // Allow the body of a #pragma directive to be preprocessed before the
  121. // directive is returned to the caller.
  122. //
  123. // To disable the preprocessing of the body of #pragma directives, define the
  124. // following constant as zero before including this file.
  125. //
  126. #if !defined(BOOST_WAVE_PREPROCESS_PRAGMA_BODY)
  127. #define BOOST_WAVE_PREPROCESS_PRAGMA_BODY 1
  128. #endif
  129. ///////////////////////////////////////////////////////////////////////////////
  130. // Allow to define macros with the command line syntax (-DMACRO(x)=definition)
  131. //
  132. // To disable the possibility to define macros based on the command line
  133. // syntax, define the following constant as zero before including this file.
  134. //
  135. #if !defined(BOOST_WAVE_ENABLE_COMMANDLINE_MACROS)
  136. #define BOOST_WAVE_ENABLE_COMMANDLINE_MACROS 1
  137. #endif
  138. ///////////////////////////////////////////////////////////////////////////////
  139. // Define the pragma keyword to be used by the library to recognize its own
  140. // pragma's. If nothing else is defined, then 'wave' will be used as the
  141. // default keyword, i.e. the library recognizes all
  142. //
  143. // #pragma wave option [(argument)]
  144. //
  145. // and dispatches the handling to the interpret_pragma() preprocessing hook
  146. // function (see file: preprocessing_hooks.hpp). The arguments part of the
  147. // pragma is optional.
  148. // The BOOST_WAVE_PRAGMA_KEYWORD constant needs to be defined to
  149. // resolve as a string literal value.
  150. #if !defined(BOOST_WAVE_PRAGMA_KEYWORD)
  151. #define BOOST_WAVE_PRAGMA_KEYWORD "wave"
  152. #endif
  153. ///////////////////////////////////////////////////////////////////////////////
  154. // Configure Wave thread support, Boost.Spirit and Boost.Pool are configured
  155. // based on these settings automatically
  156. //
  157. // If BOOST_WAVE_SUPPORT_THREADING is not defined, Wave will use the global
  158. // Boost build settings (BOOST_HAS_THREADS), if it is defined its value
  159. // defines, whether threading will be enabled or not (should be set to '0'
  160. // or '1').
  161. #if !defined(BOOST_WAVE_SUPPORT_THREADING)
  162. #if defined(BOOST_HAS_THREADS)
  163. #define BOOST_WAVE_SUPPORT_THREADING 1
  164. #else
  165. #define BOOST_WAVE_SUPPORT_THREADING 0
  166. #endif
  167. #endif
  168. #if BOOST_WAVE_SUPPORT_THREADING != 0
  169. #ifndef BOOST_SPIRIT_THREADSAFE
  170. #define BOOST_SPIRIT_THREADSAFE
  171. #endif
  172. #define PHOENIX_THREADSAFE 1
  173. #else
  174. // disable thread support in Boost.Pool
  175. #define BOOST_NO_MT 1
  176. #endif
  177. ///////////////////////////////////////////////////////////////////////////////
  178. // Define the string type to be used to store the token values and the file
  179. // names inside a file_position template class
  180. //
  181. #if !defined(BOOST_WAVE_STRINGTYPE)
  182. // VC7 isn't able to compile the flex_string class, fall back to std::string
  183. // CW up to 8.3 chokes as well *sigh*
  184. // Tru64/CXX has linker problems when using flex_string
  185. #if BOOST_WORKAROUND(__MWERKS__, < 0x3200) || \
  186. (defined(__DECCXX) && defined(__alpha)) || \
  187. defined(BOOST_WAVE_STRINGTYPE_USE_STDSTRING)
  188. #define BOOST_WAVE_STRINGTYPE std::string
  189. #if !defined(BOOST_WAVE_STRINGTYPE_USE_STDSTRING)
  190. #define BOOST_WAVE_STRINGTYPE_USE_STDSTRING 1
  191. #endif
  192. #else
  193. // use the following, if you have a fast std::allocator<char>
  194. #define BOOST_WAVE_STRINGTYPE boost::wave::util::flex_string< \
  195. char, std::char_traits<char>, std::allocator<char>, \
  196. boost::wave::util::CowString< \
  197. boost::wave::util::AllocatorStringStorage<char> \
  198. > \
  199. > \
  200. /**/
  201. // This include is needed for the flex_string class used in the
  202. // BOOST_WAVE_STRINGTYPE above.
  203. #include <boost/wave/util/flex_string.hpp>
  204. #endif // BOOST_WORKAROUND(__MWERKS__, < 0x3200) et.al.
  205. #endif // !defined(BOOST_WAVE_STRINGTYPE)
  206. ///////////////////////////////////////////////////////////////////////////////
  207. // The following definition forces the Spirit tree code to use list's instead
  208. // of vectors, which may be more efficient on some platforms
  209. // #define BOOST_SPIRIT_USE_LIST_FOR_TREES
  210. ///////////////////////////////////////////////////////////////////////////////
  211. // The following definition forces the Spirit tree code to use boost pool
  212. // allocators instead of the std::allocator for the vector/list's.
  213. // #define BOOST_SPIRIT_USE_BOOST_ALLOCATOR_FOR_TREES
  214. ///////////////////////////////////////////////////////////////////////////////
  215. // Uncomment the following, if you need debug output, the
  216. // BOOST_SPIRIT_DEBUG_FLAGS_CPP constants below help to fine control the
  217. // amount of the generated debug output.
  218. //#define BOOST_SPIRIT_DEBUG
  219. ///////////////////////////////////////////////////////////////////////////////
  220. // Debug flags for the Wave library, possible flags specified below.
  221. //
  222. // Note: These flags take effect only if the BOOST_SPIRIT_DEBUG constant
  223. // above is defined as well.
  224. #define BOOST_SPIRIT_DEBUG_FLAGS_CPP_GRAMMAR 0x0001
  225. #define BOOST_SPIRIT_DEBUG_FLAGS_TIME_CONVERSION 0x0002
  226. #define BOOST_SPIRIT_DEBUG_FLAGS_CPP_EXPR_GRAMMAR 0x0004
  227. #define BOOST_SPIRIT_DEBUG_FLAGS_INTLIT_GRAMMAR 0x0008
  228. #define BOOST_SPIRIT_DEBUG_FLAGS_CHLIT_GRAMMAR 0x0010
  229. #define BOOST_SPIRIT_DEBUG_FLAGS_DEFINED_GRAMMAR 0x0020
  230. #define BOOST_SPIRIT_DEBUG_FLAGS_PREDEF_MACROS_GRAMMAR 0x0040
  231. #if !defined(BOOST_SPIRIT_DEBUG_FLAGS_CPP)
  232. #define BOOST_SPIRIT_DEBUG_FLAGS_CPP 0 // default is no debugging
  233. #endif
  234. ///////////////////////////////////////////////////////////////////////////////
  235. //
  236. // For all recognized preprocessor statements the output parse trees
  237. // formatted as xml are printed. The formatted parse trees are streamed to the
  238. // std::ostream defined by the WAVE_DUMP_PARSE_TREE_OUT constant.
  239. //
  240. // To enable the output of these parse trees, define the following constant
  241. // as zero something not equal to zero before including this file.
  242. //
  243. #if !defined(BOOST_WAVE_DUMP_PARSE_TREE)
  244. #define BOOST_WAVE_DUMP_PARSE_TREE 0
  245. #endif
  246. #if BOOST_WAVE_DUMP_PARSE_TREE != 0 && !defined(BOOST_WAVE_DUMP_PARSE_TREE_OUT)
  247. #define BOOST_WAVE_DUMP_PARSE_TREE_OUT std::cerr
  248. #endif
  249. ///////////////////////////////////////////////////////////////////////////////
  250. //
  251. // For all #if and #elif directives the preprocessed expressions are printed.
  252. // These expressions are streamed to the std::ostream defined by the
  253. // BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS_OUT constant.
  254. //
  255. // To enable the output of the preprocessed expressions, define the following
  256. // constant as something not equal to zero before including this file.
  257. //
  258. #if !defined(BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS)
  259. #define BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS 0
  260. #endif
  261. #if BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS != 0 && \
  262. !defined(BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS_OUT)
  263. #define BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS_OUT std::cerr
  264. #endif
  265. ///////////////////////////////////////////////////////////////////////////////
  266. // Decide, whether to use the separate compilation model for the instantiation
  267. // of the C++ lexer objects.
  268. //
  269. // If this is defined, you should explicitly instantiate the C++ lexer
  270. // template with the correct parameters in a separate compilation unit of
  271. // your program (see the file instantiate_re2c_lexer.cpp).
  272. //
  273. // To use the lexer inclusion model, define the following constant as
  274. // something not equal to zero before including this file.
  275. //
  276. #if !defined(BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION)
  277. #define BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION 1
  278. #endif
  279. ///////////////////////////////////////////////////////////////////////////////
  280. // Decide, whether to use the separate compilation model for the instantiation
  281. // of the grammar objects.
  282. //
  283. // If this is defined, you should explicitly instantiate the grammar
  284. // templates with the correct parameters in a separate compilation unit of
  285. // your program (see the files instantiate_cpp_grammar.cpp et.al.).
  286. //
  287. // To use the grammar inclusion model, define the following constant as
  288. // something not equal to zero before including this file.
  289. //
  290. #if !defined(BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION)
  291. #define BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION 1
  292. #endif
  293. ///////////////////////////////////////////////////////////////////////////////
  294. // Decide whether to use a strict C++ lexer.
  295. //
  296. // If this is defined to something != 0, then the C++ lexers recognize the
  297. // strict C99/C++ basic source character set. If it is not defined or defined
  298. // to zero, the C++ lexers recognize the '$' character as part of identifiers.
  299. //
  300. // The default is to recognize the '$' character as part of identifiers.
  301. //
  302. #if !defined(BOOST_WAVE_USE_STRICT_LEXER)
  303. #define BOOST_WAVE_USE_STRICT_LEXER 0
  304. #endif
  305. ///////////////////////////////////////////////////////////////////////////////
  306. // Decide, whether the serialization of the wave::context class should be
  307. // supported
  308. //
  309. // If this is defined to something not equal to zero the generated code will
  310. // expose routines allowing to store and reload the internal state of the
  311. // wave::context object.
  312. //
  313. // To enable the availability of the serialization functionality, define the
  314. // following constant as something not equal to zero before including this file.
  315. //
  316. #if !defined(BOOST_WAVE_SERIALIZATION)
  317. #define BOOST_WAVE_SERIALIZATION 0
  318. #endif
  319. ///////////////////////////////////////////////////////////////////////////////
  320. // Decide, whether the import keyword is recognized as such
  321. //
  322. // If this is defined to something not equal to zero the Wave will recognize
  323. // import as a keyword (T_IMPORT token id)
  324. //
  325. #if !defined(BOOST_WAVE_SUPPORT_IMPORT_KEYWORD)
  326. #define BOOST_WAVE_SUPPORT_IMPORT_KEYWORD 0
  327. #endif
  328. ///////////////////////////////////////////////////////////////////////////////
  329. // Decide, whether to support long long integers in the preprocessor.
  330. //
  331. // The C++ standard requires the preprocessor to use one of the following
  332. // types for integer literals: long or unsigned long depending on an optional
  333. // suffix ('u', 'l', 'ul', or 'lu')
  334. //
  335. // Sometimes it's required to preprocess integer literals bigger than that
  336. // (i.e. long long or unsigned long long). In this case you need to define the
  337. // BOOST_WAVE_SUPPORT_LONGLONG_INTEGER_LITERALS to something not equal to zero.
  338. //
  339. // This pp constant is effective only, if your target platform supports
  340. // long long integers (BOOST_HAS_LONG_LONG is defined).
  341. //
  342. // Please note, that this setting doesn't relate to the Wave support option
  343. // support_option_long_long, which enables the recognition of 'll' suffixes
  344. // only.
  345. //
  346. // Defining this pp constant enables the recognition of long long integers
  347. // even if these do not have the 'll' suffix.
  348. //
  349. #if !defined(BOOST_WAVE_SUPPORT_LONGLONG_INTEGER_LITERALS)
  350. #define BOOST_WAVE_SUPPORT_LONGLONG_INTEGER_LITERALS 0
  351. #endif
  352. namespace boost { namespace wave
  353. {
  354. #if defined(BOOST_HAS_LONG_LONG) && \
  355. BOOST_WAVE_SUPPORT_LONGLONG_INTEGER_LITERALS != 0
  356. typedef boost::long_long_type int_literal_type;
  357. typedef boost::ulong_long_type uint_literal_type;
  358. #else
  359. typedef long int_literal_type;
  360. typedef unsigned long uint_literal_type;
  361. #endif
  362. }}
  363. ///////////////////////////////////////////////////////////////////////////////
  364. // On some platforms Wave will not be able to properly detect whether wchar_t
  365. // is representing a signed or unsigned integral data type. Use the
  366. // configuration constants below to force wchar_t being signed or unsigned, as
  367. // appropriate.
  368. //
  369. // The default is to use std::numeric_limits<wchar_t>::is_signed.
  370. #define BOOST_WAVE_WCHAR_T_AUTOSELECT 1
  371. #define BOOST_WAVE_WCHAR_T_FORCE_SIGNED 2
  372. #define BOOST_WAVE_WCHAR_T_FORCE_UNSIGNED 3
  373. #if !defined(BOOST_WAVE_WCHAR_T_SIGNEDNESS)
  374. #define BOOST_WAVE_WCHAR_T_SIGNEDNESS BOOST_WAVE_WCHAR_T_AUTOSELECT
  375. #endif
  376. ///////////////////////////////////////////////////////////////////////////////
  377. // Wave needs at least 4 parameters for phoenix actors
  378. #if !defined(PHOENIX_LIMIT)
  379. #define PHOENIX_LIMIT 6
  380. #endif
  381. #if PHOENIX_LIMIT < 6
  382. // boost/home/classic/spirit/classic_attribute.hpp sets PHOENIX_LIMIT to 3!
  383. #error "Boost.Wave: the constant PHOENIX_LIMIT must be at least defined to 6" \
  384. " to compile the library."
  385. #endif
  386. ///////////////////////////////////////////////////////////////////////////////
  387. // Set up dll import/export options
  388. #if (defined(BOOST_WAVE_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && \
  389. !defined(BOOST_WAVE_STATIC_LINK)
  390. #if defined(BOOST_WAVE_SOURCE)
  391. #define BOOST_WAVE_DECL BOOST_SYMBOL_EXPORT
  392. #define BOOST_WAVE_BUILD_DLL
  393. #else
  394. #define BOOST_WAVE_DECL BOOST_SYMBOL_IMPORT
  395. #endif
  396. #endif // building a shared library
  397. #ifndef BOOST_WAVE_DECL
  398. #define BOOST_WAVE_DECL
  399. #endif
  400. ///////////////////////////////////////////////////////////////////////////////
  401. // Auto library naming
  402. #if BOOST_VERSION >= 103100
  403. // auto link features work beginning from Boost V1.31.0
  404. #if !defined(BOOST_WAVE_SOURCE) && !defined(BOOST_ALL_NO_LIB) && \
  405. !defined(BOOST_WAVE_NO_LIB)
  406. #define BOOST_LIB_NAME boost_wave
  407. // tell the auto-link code to select a dll when required:
  408. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_WAVE_DYN_LINK)
  409. #define BOOST_DYN_LINK
  410. #endif
  411. #include <boost/config/auto_link.hpp>
  412. #endif // auto-linking disabled
  413. #endif // BOOST_VERSION
  414. ///////////////////////////////////////////////////////////////////////////////
  415. // Compatibility macros
  416. // (ensure interface compatibility to older Wave versions)
  417. ///////////////////////////////////////////////////////////////////////////////
  418. ///////////////////////////////////////////////////////////////////////////////
  419. // The preprocessing hook signatures changed after the Boost V1.34.0 release
  420. //
  421. // To use the preprocessing hook signatures as released with Boost V1.34.0
  422. // you need to define the BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS
  423. // constant to something not equal zero.
  424. //
  425. // To force using the new interface define this constant to zero.
  426. //
  427. #if !defined(BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS)
  428. #if BOOST_VERSION < 103500 // before Boost V1.35.0
  429. #define BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS 1
  430. #else
  431. #define BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS 0
  432. #endif
  433. #endif
  434. #endif // !defined(WAVE_CONFIG_HPP_F143F90A_A63F_4B27_AC41_9CA4F14F538D_INCLUDED)