From 0102ab6cd3e464ca4267777a754811db01edcd2f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 20 Jul 2022 22:33:23 +0200 Subject: [PATCH] Statically assert that the __mips_dsp code is only active on 32-bit I was told this is 32-bit-only code in Qt 5, where it didn't really matter, because only QStringView could handle > INT_MAX character strings. Put up a big stop sign now in Qt 6 to enforce that this information is correct, incl. notes for when it turns out it isn't. Task-number: QTBUG-59150 Task-number: QTBUG-103531 Change-Id: I4620a43e2e67776cc67531fa993a7bb8e01cffed Reviewed-by: Qt CI Bot Reviewed-by: Sona Kurazyan Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira (cherry picked from commit 753079b7074b06d237a0ae7a58281c28df134fc0) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qstring.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 4ae5eb10603..fc6489bceeb 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -816,6 +816,8 @@ Q_CORE_EXPORT void qt_from_latin1(char16_t *dst, const char *str, size_t size) n # endif #endif #if defined(__mips_dsp) + static_assert(sizeof(qsizetype) == sizeof(int), + "oops, the assembler implementation needs to be called in a loop"); if (size > 20) qt_fromlatin1_mips_asm_unroll8(dst, str, size); else @@ -971,6 +973,8 @@ static void qt_to_latin1_internal(uchar *dst, const char16_t *src, qsizetype len } #endif #if defined(__mips_dsp) + static_assert(sizeof(qsizetype) == sizeof(int), + "oops, the assembler implementation needs to be called in a loop"); qt_toLatin1_mips_dsp_asm(dst, src, length); #else while (length--) {