]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Suppress an attribute suggestion warning [PR116853].
authorIain Sandoe <iain@sandoe.co.uk>
Thu, 26 Sep 2024 10:07:41 +0000 (11:07 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Thu, 26 Sep 2024 11:55:28 +0000 (12:55 +0100)
This warning is triggering during the build and breaking bootstrap on
at least two targets.  The warning appears valid, but the final fix for
it is not yet clear.

In the meantime, to restore bootstrap, the following patch ignores the
warning in the relevant code section.

PR libstdc++/116853

libstdc++-v3/ChangeLog:

* include/bits/basic_string.h: Ignore suggest-attribute=format
warning when using posix vsnprintf in to_string() implementations.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
libstdc++-v3/include/bits/basic_string.h

index 976577f8f22d2b17d81e8ff3f1f20f98289f4318..e9b17ea48b5ab80eb403c27815c2c43fe982911c 100644 (file)
@@ -4399,6 +4399,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
     return __str;
   }
 #elif _GLIBCXX_USE_C99_STDIO
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
   // NB: (v)snprintf vs sprintf.
 
   _GLIBCXX_NODISCARD
@@ -4430,6 +4432,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
     return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
                                           "%Lf", __val);
   }
+#pragma GCC diagnostic pop
 #endif // _GLIBCXX_USE_C99_STDIO
 
 #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_WCHAR