office-gobmx/external/libnumbertext/deprecated.patch.0
Stephan Bergmann ad6ba4a3a6 external/libnumbertext: Silence -Werror,-Wdeprecated-declarations
...when building against LLVM 18 trunk libc++,

> In file included from Numbertext.cxx:6:
> ~/llvm/inst/bin/../include/c++/v1/locale:3772:1: error: 'wstring_convert<std::codecvt_utf8<wchar_t>>' is deprecated [-Werror,-Wdeprecated-declarations]
>  3772 | wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
>       | ^
> ~/llvm/inst/bin/../include/c++/v1/locale:3649:17: note: in instantiation of member function 'std::wstring_convert<std::codecvt_utf8<wchar_t>>::to_bytes' requested here
>  3649 |         {return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());}
>       |                 ^
> Numbertext.cxx:164:22: note: in instantiation of member function 'std::wstring_convert<std::codecvt_utf8<wchar_t>>::to_bytes' requested here
>   164 |     return converter.to_bytes( s );
>       |                      ^
> ~/llvm/inst/bin/../include/c++/v1/locale:3591:28: note: 'wstring_convert<std::codecvt_utf8<wchar_t>>' has been explicitly marked deprecated here
>  3591 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wstring_convert
>       |                            ^
> ~/llvm/inst/bin/../include/c++/v1/__config:942:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
>   942 | #    define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
>       |                                         ^
> ~/llvm/inst/bin/../include/c++/v1/__config:915:49: note: expanded from macro '_LIBCPP_DEPRECATED'
>   915 | #      define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
>       |                                                 ^

(The warning is apparently only emitted late during compilation when
instantiating template code, so extending the existing `#pragma GCC diagnostic
push/pop` area did not work, and the `#pragma GCC diagnostic ignored` rather had
to be enabled all through to the end of the TU.)

Change-Id: Iffc1c468426407e3252724d18f358b9923f7f733
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160437
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-08 07:31:54 +01:00

43 lines
1.4 KiB
Text

--- src/Numbertext.cxx
+++ src/Numbertext.cxx
@@ -41,7 +41,14 @@
std::wifstream wif(filename);
if (wif.fail())
return false;
+#if defined __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
wif.imbue(std::locale(std::locale(), new std::codecvt_utf8<wchar_t>));
+#if defined __GNUC__
+#pragma GCC diagnostic pop
+#endif
std::wstringstream wss;
wss << wif.rdbuf();
result = wss.str();
@@ -122,8 +129,15 @@
MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, wstr.get(), nSize);
return wstr.get();
#elif !defined NUMBERTEXT_BOOST
+#if defined __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
typedef std::codecvt_utf8<wchar_t> convert_type;
std::wstring_convert<convert_type, wchar_t> converter;
+#if defined __GNUC__
+#pragma GCC diagnostic pop
+#endif
return converter.from_bytes( s );
#else
return ::locale::conv::utf_to_utf<wchar_t>(s.c_str(), s.c_str() + s.size());
@@ -138,6 +152,9 @@
WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, str.get(), nSize, nullptr, nullptr);
return str.get();
#elif !defined NUMBERTEXT_BOOST
+#if defined __GNUC__
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
typedef std::codecvt_utf8<wchar_t> convert_type;
std::wstring_convert<convert_type, wchar_t> converter;
return converter.to_bytes( s );