Respect QT_NO_INT128 in qtypes.cpp's #error

We currently don't support building Qt with GCC and -ansi (or
-std=c++NN as opposed to -std=gnu++NN), because in that mode, the
language still recognizes __int128_t, but the C++ standard library
does not, leading to bloopers such as std::is_integral_v<__int128_t>
== false or std::is_signed_v<__int128_t> == false, or simply
std::numerical_limits<__int128_t> not being properly specialized.

But we do have QT_NO_INT128, which, when defined, disabled all the Qt
extended integer support.

A user requested to allow compiling with -ansi again, to which I
responded that they should define QT_NO_INT128 then, too, but of
course, the sanity-check in qtypes.cpp ignored QT_NO_INT128 and would
fire nonetheless, so this patch fixes that.

[ChangeLog][QtCore] Made it possible to compile Qt with GCC in strict
C++ mode (-ansi or -std=c++NN) again, provided QT_NO_INT128 is
defined, too.

Amends 30e04340da.

Pick-to: 6.10 6.9 6.8
Task-number: QTBUG-139280
Change-Id: I3e05d1f5e11b6a0a6a49fad53846f2b9cf0663a7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2025-09-08 11:53:20 +02:00
parent a3572dd5e8
commit e6ddf72279
1 changed files with 2 additions and 2 deletions

View File

@ -503,10 +503,10 @@ 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 QT_COMPILER_SUPPORTS_INT128
#if defined(QT_COMPILER_SUPPORTS_INT128) && !defined(QT_NO_INT128)
# ifndef QT_SUPPORTS_INT128
# error Qt needs to be compiled in a mode that enables INT128 \
if the compiler supports it in principle.
if the compiler supports it in principle and QT_NO_INT128 is not defined.
# endif
#endif