|
| 1 | +Fix unusable memory_resource on macos |
| 2 | + |
| 3 | +See https://bugreports.qt.io/browse/QTBUG-117484 |
| 4 | +and https://bugreports.qt.io/browse/QTBUG-114316 |
| 5 | + |
| 6 | +--- a/qtbase/src/corelib/tools/qduplicatetracker_p.h |
| 7 | ++++ b/qtbase/src/corelib/tools/qduplicatetracker_p.h |
| 8 | +@@ -52,7 +52,7 @@ |
| 9 | + |
| 10 | + #include <qglobal.h> |
| 11 | + |
| 12 | +-#if QT_HAS_INCLUDE(<memory_resource>) && __cplusplus > 201402L |
| 13 | ++#ifdef __cpp_lib_memory_resource |
| 14 | + # include <unordered_set> |
| 15 | + # include <memory_resource> |
| 16 | + #else |
| 17 | + |
| 18 | +--- a/qtbase/src/corelib/global/qcompilerdetection.h |
| 19 | ++++ b/qtbase/src/corelib/global/qcompilerdetection.h |
| 20 | +@@ -1041,16 +1041,22 @@ |
| 21 | + # endif // !_HAS_CONSTEXPR |
| 22 | + # endif // !__GLIBCXX__ && !_LIBCPP_VERSION |
| 23 | + # endif // Q_OS_QNX |
| 24 | +-# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) && defined(__GNUC_LIBSTD__) \ |
| 25 | +- && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) |
| 26 | ++# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) |
| 27 | ++# if defined(__GNUC_LIBSTD__) && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) |
| 28 | + // Apple has not updated libstdc++ since 2007, which means it does not have |
| 29 | + // <initializer_list> or std::move. Let's disable these features |
| 30 | +-# undef Q_COMPILER_INITIALIZER_LISTS |
| 31 | +-# undef Q_COMPILER_RVALUE_REFS |
| 32 | +-# undef Q_COMPILER_REF_QUALIFIERS |
| 33 | ++# undef Q_COMPILER_INITIALIZER_LISTS |
| 34 | ++# undef Q_COMPILER_RVALUE_REFS |
| 35 | ++# undef Q_COMPILER_REF_QUALIFIERS |
| 36 | + // Also disable <atomic>, since it's clearly not there |
| 37 | +-# undef Q_COMPILER_ATOMICS |
| 38 | +-# endif |
| 39 | ++# undef Q_COMPILER_ATOMICS |
| 40 | ++# endif |
| 41 | ++# if defined(__cpp_lib_memory_resource) \ |
| 42 | ++ && ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 140000) \ |
| 43 | ++ || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 170000)) |
| 44 | ++# undef __cpp_lib_memory_resource // Only supported on macOS 14 and iOS 17 |
| 45 | ++# endif |
| 46 | ++# endif // (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) |
| 47 | + # if defined(Q_CC_CLANG) && defined(Q_CC_INTEL) && Q_CC_INTEL >= 1500 |
| 48 | + // ICC 15.x and 16.0 have their own implementation of std::atomic, which is activated when in Clang mode |
| 49 | + // (probably because libc++'s <atomic> on OS X failed to compile), but they're missing some |
0 commit comments