diff --git a/cmake/QtPlatformTargetHelpers.cmake b/cmake/QtPlatformTargetHelpers.cmake index 0b2025666de..90f159c06c6 100644 --- a/cmake/QtPlatformTargetHelpers.cmake +++ b/cmake/QtPlatformTargetHelpers.cmake @@ -47,15 +47,6 @@ function(qt_internal_setup_public_platform_target) target_compile_options(Platform INTERFACE "$<$:-fno-direct-access-external-data>") endif() - # Qt checks if a given platform supports 128 bit integers - # by checking if __SIZEOF_128__ is defined - # VXWORKS doesn't support 128 bit integers - # but it uses clang which defines __SIZEOF_128__ - # which breaks the detection mechanism - if(VXWORKS) - target_compile_definitions(Platform INTERFACE "-DQT_NO_INT128") - endif() - qt_set_msvc_cplusplus_options(Platform INTERFACE) # Propagate minimum C++ 17 via Platform to Qt consumers (apps), after the global features diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index b29f2e94964..0cbcef27407 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -239,4 +239,12 @@ # define Q_OF_MACH_O #endif +#if defined(__SIZEOF_INT128__) +// Compiler used in VxWorks SDK declares __SIZEOF_INT128__ but VxWorks doesn't support this type, +// so we can't rely solely on compiler here. +#if !defined(Q_OS_VXWORKS) +# define QT_COMPILER_SUPPORTS_INT128 __SIZEOF_INT128__ +#endif +#endif // defined(__SIZEOF_INT128__) + #endif // QSYSTEMDETECTION_H diff --git a/src/corelib/global/qtypes.cpp b/src/corelib/global/qtypes.cpp index 9a4616b9d89..bd01498ce2d 100644 --- a/src/corelib/global/qtypes.cpp +++ b/src/corelib/global/qtypes.cpp @@ -503,7 +503,7 @@ static_assert(sizeof(size_t) == sizeof(qsizetype)); // implied by the definition static_assert((std::is_same::value)); static_assert(std::is_same_v); -#ifdef __SIZEOF_INT128__ +#ifdef QT_COMPILER_SUPPORTS_INT128 # ifndef QT_SUPPORTS_INT128 # error Qt needs to be compiled in a mode that enables INT128 \ if the compiler supports it in principle. diff --git a/src/corelib/global/qtypes.h b/src/corelib/global/qtypes.h index d5dffe60477..65bf01fac14 100644 --- a/src/corelib/global/qtypes.h +++ b/src/corelib/global/qtypes.h @@ -6,6 +6,7 @@ #define QTYPES_H #include +#include #include #include @@ -66,8 +67,8 @@ typedef quint64 qulonglong; #ifdef Q_QDOC // QDoc always needs to see the typedefs # define QT_SUPPORTS_INT128 16 -#elif defined(__SIZEOF_INT128__) && !defined(QT_NO_INT128) -# define QT_SUPPORTS_INT128 __SIZEOF_INT128__ +#elif defined(QT_COMPILER_SUPPORTS_INT128) && !defined(QT_NO_INT128) +# define QT_SUPPORTS_INT128 QT_COMPILER_SUPPORTS_INT128 # if defined(__GLIBCXX__) && defined(__STRICT_ANSI__) // -ansi/-std=c++NN instead of gnu++NN # undef QT_SUPPORTS_INT128 // breaks on libstdc++ # endif diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index 49f2b6749cd..435b7bb572d 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -7,6 +7,7 @@ #include #include #include +#include #if defined(Q_OS_WIN) || defined(Q_QDOC) #ifndef GUID_DEFINED @@ -61,7 +62,7 @@ public: quint16 data16[8]; quint32 data32[4]; quint64 data64[2]; -#if defined(__SIZEOF_INT128__) +#if defined(QT_COMPILER_SUPPORTS_INT128) QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wpedantic") // ISO C++ does not support ‘__int128’ for ‘data128’ unsigned __int128 data128[1];