config.hpp 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*==============================================================================
  2. Copyright (c) 2001-2010 Joel de Guzman
  3. Copyright (c) 2010 Eric Niebler
  4. Copyright (c) 2014-2015 John Fletcher
  5. Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. ==============================================================================*/
  8. #ifndef BOOST_PHOENIX_CONFIG_HPP
  9. #define BOOST_PHOENIX_CONFIG_HPP
  10. #include <boost/config.hpp>
  11. //////////////////////////////////////////////////////////////////////////
  12. // This section is to sort out whether hash types or unordered types
  13. // are available. This depends on whether stdlib or libc++ is being used
  14. // and also whether C++11 or C++03 is being used.
  15. //////////////////////////////////////////////////////////////////////////
  16. // The idea is to set up the configuration without including the actual
  17. // headers unless that is unavoidable.
  18. //
  19. // The client code should contain the following to include headers
  20. //
  21. // #ifdef BOOST_PHOENIX_HAS_HASH
  22. // #include BOOST_PHOENIX_HASH_SET_HEADER
  23. // #include BOOST_PHOENIX_HASH_MAP_HEADER
  24. // #endif
  25. //
  26. // #ifdef BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP
  27. // #define BOOST_PHOENIX_UNORDERED_SET_HEADER <unordered_set>
  28. // #define BOOST_PHOENIX_UNORDERED_MAP_HEADER <unordered_map>
  29. // #endif
  30. //
  31. // The client code can then chose the implementation provided.
  32. // See the example in test/stl/querying_find2.cpp
  33. //
  34. //////////////////////////////////////////////////////////////////////////
  35. //
  36. // There is no specific thing in Boost Config for libc++
  37. #ifdef _LIBCPP_VERSION
  38. #define BOOST_PHOENIX_USING_LIBCPP
  39. // This may not be true for some very old version of libc++
  40. // Current libc++ supports unordered_set and unordered_map without C++11.
  41. #undef BOOST_NO_CXX11_HDR_UNORDERED_MAP
  42. #undef BOOST_NO_CXX11_HDR_UNORDERED_SET
  43. #endif
  44. #if (!defined(BOOST_PHOENIX_USING_LIBCPP) \
  45. && (defined (BOOST_NO_CXX11_HDR_UNORDERED_MAP) || \
  46. defined (BOOST_NO_CXX11_HDR_UNORDERED_SET) ) )
  47. #ifdef BOOST_HAS_HASH
  48. // This is to sort out case of Clang when using stdlib from gcc
  49. // as Clang thinks it is gcc 4.2.1
  50. // This prevents the failure to include a header with a warning.
  51. #define _GLIBCXX_PERMIT_BACKWARD_HASH
  52. #define BOOST_PHOENIX_PERMIT_BACKWARD_HASH
  53. #define BOOST_PHOENIX_HASH_SET_HEADER BOOST_HASH_SET_HEADER
  54. #define BOOST_PHOENIX_HASH_MAP_HEADER BOOST_HASH_MAP_HEADER
  55. #define BOOST_PHOENIX_HAS_HASH
  56. #define BOOST_PHOENIX_HASH_NAMESPACE BOOST_STD_EXTENSION_NAMESPACE
  57. #elif defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB < 610)
  58. #define BOOST_PHOENIX_HASH_SET_HEADER <hash_set>
  59. #define BOOST_PHOENIX_HASH_MAP_HEADER <hash_map>
  60. #define BOOST_PHOENIX_HAS_HASH
  61. #define BOOST_PHOENIX_HASH_NAMESPACE stdext
  62. #endif
  63. #else
  64. // This is either libc++ or C++11 or later
  65. #define BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP
  66. #define BOOST_PHOENIX_UNORDERED_SET_HEADER <unordered_set>
  67. #define BOOST_PHOENIX_UNORDERED_MAP_HEADER <unordered_map>
  68. #define BOOST_PHOENIX_UNORDERED_NAMESPACE std
  69. #endif
  70. #endif