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