diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2023-05-05 10:45:19 -0700 |
|---|---|---|
| committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-06-11 15:43:00 -0700 |
| commit | 631901f6d1da84ded3528d26f00ea5fa3bfbf6a2 (patch) | |
| tree | 118d00d165caf48c0601d9e638e41b1f9b27e96e /tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp | |
| parent | 60f34fc9e368010a5eaae920e5e306e59abf8e73 (diff) | |
Q{Any,}StringView: remove the GCC-specific compile-time content
Because GCC isn't really working them out at compile time. First, for
both lengthHelperPointer(), they don't get called on string literals
such as
return QStringView(u"Hello");
because the type hasn't decayed to a pointer, but is instead a
char16_t[6]. No one writes
constexpr auto str = u"Hello";
return QStringView(str);
Second, even when you do write that, GCC is emitting the code to search
for the null or non-ASCII byte at runtime, instead of pre-calculating
it. That's not worth it because the code is not vectorized, even at -O3
and with a long string. Instead, let it get the length at runtime with
QtPrivate::qustrlen(), which has vector code.
Drive-by fix the QAnyStringView::lengthPointerHelper() to be constexpr,
avoiding the same GCC warning that was fixed for QStringView in commit
4fd4082c3ab682f14911e6308ec5ccb400de34f9.
Change-Id: Ieab617d69f3b4b54ab30fffd175c505cb66eac02
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Diffstat (limited to 'tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp')
0 files changed, 0 insertions, 0 deletions
