Introduce QT_COMPILER_SUPPORTS_INT128 in qsystemdetection
c661dbd42d87f151e0c6f9e50fb21a137dad850c injected `QT_NO_INT128` into every TU when compiling for VxWorks. VxWorks uses a custom stdlib implementation that does not support 128bit ints and at the same time they use an off the shelf Clang that defines `__SIZEOF_INT128__` which is used to detect if 128b ints are available. This resulted in Qt falsely assuming that 128b ints are available. Detect if 128bit are available instead of injecting `QT_NO_INT128` and define `QT_COMPILER_SUPPORTS_INT128`, use it instead of directly checking `__SIZEOF_INT128__`. Task-number: QTBUG-115777 Change-Id: I7531ebe780b4bdd78b42daf8dae0e522a316a88e Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 5a10744bb4afc0c95b1b7bbba8848cf14b0bad00) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
bbca3a8e02
commit
d563ec3fba
@ -47,15 +47,6 @@ function(qt_internal_setup_public_platform_target)
|
||||
target_compile_options(Platform INTERFACE "$<$<CXX_COMPILER_ID:Clang>:-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
|
||||
|
@ -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
|
||||
|
@ -503,7 +503,7 @@ static_assert(sizeof(size_t) == sizeof(qsizetype)); // implied by the definition
|
||||
static_assert((std::is_same<qsizetype, qptrdiff>::value));
|
||||
static_assert(std::is_same_v<std::size_t, size_t>);
|
||||
|
||||
#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.
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define QTYPES_H
|
||||
|
||||
#include <QtCore/qprocessordetection.h>
|
||||
#include <QtCore/qsystemdetection.h>
|
||||
#include <QtCore/qtconfigmacros.h>
|
||||
#include <QtCore/qassert.h>
|
||||
|
||||
@ -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 <type_traits> on libstdc++
|
||||
# endif
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <QtCore/qcompare.h>
|
||||
#include <QtCore/qendian.h>
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qsystemdetection.h>
|
||||
|
||||
#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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user