Port qcompare.h to qstdlibdetection.h's Q_STL_ macros
... and add more specific #errors. There are two distinct error cases here: - First, someone could add more Q_STL_ macros to qstdlibdetection.h, so like a switch with -Wswitch, list them all here and #error out if there's a Q_STL_ we haven't yet seen. The audience here is Qt developers, via the CI. - Second, one of the "non-major" libraries (ie. not libc++, libstdc++ or MS-STL) add support for C++20, specifically the std::ordering types as announced by __cpp_lib_three_way_comparison, in which case we need to retroactively add the correct unordered value here. The audience here is both Qt developers, via CI, but also Qt users. So separate the two error conditions. Also, for platforms where we don't know the numeric value of std::partial_ordering::unordered, use Qt's legacy value, for potentially faster conversions to/from QPartialOrdering. There's no point in guessing which value _might_ be used by a future STL, and swapping STLs is _always_ BiC, so we don't need to guess which STL will follow the Dinkumware ones on QNX and VxWorks. Amends 0231f33ad121a85368bb3f43273973b9632735dc. Change-Id: I1d06a18ca5bb26aceb7c76a0f035ecd8d4673547 Reviewed-by: Michał Łoś <michal.los@siili.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 1a74f77f57fff52e0166dd895a8c6d9e09b388a4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
65e9eca63b
commit
51bbe63d05
@ -11,6 +11,7 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qcompare_impl.h>
|
||||
#include <QtCore/qstdlibdetection.h>
|
||||
|
||||
#ifdef __cpp_lib_bit_cast
|
||||
#include <bit>
|
||||
@ -37,21 +38,23 @@ enum class Ordering : CompareUnderlyingType
|
||||
enum class Uncomparable : CompareUnderlyingType
|
||||
{
|
||||
Unordered =
|
||||
#if defined(_LIBCPP_VERSION) // libc++
|
||||
#if defined(Q_STL_LIBCPP)
|
||||
-127
|
||||
#elif defined(__GLIBCXX__) // libstdc++
|
||||
#elif defined(Q_STL_LIBSTDCPP)
|
||||
2
|
||||
#elif defined(_MSVC_STL_VERSION) // MS-STL
|
||||
#elif defined(Q_STL_MSSTL)
|
||||
-128
|
||||
#elif defined(Q_CC_GHS) // INTEGRITY does not have a C++20 stdlib,
|
||||
// but is going to use libc++ in the future,
|
||||
// so stay compatible for now.
|
||||
-127
|
||||
#elif defined(Q_OS_VXWORKS) // VxWorks does not have a C++20 stdlib,
|
||||
// so we wont't promise BC there.
|
||||
2
|
||||
#elif defined(Q_STL_DINKUMWARE) || \
|
||||
defined(Q_STL_ROGUEWAVE) || \
|
||||
defined(Q_STL_STLPORT) || \
|
||||
defined(Q_STL_SGI)
|
||||
QtPrivate::LegacyUncomparableValue
|
||||
// We haven't seen C++20 of these libraries, so we don't promise BC there.
|
||||
# ifdef __cpp_lib_three_way_comparison
|
||||
# error Please report the numeric value of std::partial_ordering::unordered in your STL in a bug report.
|
||||
# endif
|
||||
#else
|
||||
# error "Unsupported C++ Standard Library implementation. Please submit a bug report."
|
||||
# error Please handle any newly-added Q_STL_ checks in the above ifdef-ery.
|
||||
#endif
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user