QStringConverter: fix -Wc++20-compat
GCC 13 warns: qstringconverter_p.h:29:6: warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat] 29 | enum char8_t : uchar {}; Fix by calling the replacement qchar8_t (and making it a typedef to char8_t when the latter is available). Pick-to: 6.4 6.3 6.2 Change-Id: If59a9d55667bf1f5245e3a34189687995b000daa Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
32c0d32a4f
commit
42fbd063e2
@ -250,7 +250,7 @@ static inline const uchar *simdFindNonAscii(const uchar *src, const uchar *end,
|
||||
|
||||
// Compare only the US-ASCII beginning of [src8, end8) and [src16, end16)
|
||||
// and advance src8 and src16 to the first character that could not be compared
|
||||
static void simdCompareAscii(const char8_t *&src8, const char8_t *end8, const char16_t *&src16, const char16_t *end16)
|
||||
static void simdCompareAscii(const qchar8_t *&src8, const qchar8_t *end8, const char16_t *&src16, const char16_t *end16)
|
||||
{
|
||||
int bitSpacing = 1;
|
||||
qptrdiff len = qMin(end8 - src8, end16 - src16);
|
||||
@ -436,7 +436,7 @@ static inline const uchar *simdFindNonAscii(const uchar *src, const uchar *end,
|
||||
return src;
|
||||
}
|
||||
|
||||
static void simdCompareAscii(const char8_t *&, const char8_t *, const char16_t *&, const char16_t *)
|
||||
static void simdCompareAscii(const qchar8_t *&, const qchar8_t *, const char16_t *&, const char16_t *)
|
||||
{
|
||||
}
|
||||
#else
|
||||
@ -456,7 +456,7 @@ static inline const uchar *simdFindNonAscii(const uchar *src, const uchar *end,
|
||||
return src;
|
||||
}
|
||||
|
||||
static void simdCompareAscii(const char8_t *&, const char8_t *, const char16_t *&, const char16_t *)
|
||||
static void simdCompareAscii(const qchar8_t *&, const qchar8_t *, const char16_t *&, const char16_t *)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
@ -807,7 +807,7 @@ QUtf8::ValidUtf8Result QUtf8::isValidUtf8(QByteArrayView in)
|
||||
|
||||
int QUtf8::compareUtf8(QByteArrayView utf8, QStringView utf16) noexcept
|
||||
{
|
||||
auto src1 = reinterpret_cast<const char8_t *>(utf8.data());
|
||||
auto src1 = reinterpret_cast<const qchar8_t *>(utf8.data());
|
||||
auto end1 = src1 + utf8.size();
|
||||
auto src2 = reinterpret_cast<const char16_t *>(utf16.data());
|
||||
auto end2 = src2 + utf16.size();
|
||||
|
@ -24,7 +24,9 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef __cpp_char8_t
|
||||
enum char8_t : uchar {};
|
||||
enum qchar8_t : uchar {};
|
||||
#else
|
||||
using qchar8_t = char8_t;
|
||||
#endif
|
||||
|
||||
struct QUtf8BaseTraits
|
||||
@ -38,25 +40,25 @@ struct QUtf8BaseTraits
|
||||
static void appendByte(uchar *&ptr, uchar b)
|
||||
{ *ptr++ = b; }
|
||||
|
||||
static void appendByte(char8_t *&ptr, char8_t b)
|
||||
static void appendByte(qchar8_t *&ptr, qchar8_t b)
|
||||
{ *ptr++ = b; }
|
||||
|
||||
static uchar peekByte(const uchar *ptr, qsizetype n = 0)
|
||||
{ return ptr[n]; }
|
||||
|
||||
static uchar peekByte(const char8_t *ptr, qsizetype n = 0)
|
||||
static uchar peekByte(const qchar8_t *ptr, qsizetype n = 0)
|
||||
{ return ptr[n]; }
|
||||
|
||||
static qptrdiff availableBytes(const uchar *ptr, const uchar *end)
|
||||
{ return end - ptr; }
|
||||
|
||||
static qptrdiff availableBytes(const char8_t *ptr, const char8_t *end)
|
||||
static qptrdiff availableBytes(const qchar8_t *ptr, const qchar8_t *end)
|
||||
{ return end - ptr; }
|
||||
|
||||
static void advanceByte(const uchar *&ptr, qsizetype n = 1)
|
||||
{ ptr += n; }
|
||||
|
||||
static void advanceByte(const char8_t *&ptr, qsizetype n = 1)
|
||||
static void advanceByte(const qchar8_t *&ptr, qsizetype n = 1)
|
||||
{ ptr += n; }
|
||||
|
||||
static void appendUtf16(char16_t *&ptr, char16_t uc)
|
||||
|
Loading…
Reference in New Issue
Block a user