Blame 0001-Adapt-to-libstdc-Implement-LWG-1203-for-rvalue-iostr.patch

71a4281
From 4f85b6ec5964e2d9747f6743f9adc6ef1f951e4a Mon Sep 17 00:00:00 2001
71a4281
From: Stephan Bergmann <sbergman@redhat.com>
71a4281
Date: Wed, 5 May 2021 08:20:18 +0200
71a4281
Subject: [PATCH] Adapt to "libstdc++: Implement LWG 1203 for rvalue iostreams"
71a4281
71a4281
<https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=aa475c4ac80733f85ba47b109fc1900f05e810e2>
71a4281
towards GCC 12, so that now "the return type is the original rvalue stream type
71a4281
not its base class."  (And which would thus have caused issues like
71a4281
71a4281
> sfx2/source/control/bindings.cxx:1323:19: error: dynamic_cast from rvalue to reference type '::std::ostringstream &' (aka 'basic_ostringstream<char> &')
71a4281
>                 ? SAL_STREAM("File: " << pFile << " Line: " << nLine) : ""));
71a4281
>                 ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71a4281
> include/sal/log.hxx:198:6: note: expanded from macro 'SAL_STREAM'
71a4281
>     (dynamic_cast< ::std::ostringstream & >(::std::ostringstream() << stream).str())
71a4281
>      ^
71a4281
> include/sal/log.hxx:341:20: note: expanded from macro 'SAL_INFO'
71a4281
>         SAL_WHERE, stream)
71a4281
>         ~~~~~~~~~~~^~~~~~~
71a4281
> include/sal/log.hxx:155:68: note: expanded from macro 'SAL_DETAIL_LOG_STREAM'
71a4281
>                 SAL_DETAIL_LOG_STREAM_PRIVATE_(level, area, where, stream); \
71a4281
>                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
71a4281
> include/sal/log.hxx:133:45: note: expanded from macro 'SAL_DETAIL_LOG_STREAM_PRIVATE_'
71a4281
>             ::sal::detail::StreamStart() << stream) == 1) \
71a4281
>                                             ^~~~~~
71a4281
71a4281
now.  While the issue with old libstdc++ that originally prompted the
71a4281
dynamic_cast was
71a4281
71a4281
> sfx2/source/control/bindings.cxx:1323:19: error: no member named 'str' in 'std::basic_ostream<char>'
71a4281
>                 ? SAL_STREAM("File: " << pFile << " Line: " << nLine) : ""));
71a4281
>                 ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71a4281
> include/sal/log.hxx:194:40: note: expanded from macro 'SAL_STREAM'
71a4281
>     (::std::ostringstream() << stream).str()
71a4281
>                                        ^
71a4281
> include/sal/log.hxx:336:20: note: expanded from macro 'SAL_INFO'
71a4281
>         SAL_WHERE, stream)
71a4281
>         ~~~~~~~~~~~^~~~~~~
71a4281
> include/sal/log.hxx:155:68: note: expanded from macro 'SAL_DETAIL_LOG_STREAM'
71a4281
>                 SAL_DETAIL_LOG_STREAM_PRIVATE_(level, area, where, stream); \
71a4281
>                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
71a4281
> include/sal/log.hxx:133:45: note: expanded from macro 'SAL_DETAIL_LOG_STREAM_PRIVATE_'
71a4281
>             ::sal::detail::StreamStart() << stream) == 1) \
71a4281
>                                             ^~~~~~
71a4281
71a4281
.)
71a4281
71a4281
The libstdc++ macro _GLIBCXX_RELEASE is reportedly available since GCC 7.1.
71a4281
71a4281
Change-Id: I1ee6eabb66355c1f28b9d305cbd85bac50d6b0e1
71a4281
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115121
71a4281
Tested-by: Jenkins
71a4281
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
71a4281
71a4281
(cherry picked from commit 1f3dddd6f21d91c429190ae314dadeec409f35f4, plus
71a4281
follow-up 95e26d3dce4f5a3b2d010d5ca47b4e450905a100 "tdf#142326: Adapt to
71a4281
'libstdc++: Implement LWG 1203 for rvalue iostreams'")
71a4281
Change-Id: I7c8fef25e15fcfa9b83924467dc86dc2957fbd7d
71a4281
---
71a4281
 include/sal/log.hxx | 5 ++++-
71a4281
 1 file changed, 4 insertions(+), 1 deletion(-)
71a4281
71a4281
diff --git a/include/sal/log.hxx b/include/sal/log.hxx
71a4281
index 6bb0d1b43d3d..a0fa902dbce6 100644
71a4281
--- a/include/sal/log.hxx
71a4281
+++ b/include/sal/log.hxx
71a4281
@@ -186,7 +186,10 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) {
71a4281
 
71a4281
     @since LibreOffice 3.5
71a4281
 */
71a4281
-#if defined _LIBCPP_VERSION || (defined _MSC_VER && _MSC_VER >= 1915)
71a4281
+#if defined _LIBCPP_VERSION \
71a4281
+    || (defined _GLIBCXX_RELEASE \
71a4281
+        && (_GLIBCXX_RELEASE >= 12 || (_GLIBCXX_RELEASE == 11 && __GLIBCXX__ > 20210428))) \
71a4281
+    || (defined _MSC_VER && _MSC_VER >= 1915)
71a4281
 #define SAL_STREAM(stream) \
71a4281
     (::std::ostringstream() << stream).str()
71a4281
 #else
71a4281
-- 
71a4281
2.31.1
71a4281