]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Avoid warning in std::format
authorJonathan Wakely <jwakely@redhat.com>
Tue, 18 Jul 2023 21:14:32 +0000 (22:14 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 19 Jul 2023 11:36:59 +0000 (12:36 +0100)
With -Wmaybe-uninitialized -Wsystem-headers there's a warning about
creating a string_view from an uninitalized array. Initializing the
first element of the array avoids the warning.

libstdc++-v3/ChangeLog:

* include/std/format (__write_padded): Initialize first element
of array to avoid a -Wmaybe-uninitialized warning.

libstdc++-v3/include/std/format

index 9d5981e4882991cc2cbfb9353d399372030e8722..9710bff3c0342e78cf5a6416674488b428080ef6 100644 (file)
@@ -610,6 +610,7 @@ namespace __format
     {
       const size_t __buflen = 0x20;
       _CharT __padding_chars[__buflen];
+      __padding_chars[0] = _CharT();
       basic_string_view<_CharT> __padding{__padding_chars, __buflen};
 
       auto __pad = [&__padding] (size_t __n, _Out& __o) {