Hi!

When building powerpc64le-unknown-linux-gnu libstdc++-v3 with
'--enable-werror', the build currently fails:

    [...]
    In file included from 
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.h:2071,
                     from 
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/locale:45,
                     from 
[...]/libstdc++-v3/src/c++11/compatibility-ldbl-alt128.cc:26:
    
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:
 In instantiation of ‘_OutIter std::__gnu_cxx11_ieee128::money_put<_CharT, 
_OutIter>::__do_put(iter_type, bool, std::ios_base&, char_type, __ibm128) const 
[with _CharT = char; _OutIter = std::ostreambuf_iterator<char, 
std::char_traits<char> >; iter_type = std::ostreambuf_iterator<char, 
std::char_traits<char> >; char_type = char]’:
    [...]/libstdc++-v3/src/c++11/locale-inst-monetary.h:43:18:   required from 
here
       43 |   template class money_put<C, ostreambuf_iterator<C> >;
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:658:66:
 error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has 
type ‘__ibm128’ [-Werror=format=]
      658 |       int __len = __glibcxx_snprintfibm128(__cs, __cs_size, 
"%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  
long double
      659 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:665:66:
 error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has 
type ‘__ibm128’ [-Werror=format=]
      665 |           __len = __glibcxx_snprintfibm128(__cs, __cs_size, 
"%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  
long double
      666 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:
 In instantiation of ‘_OutIter std::__gnu_cxx11_ieee128::money_put<_CharT, 
_OutIter>::__do_put(iter_type, bool, std::ios_base&, char_type, __ibm128) const 
[with _CharT = wchar_t; _OutIter = std::ostreambuf_iterator<wchar_t, 
std::char_traits<wchar_t> >; iter_type = std::ostreambuf_iterator<wchar_t, 
std::char_traits<wchar_t> >; char_type = wchar_t]’:
    [...]/libstdc++-v3/src/c++11/locale-inst-monetary.h:43:18:   required from 
here
       43 |   template class money_put<C, ostreambuf_iterator<C> >;
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:658:66:
 error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has 
type ‘__ibm128’ [-Werror=format=]
      658 |       int __len = __glibcxx_snprintfibm128(__cs, __cs_size, 
"%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  
long double
      659 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:665:66:
 error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has 
type ‘__ibm128’ [-Werror=format=]
      665 |           __len = __glibcxx_snprintfibm128(__cs, __cs_size, 
"%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  
long double
      666 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    In file included from 
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/tr1/functional:42,
                     from 
[...]/libstdc++-v3/src/c++11/compatibility-ldbl-alt128.cc:222:
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/tr1/tuple:426:21: 
error: ‘std::tr1::{anonymous}::ignore’ defined but not used 
[-Werror=unused-variable]
      426 |     _Swallow_assign ignore;
          |                     ^~~~~~
    cc1plus: all warnings being treated as errors
    make[6]: *** [Makefile:1039: compatibility-ldbl-alt128.lo] Error 1
    [...]
    In file included from 
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.h:2071,
                     from 
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/locale:45,
                     from 
[...]/libstdc++-v3/src/c++11/compatibility-ldbl-alt128-cxx11.cc:26:
    
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:
 In instantiation of ‘_OutIter std::__gnu_cxx11_ieee128::money_put<_CharT, 
_OutIter>::__do_put(iter_type, bool, std::ios_base&, char_type, __ibm128) const 
[with _CharT = char; _OutIter = std::ostreambuf_iterator<char, 
std::char_traits<char> >; iter_type = std::ostreambuf_iterator<char, 
std::char_traits<char> >; char_type = char]’:
    [...]/libstdc++-v3/src/c++11/locale-inst-monetary.h:43:18:   required from 
here
       43 |   template class money_put<C, ostreambuf_iterator<C> >;
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:658:66:
 error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has 
type ‘__ibm128’ [-Werror=format=]
      658 |       int __len = __glibcxx_snprintfibm128(__cs, __cs_size, 
"%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  
long double
      659 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:665:66:
 error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has 
type ‘__ibm128’ [-Werror=format=]
      665 |           __len = __glibcxx_snprintfibm128(__cs, __cs_size, 
"%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  
long double
      666 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:
 In instantiation of ‘_OutIter std::__gnu_cxx11_ieee128::money_put<_CharT, 
_OutIter>::__do_put(iter_type, bool, std::ios_base&, char_type, __ibm128) const 
[with _CharT = wchar_t; _OutIter = std::ostreambuf_iterator<wchar_t, 
std::char_traits<wchar_t> >; iter_type = std::ostreambuf_iterator<wchar_t, 
std::char_traits<wchar_t> >; char_type = wchar_t]’:
    [...]/libstdc++-v3/src/c++11/locale-inst-monetary.h:43:18:   required from 
here
       43 |   template class money_put<C, ostreambuf_iterator<C> >;
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:658:66:
 error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has 
type ‘__ibm128’ [-Werror=format=]
      658 |       int __len = __glibcxx_snprintfibm128(__cs, __cs_size, 
"%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  
long double
      659 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    
[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:665:66:
 error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has 
type ‘__ibm128’ [-Werror=format=]
      665 |           __len = __glibcxx_snprintfibm128(__cs, __cs_size, 
"%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  
long double
      666 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    cc1plus: all warnings being treated as errors
    make[6]: *** [Makefile:1043: compatibility-ldbl-alt128-cxx11.lo] Error 1
    make[6]: *** No rule to make target '../src/c++98/libc++98convenience.la', 
needed by 'libstdc++.la'.
    make[6]: *** No rule to make target '../src/c++11/libc++11convenience.la', 
needed by 'libstdc++.la'.
    make[6]: Target 'all-am' not remade because of errors.
    make[6]: Leaving directory 
'[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/src'
    [...]

Is the attached
"WIP Mute '__ibm128' '-Wformat' diagnostics in 
'libstdc++-v3/include/bits/locale_facets_nonio.tcc'"
the right way to address this?  (..., at least for the time being, until
someone steps up to fix this properly -- I suppose?  CCing the
"rs6000/powerpc port" maintainers.)


Grüße
 Thomas


>From 8d6978fa43b7f006a2be957418d9a550b2232ebc Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <[email protected]>
Date: Mon, 30 Sep 2024 22:37:24 +0200
Subject: [PATCH] WIP Mute '__ibm128' '-Wformat' diagnostics in
 'libstdc++-v3/include/bits/locale_facets_nonio.tcc'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When building powerpc64le-unknown-linux-gnu libstdc++-v3 with
'--enable-werror', the build currently fails:

    [...]
    In file included from [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.h:2071,
                     from [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/locale:45,
                     from [...]/libstdc++-v3/src/c++11/compatibility-ldbl-alt128.cc:26:
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc: In instantiation of ‘_OutIter std::__gnu_cxx11_ieee128::money_put<_CharT, _OutIter>::__do_put(iter_type, bool, std::ios_base&, char_type, __ibm128) const [with _CharT = char; _OutIter = std::ostreambuf_iterator<char, std::char_traits<char> >; iter_type = std::ostreambuf_iterator<char, std::char_traits<char> >; char_type = char]’:
    [...]/libstdc++-v3/src/c++11/locale-inst-monetary.h:43:18:   required from here
       43 |   template class money_put<C, ostreambuf_iterator<C> >;
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:658:66: error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has type ‘__ibm128’ [-Werror=format=]
      658 |       int __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  long double
      659 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:665:66: error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has type ‘__ibm128’ [-Werror=format=]
      665 |           __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  long double
      666 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc: In instantiation of ‘_OutIter std::__gnu_cxx11_ieee128::money_put<_CharT, _OutIter>::__do_put(iter_type, bool, std::ios_base&, char_type, __ibm128) const [with _CharT = wchar_t; _OutIter = std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> >; iter_type = std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> >; char_type = wchar_t]’:
    [...]/libstdc++-v3/src/c++11/locale-inst-monetary.h:43:18:   required from here
       43 |   template class money_put<C, ostreambuf_iterator<C> >;
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:658:66: error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has type ‘__ibm128’ [-Werror=format=]
      658 |       int __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  long double
      659 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:665:66: error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has type ‘__ibm128’ [-Werror=format=]
      665 |           __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  long double
      666 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    In file included from [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/tr1/functional:42,
                     from [...]/libstdc++-v3/src/c++11/compatibility-ldbl-alt128.cc:222:
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/tr1/tuple:426:21: error: ‘std::tr1::{anonymous}::ignore’ defined but not used [-Werror=unused-variable]
      426 |     _Swallow_assign ignore;
          |                     ^~~~~~
    cc1plus: all warnings being treated as errors
    make[6]: *** [Makefile:1039: compatibility-ldbl-alt128.lo] Error 1
    [...]
    In file included from [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.h:2071,
                     from [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/locale:45,
                     from [...]/libstdc++-v3/src/c++11/compatibility-ldbl-alt128-cxx11.cc:26:
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc: In instantiation of ‘_OutIter std::__gnu_cxx11_ieee128::money_put<_CharT, _OutIter>::__do_put(iter_type, bool, std::ios_base&, char_type, __ibm128) const [with _CharT = char; _OutIter = std::ostreambuf_iterator<char, std::char_traits<char> >; iter_type = std::ostreambuf_iterator<char, std::char_traits<char> >; char_type = char]’:
    [...]/libstdc++-v3/src/c++11/locale-inst-monetary.h:43:18:   required from here
       43 |   template class money_put<C, ostreambuf_iterator<C> >;
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:658:66: error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has type ‘__ibm128’ [-Werror=format=]
      658 |       int __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  long double
      659 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:665:66: error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has type ‘__ibm128’ [-Werror=format=]
      665 |           __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  long double
      666 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc: In instantiation of ‘_OutIter std::__gnu_cxx11_ieee128::money_put<_CharT, _OutIter>::__do_put(iter_type, bool, std::ios_base&, char_type, __ibm128) const [with _CharT = wchar_t; _OutIter = std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> >; iter_type = std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> >; char_type = wchar_t]’:
    [...]/libstdc++-v3/src/c++11/locale-inst-monetary.h:43:18:   required from here
       43 |   template class money_put<C, ostreambuf_iterator<C> >;
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:658:66: error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has type ‘__ibm128’ [-Werror=format=]
      658 |       int __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  long double
      659 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    [...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/locale_facets_nonio.tcc:665:66: error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has type ‘__ibm128’ [-Werror=format=]
      665 |           __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0,
          |                                                              ~~~~^
          |                                                                  |
          |                                                                  long double
      666 |                                              __units);
          |                                              ~~~~~~~
          |                                              |
          |                                              __ibm128
    cc1plus: all warnings being treated as errors
    make[6]: *** [Makefile:1043: compatibility-ldbl-alt128-cxx11.lo] Error 1
    make[6]: *** No rule to make target '../src/c++98/libc++98convenience.la', needed by 'libstdc++.la'.
    make[6]: *** No rule to make target '../src/c++11/libc++11convenience.la', needed by 'libstdc++.la'.
    make[6]: Target 'all-am' not remade because of errors.
    make[6]: Leaving directory '[...]/powerpc64le-unknown-linux-gnu/libstdc++-v3/src'
    [...]
---
 libstdc++-v3/include/bits/locale_facets_nonio.tcc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.tcc b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
index 5fddc1e3b26..91cd996438c 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
@@ -655,15 +655,21 @@ __typeof__(__builtin_snprintf) __glibcxx_snprintfibm128 __asm__("snprintf");
 
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
       // 328. Bad sprintf format modifier in money_put<>::do_put()
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat" // error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has type ‘__ibm128’ [-Werror=format=]
       int __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0,
 					     __units);
+#pragma GCC diagnostic pop
       // If the buffer was not large enough, try again with the correct size.
       if (__len >= __cs_size)
 	{
 	  __cs_size = __len + 1;
 	  __cs = static_cast<char*>(__builtin_alloca(__cs_size));
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat" // error: format ‘%Lf’ expects argument of type ‘long double’, but argument 5 has type ‘__ibm128’ [-Werror=format=]
 	  __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0,
 					     __units);
+#pragma GCC diagnostic pop
 	}
       __gnu_cxx::__uselocale(__old);
       string_type __digits(__len, char_type());
-- 
2.34.1

Reply via email to