summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-12-20 12:09:45 -0800
committerGitHub <noreply@github.com>2024-12-20 12:09:45 -0800
commitac7cae5ba45f2995b045927ed1d7c03f1fded227 (patch)
treeb10d51649c8e9f9f2740c86323d922955e53fe5c
parent793e07369902026b727c5c4bc16a72ad3e4950e4 (diff)
downloadbinaryen-ac7cae5ba45f2995b045927ed1d7c03f1fded227.tar.gz
binaryen-ac7cae5ba45f2995b045927ed1d7c03f1fded227.tar.bz2
binaryen-ac7cae5ba45f2995b045927ed1d7c03f1fded227.zip
[NFC] Fix spurious uninitialized variable warning (#7174)
The coverage CI builder was failing because of a spurious error about a variable being possibly used uninitialized. Fix the warning by initializing the variable to 0.
-rw-r--r--src/support/string.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/support/string.cpp b/src/support/string.cpp
index 7dc9ba89c..96056d90a 100644
--- a/src/support/string.cpp
+++ b/src/support/string.cpp
@@ -152,7 +152,8 @@ std::optional<uint32_t> takeWTF8CodePoint(std::string_view& str) {
uint8_t leading = str[0];
size_t trailingBytes;
- uint32_t u;
+ // Initialized only to avoid spurious compiler warnings.
+ uint32_t u = 0;
if ((leading & 0b10000000) == 0b00000000) {
// 0xxxxxxx
trailingBytes = 0;