1 /*============================================================================= 2 Copyright (c) 2001-2007 Joel de Guzman 3 4 Distributed under the Boost Software License, Version 1.0. (See accompanying 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 ==============================================================================*/ 7 #ifndef BOOST_PHOENIX_CORE_LIMITS_HPP 8 #define BOOST_PHOENIX_CORE_LIMITS_HPP 9 10 #include <boost/config.hpp> 11 #include <boost/detail/workaround.hpp> 12 #include <boost/preprocessor/arithmetic/add.hpp> 13 #include <boost/preprocessor/inc.hpp> 14 #include <boost/preprocessor/dec.hpp> 15 #include <boost/preprocessor/stringize.hpp> 16 #include <boost/phoenix/version.hpp> 17 #include <boost/phoenix/support/preprocessor/round.hpp> 18 19 20 #if defined(BOOST_PHOENIX_LIMIT) 21 # if !defined( BOOST_PROTO_MAX_ARITY ) 22 # define BOOST_PROTO_MAX_ARITY BOOST_PHOENIX_LIMIT 23 # elif (BOOST_PROTO_MAX_ARITY < BOOST_PHOENIX_LIMIT) 24 # error "BOOST_PROTO_MAX_ARITY is set too low" 25 # endif 26 #include <boost/proto/proto_fwd.hpp> 27 #else 28 #include <boost/proto/proto_fwd.hpp> 29 #define BOOST_PHOENIX_LIMIT BOOST_PROTO_MAX_ARITY 30 #endif 31 32 #if !defined(PHOENIX_LIMIT) 33 #define PHOENIX_LIMIT BOOST_PHOENIX_LIMIT 34 #endif 35 36 #define BOOST_PHOENIX_LIMIT_STR BOOST_PP_STRINGIZE(BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)) 37 38 #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES 39 # define BOOST_PHOENIX_NO_VARIADIC_ACTOR 40 # define BOOST_PHOENIX_NO_VARIADIC_CALL 41 # define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EQUAL 42 # define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL 43 # define BOOST_PHOENIX_NO_VARIADIC_PHX2_RESULT 44 # define BOOST_PHOENIX_NO_VARIADIC_EXPRESSION 45 # define BOOST_PHOENIX_NO_VARIADIC_BIND 46 # define BOOST_PHOENIX_NO_VARIADIC_SCOPE 47 #endif 48 #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES 49 # define BOOST_PHOENIX_NO_VARIADIC_ACTOR 50 # define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL 51 #endif 52 53 #if BOOST_WORKAROUND(BOOST_MSVC, == 1800) 54 // FIXME: temporary disable on MSVC 2013. 55 # define BOOST_PHOENIX_NO_VARIADIC_SCOPE 56 #endif 57 58 #ifdef BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS 59 // FIXME: Due to proto, some compilers cannot expand parameter pack. 60 # define BOOST_PHOENIX_NO_VARIADIC_ACTOR 61 # define BOOST_PHOENIX_NO_VARIADIC_CALL 62 # define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL 63 # define BOOST_PHOENIX_NO_VARIADIC_PHX2_RESULT 64 # define BOOST_PHOENIX_NO_VARIADIC_EXPRESSION 65 # define BOOST_PHOENIX_NO_VARIADIC_BIND 66 # define BOOST_PHOENIX_NO_VARIADIC_SCOPE 67 #endif 68 69 # define BOOST_PHOENIX_NO_VARIADIC_OBJECT 70 # define BOOST_PHOENIX_NO_VARIADIC_OPERATOR 71 # define BOOST_PHOENIX_NO_VARIADIC_FUNCTION 72 73 #if !defined(BOOST_PHOENIX_ARG_LIMIT) 74 # define BOOST_PHOENIX_ARG_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) 75 #elif (BOOST_PHOENIX_ARG_LIMIT < 5) 76 # error "BOOST_PHOENIX_ARG_LIMIT is set too low" 77 #elif BOOST_PHOENIX_ARG_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES) 78 # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES 79 #endif 80 81 #if !defined(BOOST_PHOENIX_ACTOR_LIMIT) 82 # define BOOST_PHOENIX_ACTOR_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) 83 #elif (BOOST_PHOENIX_ACTOR_LIMIT > BOOST_PHOENIX_ARG_LIMIT) 84 # error "BOOST_PHOENIX_ACTOR_LIMIT > BOOST_PHOENIX_ARG_LIMIT" 85 #elif (BOOST_PHOENIX_ACTOR_LIMIT < 3) 86 # error "BOOST_PHOENIX_ACTOR_LIMIT is set too low" 87 #elif BOOST_PHOENIX_ACTOR_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES) 88 # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES 89 #endif 90 91 #if !defined(BOOST_PHOENIX_PERFECT_FORWARD_LIMIT) 92 # define BOOST_PHOENIX_PERFECT_FORWARD_LIMIT 3 93 #elif (BOOST_PHOENIX_PERFECT_FORWARD_LIMIT > BOOST_PHOENIX_ACTOR_LIMIT) 94 # error "BOOST_PHOENIX_PERFECT_FORWARD_LIMIT > BOOST_PHOENIX_ACTOR_LIMIT" 95 #elif (BOOST_PHOENIX_PERFECT_FORWARD_LIMIT < 3) 96 # error "BOOST_PHOENIX_PERFECT_FORWARD_LIMIT is set too low" 97 #elif BOOST_PHOENIX_PERFECT_FORWARD_LIMIT != 3 && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES) 98 # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES 99 #endif 100 101 #if !defined(BOOST_PHOENIX_COMPOSITE_LIMIT) 102 # define BOOST_PHOENIX_COMPOSITE_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) 103 #elif (BOOST_PHOENIX_COMPOSITE_LIMIT < 5) 104 # error "BOOST_PHOENIX_COMPOSITE_LIMIT is set too low" 105 #elif BOOST_PHOENIX_COMPOSITE_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES) 106 # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES 107 #endif 108 109 #if !defined(BOOST_PHOENIX_MEMBER_LIMIT) 110 # define BOOST_PHOENIX_MEMBER_LIMIT BOOST_PP_DEC(BOOST_PHOENIX_COMPOSITE_LIMIT) 111 #elif (BOOST_PHOENIX_MEMBER_LIMIT > BOOST_PHOENIX_COMPOSITE_LIMIT) 112 # error "BOOST_PHOENIX_MEMBER_LIMIT > BOOST_PHOENIX_COMPOSITE_LIMIT" 113 #elif (BOOST_PHOENIX_MEMBER_LIMIT < 3) 114 # error "BOOST_PHOENIX_MEMBER_LIMIT is set too low" 115 #elif BOOST_PHOENIX_MEMBER_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES) 116 # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES 117 #endif 118 119 #if !defined(BOOST_PHOENIX_CATCH_LIMIT) 120 # define BOOST_PHOENIX_CATCH_LIMIT BOOST_PHOENIX_COMPOSITE_LIMIT 121 #elif (BOOST_PHOENIX_CATCH_LIMIT < 1) 122 # error "BOOST_PHOENIX_CATCH_LIMIT is set too low" 123 #elif BOOST_PHOENIX_CATCH_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES) 124 # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES 125 #endif 126 127 #if !defined(BOOST_PHOENIX_DYNAMIC_LIMIT) 128 # define BOOST_PHOENIX_DYNAMIC_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) 129 #elif (BOOST_PHOENIX_DYNAMIC_LIMIT < 1) 130 # error "BOOST_PHOENIX_DYNAMIC_LIMIT is set too low" 131 #elif BOOST_PHOENIX_DYNAMIC_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES) 132 # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES 133 #endif 134 135 #if !defined(BOOST_PHOENIX_LOCAL_LIMIT) 136 # define BOOST_PHOENIX_LOCAL_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) 137 #elif (BOOST_PHOENIX_LOCAL_LIMIT < 3) 138 # error "BOOST_PHOENIX_LOCAL_LIMIT is set too low" 139 #elif BOOST_PHOENIX_LOCAL_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES) 140 # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES 141 #endif 142 143 #endif 144