Refactor C++20 header configuration.

Fixes: https://github.com/boostorg/config/issues/418
Fixes: https://github.com/boostorg/config/issues/420
This commit is contained in:
jzmaddock
2022-02-03 18:54:20 +00:00
parent ef68c9d944
commit 8104280db6
3 changed files with 23 additions and 97 deletions

View File

@@ -1135,9 +1135,14 @@ namespace std{ using ::type_info; }
#endif
#endif
#endif
//
// Define the std level that the compiler claims to support:
//
#ifndef BOOST_CXX_VERSION
# define BOOST_CXX_VERSION __cplusplus
#endif
#if !defined(_YVALS) && !defined(_CPPLIB_VER) // msvc std lib already configured
#if (!defined(__has_include) || (__cplusplus < 201704))
#if (!defined(__has_include) || (BOOST_CXX_VERSION < 201704))
# define BOOST_NO_CXX20_HDR_BARRIER
# define BOOST_NO_CXX20_HDR_FORMAT
# define BOOST_NO_CXX20_HDR_SOURCE_LOCATION
@@ -1153,50 +1158,49 @@ namespace std{ using ::type_info; }
# define BOOST_NO_CXX20_HDR_COROUTINE
# define BOOST_NO_CXX20_HDR_SEMAPHORE
#else
#if !__has_include(<barrier>)
#if (!__has_include(<barrier>) || !defined(__cpp_lib_barrier) || (__cpp_lib_barrier < 201907L)) && !defined(BOOST_NO_CXX20_HDR_BARRIER)
# define BOOST_NO_CXX20_HDR_BARRIER
#endif
#if !__has_include(<format>)
#if (!__has_include(<format>) || !defined(__cpp_lib_format) || (__cpp_lib_format < 201907L)) && !defined(BOOST_NO_CXX20_HDR_FORMAT)
# define BOOST_NO_CXX20_HDR_FORMAT
#endif
#if !__has_include(<source_location>)
#if (!__has_include(<source_location>) || !defined(__cpp_lib_source_location) || (__cpp_lib_source_location < 201907L)) && !defined(BOOST_NO_CXX20_HDR_SOURCE_LOCATION)
# define BOOST_NO_CXX20_HDR_SOURCE_LOCATION
#endif
#if !__has_include(<bit>)
#if (!__has_include(<bit>) || !defined(__cpp_lib_bit_cast) || (__cpp_lib_bit_cast < 201806L) || !defined(__cpp_lib_bitops) || (__cpp_lib_bitops < 201907L) || !defined(__cpp_lib_endian) || (__cpp_lib_endian < 201907L)) && !defined(BOOST_NO_CXX20_HDR_BIT)
# define BOOST_NO_CXX20_HDR_BIT
#endif
#if !__has_include(<latch>)
#if (!__has_include(<latch>) || !defined(__cpp_lib_latch) || (__cpp_lib_latch < 201907L)) && !defined(BOOST_NO_CXX20_HDR_LATCH)
# define BOOST_NO_CXX20_HDR_LATCH
#endif
#if !__has_include(<span>)
#if (!__has_include(<span>) || !defined(__cpp_lib_span) || (__cpp_lib_span < 202002L)) && !defined(BOOST_NO_CXX20_HDR_SPAN)
# define BOOST_NO_CXX20_HDR_SPAN
#endif
#if !__has_include(<compare>)
#if (!__has_include(<compare>) || !defined(__cpp_lib_three_way_comparison) || (__cpp_lib_three_way_comparison < 201907L)) && !defined(BOOST_NO_CXX20_HDR_COMPARE)
# define BOOST_NO_CXX20_HDR_COMPARE
#endif
#if !__has_include(<numbers>)
#if (!__has_include(<numbers>) || !defined(__cpp_lib_math_constants) || (__cpp_lib_math_constants < 201907L)) && !defined(BOOST_NO_CXX20_HDR_NUMBERS)
# define BOOST_NO_CXX20_HDR_NUMBERS
#endif
#if !__has_include(<stop_token>)
#if (!__has_include(<stop_token>) || !defined(__cpp_lib_jthread) || (__cpp_lib_jthread < 201911L)) && !defined(BOOST_NO_CXX20_HDR_STOP_TOKEN)
# define BOOST_NO_CXX20_HDR_STOP_TOKEN
#endif
#if !__has_include(<concepts>)
#if (!__has_include(<concepts>) || !defined(__cpp_lib_concepts) || (__cpp_lib_concepts < 202002L)) && !defined(_YVALS) && !defined(_CPPLIB_VER) && !defined(BOOST_NO_CXX20_HDR_CONCEPTS)
# define BOOST_NO_CXX20_HDR_CONCEPTS
#endif
#if !__has_include(<ranges>)
#if (!__has_include(<ranges>) || !defined(__cpp_lib_ranges) || (__cpp_lib_ranges < 201911L)) && !defined(BOOST_NO_CXX20_HDR_RANGES)
# define BOOST_NO_CXX20_HDR_RANGES
#endif
#if !__has_include(<syncstream>)
#if (!__has_include(<syncstream>) || !defined(__cpp_lib_syncbuf) || (__cpp_lib_syncbuf < 201803L)) && !defined(BOOST_NO_CXX20_HDR_SYNCSTREAM)
# define BOOST_NO_CXX20_HDR_SYNCSTREAM
#endif
#if !__has_include(<coroutine>)
#if (!__has_include(<coroutine>) || !defined(__cpp_lib_coroutine) || (__cpp_lib_coroutine < 201902L)) && !defined(BOOST_NO_CXX20_HDR_COROUTINE)
# define BOOST_NO_CXX20_HDR_COROUTINE
#endif
#if !__has_include(<semaphore>)
#if (!__has_include(<semaphore>) || !defined(__cpp_lib_semaphore) || (__cpp_lib_semaphore < 201907L)) && !defined(BOOST_NO_CXX20_HDR_SEMAPHORE)
# define BOOST_NO_CXX20_HDR_SEMAPHORE
#endif
#endif
#endif
#ifdef __has_include
#if !__has_include(<version>)
@@ -1211,13 +1215,6 @@ namespace std{ using ::type_info; }
//
#include <boost/config/detail/cxx_composite.hpp>
//
// Define the std level that the compiler claims to support:
//
#ifndef BOOST_CXX_VERSION
# define BOOST_CXX_VERSION __cplusplus
#endif
//
// Finish off with checks for macros that are depricated / no longer supported,
// if any of these are set then it's very likely that much of Boost will no

View File

@@ -194,35 +194,10 @@
# define BOOST_NO_CXX17_STD_INVOKE
#endif
// C++20 features
// C++20 features which aren't configured in suffix.hpp correctly:
#if !defined(_MSVC_STL_UPDATE) || (_MSVC_STL_UPDATE < 202008L) || !defined(_HAS_CXX20) || (_HAS_CXX20 == 0)
# define BOOST_NO_CXX20_HDR_BARRIER
# define BOOST_NO_CXX20_HDR_BIT
# define BOOST_NO_CXX20_HDR_LATCH
# define BOOST_NO_CXX20_HDR_SPAN
# define BOOST_NO_CXX20_HDR_COMPARE
# define BOOST_NO_CXX20_HDR_NUMBERS
# define BOOST_NO_CXX20_HDR_CONCEPTS
# define BOOST_NO_CXX20_HDR_COROUTINE
# define BOOST_NO_CXX20_HDR_SEMAPHORE
#endif
#if !defined(_MSVC_STL_UPDATE) || (_MSVC_STL_UPDATE < 202011L) || !defined(_HAS_CXX20) || (_HAS_CXX20 == 0)
# define BOOST_NO_CXX20_HDR_STOP_TOKEN
#endif
// C++20 features not yet implemented:
# define BOOST_NO_CXX20_HDR_FORMAT
#if !defined(_MSVC_STL_UPDATE) || (_MSVC_STL_UPDATE < 202108L) || !defined(_HAS_CXX20) || (_HAS_CXX20 == 0)
# define BOOST_NO_CXX20_HDR_SOURCE_LOCATION
# define BOOST_NO_CXX20_HDR_SYNCSTREAM
#endif
#if !defined(BOOST_NO_CXX20_HDR_COROUTINE) && !defined(__cpp_lib_coroutine)
# define BOOST_NO_CXX20_HDR_COROUTINE
#endif
#if !defined(BOOST_NO_CXX20_HDR_SOURCE_LOCATION) && !defined(__cpp_consteval)
# define BOOST_NO_CXX20_HDR_SOURCE_LOCATION
#endif
// Incomplete:
# define BOOST_NO_CXX20_HDR_RANGES
#if !(!defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(BOOST_MSVC) || (BOOST_MSVC < 1912) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0))
// Deprecated std::iterator:

View File

@@ -115,53 +115,7 @@
#define BOOST_NO_CXX17_STD_INVOKE
#endif
#if !defined(__cpp_lib_bit_cast) || (__cpp_lib_bit_cast < 201806L) || !defined(__cpp_lib_bitops) || (__cpp_lib_bitops < 201907L) || !defined(__cpp_lib_endian) || (__cpp_lib_endian < 201907L)
# define BOOST_NO_CXX20_HDR_BIT
#endif
#if !defined(__cpp_lib_three_way_comparison) || (__cpp_lib_three_way_comparison < 201907L)
# define BOOST_NO_CXX20_HDR_COMPARE
#endif
#if !defined(__cpp_lib_ranges) || (__cpp_lib_ranges < 201911L)
# define BOOST_NO_CXX20_HDR_RANGES
#endif
#if !defined(__cpp_lib_barrier) || (__cpp_lib_barrier < 201907L)
# define BOOST_NO_CXX20_HDR_BARRIER
#endif
#if !defined(__cpp_lib_format) || (__cpp_lib_format < 201907L)
# define BOOST_NO_CXX20_HDR_FORMAT
#endif
#if !defined(__cpp_lib_source_location) || (__cpp_lib_source_location < 201907L)
# define BOOST_NO_CXX20_HDR_SOURCE_LOCATION
#endif
#if !defined(__cpp_lib_latch) || (__cpp_lib_latch < 201907L)
# define BOOST_NO_CXX20_HDR_LATCH
#endif
#if !defined(__cpp_lib_span) || (__cpp_lib_span < 202002L)
# define BOOST_NO_CXX20_HDR_SPAN
#endif
#if !defined(__cpp_lib_math_constants) || (__cpp_lib_math_constants < 201907L)
# define BOOST_NO_CXX20_HDR_NUMBERS
#endif
#if !defined(__cpp_lib_jthread) || (__cpp_lib_jthread < 201911L)
# define BOOST_NO_CXX20_HDR_STOP_TOKEN
#endif
#if !defined(__cpp_lib_concepts) || (__cpp_lib_concepts < 202002L)
# define BOOST_NO_CXX20_HDR_STOP_CONCEPTS
#endif
#if !defined(__cpp_lib_syncbuf) || (__cpp_lib_syncbuf < 201803L)
# define BOOST_NO_CXX20_HDR_SYNCSTREAM
#endif
#if !defined(__cpp_lib_coroutine) || (__cpp_lib_coroutine < 201902L)
# define BOOST_NO_CXX20_HDR_COROUTINE
#endif
#if !defined(__cpp_lib_semaphore) || (__cpp_lib_semaphore < 201907L)
# define BOOST_NO_CXX20_HDR_SEMAPHORE
#endif
#if !defined(__cpp_lib_concepts) || (__cpp_lib_concepts < 202002L)
# define BOOST_NO_CXX20_HDR_CONCEPTS
#endif
#if(_LIBCPP_VERSION < 9000) && !defined(BOOST_NO_CXX20_HDR_SPAN)
#if(_LIBCPP_VERSION < 9000)
// as_writable_bytes is missing.
# define BOOST_NO_CXX20_HDR_SPAN
#endif