Address a `-Wunused-but-set-variable' warning from Clang 13.x.
Change-Id: Ib7c4efdd9eba4987c080d4e78a5bb42771c399e0
Reviewed-on: https://code-review.googlesource.com/c/re2/+/59630
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/prog.cc b/re2/prog.cc
index 55dc105..a700d35 100644
--- a/re2/prog.cc
+++ b/re2/prog.cc
@@ -611,10 +611,13 @@
inst_count_[ip->opcode()]++;
}
- int total = 0;
+#if !defined(NDEBUG)
+ // Address a `-Wunused-but-set-variable' warning from Clang 13.x.
+ size_t total = 0;
for (int i = 0; i < kNumInst; i++)
total += inst_count_[i];
- DCHECK_EQ(total, static_cast<int>(flat.size()));
+ CHECK_EQ(total, flat.size());
+#endif
// Remap start_unanchored and start.
if (start_unanchored() == 0) {