limits.hpp 6.1 KB

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