From 0231f33ad121a85368bb3f43273973b9632735dc Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 4 Apr 2024 09:06:42 +0200 Subject: [PATCH] QCompare: improve stdlib compatibility checks Rather than using MS-STL value for Unordered as a "fallback" (not libstdc++, not libc++), check for it. This means that we now know the values for the three major stdlib implementations so we can be BC with them. This leaves us with toolchains (VxWorks, INTEGRITY) that still don't have a C++20 stdlib, so we don't know what value to pick. INTEGRITY will use libc++ for C++20, so just use a matching value. For VxWorks just pick a value. It's unlikely that it'll cause BC concerns, given it uses static linking anyhow. Finally, add an error as a fallback for any other yet unknown stdlib implementation. Change-Id: If65e84b4b644a4495943385ee631cf343db8b654 Reviewed-by: Thiago Macieira --- src/corelib/global/qcompare.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qcompare.h b/src/corelib/global/qcompare.h index 410605455b8..49c0a0ce9d0 100644 --- a/src/corelib/global/qcompare.h +++ b/src/corelib/global/qcompare.h @@ -40,8 +40,17 @@ enum class Uncomparable : CompareUnderlyingType -127 #elif defined(__GLIBCXX__) // libstdc++ 2 - #else // assume MSSTL + #elif defined(_MSVC_STL_VERSION) // MS-STL -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 + #else + # error "Unsupported C++ Standard Library implementation. Please submit a bug report." #endif };