Add explicit error for clang 4 & 5

This commit is contained in:
Krystian Stasiowski
2019-12-16 23:50:57 -05:00
parent 7c8ad32ff9
commit f4fe54bb06
2 changed files with 8 additions and 6 deletions

View File

@ -17,6 +17,9 @@
// Disable exceptions and their associated checks
// #define BOOST_STATIC_STRING_NO_EXCEPTIONS
// Opt-in to the null terminator optimization
// #define BOOST_STATIC_STRING_NULL_OPTIMIZATION
// Can we have deduction guides?
#ifdef __cpp_deduction_guides
#define BOOST_STATIC_STRING_USE_DEDUCT
@ -33,9 +36,6 @@
#define BOOST_STATIC_STRING_NODISCARD
#endif
//#undef _<>_<EFBFBD>cplusplus
//#define _<>_<EFBFBD>cplusplus 201703L
#if __cplusplus > 201703L
#define BOOST_STATIC_STRING_CPP20_CONSTEXPR constexpr
#define BOOST_STATIC_STRING_CPP17_CONSTEXPR constexpr
@ -114,6 +114,10 @@
#endif
#endif
#if (__cplusplus >= 201402L) && (__cplusplus < 201703L) && defined(BOOST_STATIC_STRING_NULL_OPTIMIZATION) && defined(__clang__) && ((__clang_major__ == 4) || (__clang_major__ == 5))
#error The null terminator optimization is not supported for clang 4.x and clang 5.x
#endif
namespace boost {
namespace static_string {

View File

@ -209,15 +209,13 @@ public:
#endif
};
//#define BOOST_STATIC_STRING_NO_NULL_OPTIMIZATION
// Decides which size optimization to use
// If the size is zero, the object will have no members
// Otherwise, if CharT can hold the max size of the string, store the size in the last char
// Otherwise, store the size of the string using a member of the smallest type possible
template<std::size_t N, typename CharT, typename Traits>
using optimization_base =
#ifndef BOOST_STATIC_STRING_NO_NULL_OPTIMIZATION
#ifdef BOOST_STATIC_STRING_USE_NULL_OPTIMIZATION
typename std::conditional<(N <= (std::numeric_limits<CharT>::max)()) && (N != 0),
static_string_base_null<N, CharT, Traits>,
static_string_base_zero<N, CharT, Traits>>::type;