config.hpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // Copyright (c) 2016-2021 Antony Polukhin
  2. //
  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. #ifndef BOOST_PFR_DETAIL_CONFIG_HPP
  6. #define BOOST_PFR_DETAIL_CONFIG_HPP
  7. #pragma once
  8. #include <type_traits> // to get non standard platform macro definitions (__GLIBCXX__ for example)
  9. // Reminder:
  10. // * MSVC++ 14.2 _MSC_VER == 1927 <- Loophole is known to work (Visual Studio ????)
  11. // * MSVC++ 14.1 _MSC_VER == 1916 <- Loophole is known to NOT work (Visual Studio 2017)
  12. // * MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)
  13. // * MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
  14. #if defined(_MSC_VER)
  15. # if !defined(_MSVC_LANG) || _MSC_VER <= 1900
  16. # error Boost.PFR library requires more modern MSVC compiler.
  17. # endif
  18. #elif __cplusplus < 201402L
  19. # error Boost.PFR library requires at least C++14.
  20. #endif
  21. #ifndef BOOST_PFR_USE_LOOPHOLE
  22. # if defined(_MSC_VER)
  23. # if _MSC_VER >= 1927
  24. # define BOOST_PFR_USE_LOOPHOLE 1
  25. # else
  26. # define BOOST_PFR_USE_LOOPHOLE 0
  27. # endif
  28. # elif defined(__clang_major__) && __clang_major__ >= 8
  29. # define BOOST_PFR_USE_LOOPHOLE 0
  30. # else
  31. # define BOOST_PFR_USE_LOOPHOLE 1
  32. # endif
  33. #endif
  34. #ifndef BOOST_PFR_USE_CPP17
  35. # ifdef __cpp_structured_bindings
  36. # define BOOST_PFR_USE_CPP17 1
  37. # elif defined(_MSVC_LANG)
  38. # if _MSVC_LANG >= 201703L
  39. # define BOOST_PFR_USE_CPP17 1
  40. # else
  41. # define BOOST_PFR_USE_CPP17 0
  42. # if !BOOST_PFR_USE_LOOPHOLE
  43. # error Boost.PFR requires /std:c++latest or /std:c++17 flags on your compiler.
  44. # endif
  45. # endif
  46. # else
  47. # define BOOST_PFR_USE_CPP17 0
  48. # endif
  49. #endif
  50. #ifndef BOOST_PFR_USE_STD_MAKE_INTEGRAL_SEQUENCE
  51. // Assume that libstdc++ since GCC-7.3 does not have linear instantiation depth in std::make_integral_sequence
  52. # if defined( __GLIBCXX__) && __GLIBCXX__ >= 20180101
  53. # define BOOST_PFR_USE_STD_MAKE_INTEGRAL_SEQUENCE 1
  54. # elif defined(_MSC_VER)
  55. # define BOOST_PFR_USE_STD_MAKE_INTEGRAL_SEQUENCE 1
  56. //# elif other known working lib
  57. # else
  58. # define BOOST_PFR_USE_STD_MAKE_INTEGRAL_SEQUENCE 0
  59. # endif
  60. #endif
  61. #if defined(__has_cpp_attribute)
  62. # if __has_cpp_attribute(maybe_unused)
  63. # define BOOST_PFR_MAYBE_UNUSED [[maybe_unused]]
  64. # endif
  65. #endif
  66. #ifndef BOOST_PFR_MAYBE_UNUSED
  67. # define BOOST_PFR_MAYBE_UNUSED
  68. #endif
  69. #endif // BOOST_PFR_DETAIL_CONFIG_HPP