Cleanup more -Wunused-but-set-variable warnings
Clang extended Wunused-but-set-variable warning for pre/post unary
operators since https://github.com/llvm/llvm-project/commit/460fc440ad8d.
This patch cleans up chromium's copy in source/i18n/unesctrn.cpp
until the issue is resolved in the upstream:
https://unicode-org.atlassian.net/browse/ICU-21966
https://github.com/unicode-org/icu/pull/2055
Change-Id: Ibac53aa7b2446ce91343849526d2883581ae7542
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/deps/icu/+/3558218
Reviewed-by: Frank Tang <ftang@chromium.org>
diff --git a/patches/unused-var-unary-operators.patch b/patches/unused-var-unary-operators.patch
index 26ec7f4..20fcc8d 100644
--- a/patches/unused-var-unary-operators.patch
+++ b/patches/unused-var-unary-operators.patch
@@ -60,3 +60,23 @@
pos = aliasesOrRules.indexOf(noIDBlock, pos + 1);
}
+diff --git a/source/i18n/unesctrn.cpp b/source/i18n/unesctrn.cpp
+index 0636fe1d..6b09334f 100644
+--- a/source/i18n/unesctrn.cpp
++++ b/source/i18n/unesctrn.cpp
+@@ -175,13 +175,13 @@ void UnescapeTransliterator::handleTransliterate(Replaceable& text, UTransPositi
+ UBool isIncremental) const {
+ int32_t start = pos.start;
+ int32_t limit = pos.limit;
+- int32_t i, j, ipat;
++ int32_t i, ipat;
+
+ while (start < limit) {
+ // Loop over the forms in spec[]. Exit this loop when we
+ // match one of the specs. Exit the outer loop if a
+ // partial match is detected and isIncremental is true.
+- for (j=0, ipat=0; spec[ipat] != END; ++j) {
++ for (ipat = 0; spec[ipat] != END;) {
+
+ // Read the header
+ int32_t prefixLen = spec[ipat++];
diff --git a/source/i18n/unesctrn.cpp b/source/i18n/unesctrn.cpp
index 0636fe1..6b09334 100644
--- a/source/i18n/unesctrn.cpp
+++ b/source/i18n/unesctrn.cpp
@@ -175,13 +175,13 @@
UBool isIncremental) const {
int32_t start = pos.start;
int32_t limit = pos.limit;
- int32_t i, j, ipat;
+ int32_t i, ipat;
while (start < limit) {
// Loop over the forms in spec[]. Exit this loop when we
// match one of the specs. Exit the outer loop if a
// partial match is detected and isIncremental is true.
- for (j=0, ipat=0; spec[ipat] != END; ++j) {
+ for (ipat = 0; spec[ipat] != END;) {
// Read the header
int32_t prefixLen = spec[ipat++];