diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-08-17 09:22:57 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-09-12 17:26:23 +0000 |
commit | 123303c9268d2a2c522e919b141ac8bdf618fa2b (patch) | |
tree | 57508cc978004c35bc281346b434bca91eb47992 | |
parent | cd889c2422d2511bde7425f942569f7d431483ae (diff) |
QLibraryInfo: fix GCC ubsan build
Same bug that plagues tst_qbytearrayview.cpp, similar fix: drop the
static checks for GCC. Except that here, following code uses the
variable, so it needs to exist. Fortunately, the GCC ubsan bug does
not affect construction from a string literal, so we can use
that. This is losing the position checking for "." in qtConfEntries,
but the the original author (Thiago) informs me that was just a way to
save two bytes, we don't actually need the assertions, so remove them.
As a drive-by, remove the unneeded, and potentially pessimizing
(forces the compiler to allocate storage for it in the binary), static
keyword from the constexpr variable, which should more than make up
for the extra two octets.
Change-Id: I88397ac61c5cd8f53d39e957212c895239aace04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit de6f4053139377b63cf92f6bca4d96d488682de4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 715bda488c..469e2b4251 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -475,9 +475,7 @@ QLibraryInfoPrivate::LocationInfo QLibraryInfoPrivate::locationInfo(QLibraryInfo "Examples", "examples", "Tests", "tests" ); - static constexpr QByteArrayView dot = qtConfEntries.viewAt(1); - static_assert(dot.size() == 1); - static_assert(dot[0] == '.'); + constexpr QByteArrayView dot{"."}; LocationInfo result; |