diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2022-04-22 10:15:02 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2022-04-25 15:05:25 +0200 |
commit | b3651868609cc1d4b9316d8ec65a0656b421970e (patch) | |
tree | 20b5ec2ba9e4dc19d7e001678ece7399a47c7792 /src/corelib/text | |
parent | 242633430ba22d8f4d390067d4a68a4f54826af2 (diff) |
Fix unused variables in qtbase
clang compiler recently got smarter and detects "pseudo used variable"
patterns where we declare a variable and only use it in self-increments,
self-decrements and other similar expressions
Errors:
qtbase/src/corelib/text/qlocale.cpp:3898:9: error: variable 'group_cnt' set but not used [-Werror,-Wunused-but-set-variable]
int group_cnt = 0; // counts number of group chars
^
qtbase/src/corelib/text/qunicodetools.cpp:1372:21: error: variable 'uc' set but not used [-Werror,-Wunused-but-set-variable]
const char16_t *uc = text + from;
^
and more of the kind
Remove the ones that have no usage, mark others with [[maybe_unused]]
Pick-to: 6.3 6.2
Change-Id: Ib2d0722110e3da8c39e29ec78c0ec290d064c970
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text')
-rw-r--r-- | src/corelib/text/qlocale.cpp | 2 | ||||
-rw-r--r-- | src/corelib/text/qunicodetools.cpp | 8 |
2 files changed, 0 insertions, 10 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index bdd896b4c8..8a272c6e49 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -3904,7 +3904,6 @@ bool QLocaleData::numberToCLocale(QStringView s, QLocale::NumberOptions number_o decltype(length) idx = 0; int digitsInGroup = 0; - int group_cnt = 0; // counts number of group chars int decpt_idx = -1; int last_separator_idx = -1; int start_of_digits_idx = -1; @@ -3974,7 +3973,6 @@ bool QLocaleData::numberToCLocale(QStringView s, QLocale::NumberOptions number_o } last_separator_idx = idx; - ++group_cnt; digitsInGroup = 0; // don't add the group separator diff --git a/src/corelib/text/qunicodetools.cpp b/src/corelib/text/qunicodetools.cpp index ff11baa99a..3c96931ea7 100644 --- a/src/corelib/text/qunicodetools.cpp +++ b/src/corelib/text/qunicodetools.cpp @@ -1369,7 +1369,6 @@ static qsizetype indic_nextSyllableBoundary(QChar::Script script, const char16_t static void indicAttributes(QChar::Script script, const char16_t *text, qsizetype from, qsizetype len, QCharAttributes *attributes) { qsizetype end = from + len; - const char16_t *uc = text + from; attributes += from; qsizetype i = 0; while (i < len) { @@ -1381,7 +1380,6 @@ static void indicAttributes(QChar::Script script, const char16_t *text, qsizetyp i++; while (i < boundary) { attributes[i].graphemeBoundary = false; - ++uc; ++i; } assert(i == boundary); @@ -1632,7 +1630,6 @@ finish: static void tibetanAttributes(QChar::Script script, const char16_t *text, qsizetype from, qsizetype len, QCharAttributes *attributes) { qsizetype end = from + len; - const char16_t *uc = text + from; qsizetype i = 0; Q_UNUSED(script); attributes += from; @@ -1646,7 +1643,6 @@ static void tibetanAttributes(QChar::Script script, const char16_t *text, qsizet i++; while (i < boundary) { attributes[i].graphemeBoundary = false; - ++uc; ++i; } assert(i == boundary); @@ -1847,7 +1843,6 @@ static qsizetype myanmar_nextSyllableBoundary(const char16_t *s, qsizetype start static void myanmarAttributes(QChar::Script script, const char16_t *text, qsizetype from, qsizetype len, QCharAttributes *attributes) { qsizetype end = from + len; - const char16_t *uc = text + from; qsizetype i = 0; Q_UNUSED(script); attributes += from; @@ -1863,7 +1858,6 @@ static void myanmarAttributes(QChar::Script script, const char16_t *text, qsizet i++; while (i < boundary) { attributes[i].graphemeBoundary = false; - ++uc; ++i; } assert(i == boundary); @@ -2183,7 +2177,6 @@ static qsizetype khmer_nextSyllableBoundary(const char16_t *s, qsizetype start, static void khmerAttributes(QChar::Script script, const char16_t *text, qsizetype from, qsizetype len, QCharAttributes *attributes) { qsizetype end = from + len; - const char16_t *uc = text + from; qsizetype i = 0; Q_UNUSED(script); attributes += from; @@ -2197,7 +2190,6 @@ static void khmerAttributes(QChar::Script script, const char16_t *text, qsizetyp i++; while ( i < boundary ) { attributes[i].graphemeBoundary = false; - ++uc; ++i; } assert( i == boundary ); |