limits.hpp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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_EXPRESSION
  37. # define BOOST_PHOENIX_NO_VARIADIC_BIND
  38. # define BOOST_PHOENIX_NO_VARIADIC_SCOPE
  39. #endif
  40. #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
  41. # define BOOST_PHOENIX_NO_VARIADIC_ACTOR
  42. # define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL
  43. #endif
  44. #if BOOST_WORKAROUND(BOOST_MSVC, == 1800)
  45. // FIXME: temporary disable on MSVC 2013.
  46. # define BOOST_PHOENIX_NO_VARIADIC_SCOPE
  47. #endif
  48. #ifdef BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
  49. // FIXME: Due to proto, some compilers cannot expand parameter pack.
  50. # define BOOST_PHOENIX_NO_VARIADIC_ACTOR
  51. # define BOOST_PHOENIX_NO_VARIADIC_CALL
  52. # define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL
  53. # define BOOST_PHOENIX_NO_VARIADIC_EXPRESSION
  54. # define BOOST_PHOENIX_NO_VARIADIC_BIND
  55. # define BOOST_PHOENIX_NO_VARIADIC_SCOPE
  56. #endif
  57. # define BOOST_PHOENIX_NO_VARIADIC_OBJECT
  58. # define BOOST_PHOENIX_NO_VARIADIC_OPERATOR
  59. # define BOOST_PHOENIX_NO_VARIADIC_FUNCTION
  60. #if !defined(BOOST_PHOENIX_ARG_LIMIT)
  61. # define BOOST_PHOENIX_ARG_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
  62. #elif (BOOST_PHOENIX_ARG_LIMIT < 5)
  63. # error "BOOST_PHOENIX_ARG_LIMIT is set too low"
  64. #elif BOOST_PHOENIX_ARG_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  65. # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
  66. #endif
  67. #if !defined(BOOST_PHOENIX_ACTOR_LIMIT)
  68. # define BOOST_PHOENIX_ACTOR_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
  69. #elif (BOOST_PHOENIX_ACTOR_LIMIT > BOOST_PHOENIX_ARG_LIMIT)
  70. # error "BOOST_PHOENIX_ACTOR_LIMIT > BOOST_PHOENIX_ARG_LIMIT"
  71. #elif (BOOST_PHOENIX_ACTOR_LIMIT < 3)
  72. # error "BOOST_PHOENIX_ACTOR_LIMIT is set too low"
  73. #elif BOOST_PHOENIX_ACTOR_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  74. # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
  75. #endif
  76. #if !defined(BOOST_PHOENIX_PERFECT_FORWARD_LIMIT)
  77. # define BOOST_PHOENIX_PERFECT_FORWARD_LIMIT 3
  78. #elif (BOOST_PHOENIX_PERFECT_FORWARD_LIMIT > BOOST_PHOENIX_ACTOR_LIMIT)
  79. # error "BOOST_PHOENIX_PERFECT_FORWARD_LIMIT > BOOST_PHOENIX_ACTOR_LIMIT"
  80. #elif (BOOST_PHOENIX_PERFECT_FORWARD_LIMIT < 3)
  81. # error "BOOST_PHOENIX_PERFECT_FORWARD_LIMIT is set too low"
  82. #elif BOOST_PHOENIX_PERFECT_FORWARD_LIMIT != 3 && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  83. # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
  84. #endif
  85. #if !defined(BOOST_PHOENIX_COMPOSITE_LIMIT)
  86. # define BOOST_PHOENIX_COMPOSITE_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
  87. #elif (BOOST_PHOENIX_COMPOSITE_LIMIT < 5)
  88. # error "BOOST_PHOENIX_COMPOSITE_LIMIT is set too low"
  89. #elif BOOST_PHOENIX_COMPOSITE_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  90. # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
  91. #endif
  92. #if !defined(BOOST_PHOENIX_MEMBER_LIMIT)
  93. # define BOOST_PHOENIX_MEMBER_LIMIT BOOST_PP_DEC(BOOST_PHOENIX_COMPOSITE_LIMIT)
  94. #elif (BOOST_PHOENIX_MEMBER_LIMIT > BOOST_PHOENIX_COMPOSITE_LIMIT)
  95. # error "BOOST_PHOENIX_MEMBER_LIMIT > BOOST_PHOENIX_COMPOSITE_LIMIT"
  96. #elif (BOOST_PHOENIX_MEMBER_LIMIT < 3)
  97. # error "BOOST_PHOENIX_MEMBER_LIMIT is set too low"
  98. #elif BOOST_PHOENIX_MEMBER_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  99. # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
  100. #endif
  101. #if !defined(BOOST_PHOENIX_CATCH_LIMIT)
  102. # define BOOST_PHOENIX_CATCH_LIMIT BOOST_PHOENIX_COMPOSITE_LIMIT
  103. #elif (BOOST_PHOENIX_CATCH_LIMIT < 1)
  104. # error "BOOST_PHOENIX_CATCH_LIMIT is set too low"
  105. #elif BOOST_PHOENIX_CATCH_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. #if !defined(BOOST_PHOENIX_DYNAMIC_LIMIT)
  109. # define BOOST_PHOENIX_DYNAMIC_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
  110. #elif (BOOST_PHOENIX_DYNAMIC_LIMIT < 1)
  111. # error "BOOST_PHOENIX_DYNAMIC_LIMIT is set too low"
  112. #elif BOOST_PHOENIX_DYNAMIC_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  113. # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
  114. #endif
  115. #if !defined(BOOST_PHOENIX_LOCAL_LIMIT)
  116. # define BOOST_PHOENIX_LOCAL_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
  117. #elif (BOOST_PHOENIX_LOCAL_LIMIT < 3)
  118. # error "BOOST_PHOENIX_LOCAL_LIMIT is set too low"
  119. #elif BOOST_PHOENIX_LOCAL_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  120. # define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
  121. #endif
  122. #endif