Skip to content

Commit ac7cae5

Browse files
authored
[NFC] Fix spurious uninitialized variable warning (WebAssembly#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.
1 parent 793e073 commit ac7cae5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/support/string.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ std::optional<uint32_t> takeWTF8CodePoint(std::string_view& str) {
152152

153153
uint8_t leading = str[0];
154154
size_t trailingBytes;
155-
uint32_t u;
155+
// Initialized only to avoid spurious compiler warnings.
156+
uint32_t u = 0;
156157
if ((leading & 0b10000000) == 0b00000000) {
157158
// 0xxxxxxx
158159
trailingBytes = 0;

0 commit comments

Comments
 (0)