config.hpp 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // config.hpp ---------------------------------------------------------------//
  2. // Copyright 2012 Vicente J. Botet Escriba
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // See http://www.boost.org/LICENSE_1_0.txt
  5. #ifndef BOOST_RATIO_CONFIG_HPP
  6. #define BOOST_RATIO_CONFIG_HPP
  7. #include <boost/ratio/detail/requires_cxx11.hpp>
  8. #include <boost/config.hpp>
  9. #include <boost/cstdint.hpp>
  10. #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
  11. # if ! defined BOOST_NO_CXX11_U16STRING
  12. # define BOOST_NO_CXX11_U16STRING
  13. # endif
  14. # if ! defined BOOST_NO_CXX11_U32STRING
  15. # define BOOST_NO_CXX11_U32STRING
  16. # endif
  17. #endif
  18. #if !defined BOOST_RATIO_VERSION
  19. #define BOOST_RATIO_VERSION 1
  20. #else
  21. #if BOOST_RATIO_VERSION!=1 && BOOST_RATIO_VERSION!=2
  22. #error "BOOST_RATIO_VERSION must be 1 or 2"
  23. #endif
  24. #endif
  25. #if BOOST_RATIO_VERSION==1
  26. #if ! defined BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0
  27. #define BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0
  28. #endif
  29. #endif
  30. #if BOOST_RATIO_VERSION==2
  31. #if ! defined BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0
  32. #define BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0
  33. #endif
  34. #endif
  35. #ifdef INTMAX_C
  36. #define BOOST_RATIO_INTMAX_C(a) INTMAX_C(a)
  37. #elif __cplusplus >= 201103L
  38. #define BOOST_RATIO_INTMAX_C(a) a##LL
  39. #else
  40. #define BOOST_RATIO_INTMAX_C(a) a##L
  41. #endif
  42. #ifdef UINTMAX_C
  43. #define BOOST_RATIO_UINTMAX_C(a) UINTMAX_C(a)
  44. #elif __cplusplus >= 201103L
  45. #define BOOST_RATIO_UINTMAX_C(a) a##ULL
  46. #else
  47. #define BOOST_RATIO_UINTMAX_C(a) a##UL
  48. #endif
  49. #define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFELL)
  50. #ifndef BOOST_NO_CXX11_STATIC_ASSERT
  51. #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG)
  52. #elif defined(BOOST_RATIO_USES_STATIC_ASSERT)
  53. #include <boost/static_assert.hpp>
  54. #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND)
  55. #elif defined(BOOST_RATIO_USES_MPL_ASSERT)
  56. #include <boost/mpl/assert.hpp>
  57. #include <boost/mpl/bool.hpp>
  58. #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) \
  59. BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES)
  60. #else
  61. //~ #elif defined(BOOST_RATIO_USES_ARRAY_ASSERT)
  62. #define BOOST_RATIO_CONCAT(A,B) A##B
  63. #define BOOST_RATIO_NAME(A,B) BOOST_RATIO_CONCAT(A,B)
  64. #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_RATIO_NAME(__boost_ratio_test_,__LINE__)[(CND)?1:-1]
  65. //~ #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES)
  66. #endif
  67. #if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_RATIO_USES_MPL_ASSERT)
  68. #define BOOST_RATIO_OVERFLOW_IN_ADD "overflow in ratio add"
  69. #define BOOST_RATIO_OVERFLOW_IN_SUB "overflow in ratio sub"
  70. #define BOOST_RATIO_OVERFLOW_IN_MUL "overflow in ratio mul"
  71. #define BOOST_RATIO_OVERFLOW_IN_DIV "overflow in ratio div"
  72. #define BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE "ratio numerator is out of range"
  73. #define BOOST_RATIO_DIVIDE_BY_0 "ratio divide by 0"
  74. #define BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE "ratio denominator is out of range"
  75. #endif
  76. //#define BOOST_RATIO_EXTENSIONS
  77. #endif // header