https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116853

            Bug ID: 116853
           Summary: [Regression 15] Bootstrap fails on *-darwin* after
                    r15-3859-g63a598deb0c9
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iains at gcc dot gnu.org
                CC: jason at gcc dot gnu.org, redi at gcc dot gnu.org
  Target Milestone: ---

Three fails of the form:

/scratch/12-mon-rosetta/gcc-master/prev-x86_64-apple-darwin21/libstdc++-v3/include/bits/basic_string.h:4410:43:
error: argument of function call might be a candidate for a format attribute
[-Werror=suggest-attribute=format]
 4410 |     return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
 4411 |                                            "%f", __val);
      |                                            ~~~~~~~~~~~~

(line 4420 and 4430 the same).

This does not appear to be bogus - but in ext/string_conversions.h we have only
a template for this which does not accept the attribute.

I am testing the following work-around - but that might not be the preferred
solution:

diff --git a/libstdc++-v3/include/bits/basic_string.h
b/libstdc++-v3/include/bits/basic_string.h
index 976577f8f22..e9b17ea48b5 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -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

Reply via email to