]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Avoid -Wmaybe-uninitialized warnings in text_encoding.cc
authorJonathan Wakely <jwakely@redhat.com>
Thu, 18 Jan 2024 12:40:52 +0000 (12:40 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 18 Jan 2024 12:43:32 +0000 (12:43 +0000)
These variables are only read from if we haven't reached the end of
either range, in which case they're guaranteed to be initialized to the
next alphanumeric character. But we can just initialize them to make the
compiler happy.

libstdc++-v3/ChangeLog:

* include/bits/unicode.h (__charset_alias_match): Initialize
__var_a and __var_b.

libstdc++-v3/include/bits/unicode.h

index d025d21f3dd96366ea68cd54d6e5014275f13302..51bf02e927fc9c8b67e344b33da333f877009984 100644 (file)
@@ -1084,7 +1084,7 @@ inline namespace __v15_1_0
     while (true)
       {
        // Find the value of the next alphanumeric character in each string.
-       unsigned char __val_a, __val_b;
+       unsigned char __val_a{}, __val_b{};
        while (__ptr_a != __end_a
                 && (__val_a = __map(*__ptr_a, __num_a)) == 127)
          ++__ptr_a;