external/hunspell: Work around missing C++20 std::bit_cast

...as witnessed with <https://ci.libreoffice.org/job/gerrit_android_x86/31690/>
on top of patch set 4 of <https://gerrit.libreoffice.org/c/core/+/155121/4>
"Bump baseline to C++20",

> In file included from /home/tdf/lode/jenkins/workspace/android_x86/lingucomponent/source/spellcheck/spell/sspellimp.cxx:35:
> In file included from /home/tdf/lode/jenkins/workspace/android_x86/workdir/UnpackedTarball/hunspell/src/hunspell/hunspell.hxx:74:
> /home/tdf/lode/jenkins/workspace/android_x86/workdir/UnpackedTarball/hunspell/src/hunspell/w_char.hxx:62:17: error: no member named 'bit_cast' in namespace 'std'
>     return std::bit_cast<unsigned short>(*this);
>            ~~~~~^

Change-Id: Ic4a799a0918ff6bcc4dd414d5ae59e02181074bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155346
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2023-08-04 14:06:06 +02:00
parent e2db54b9bf
commit ed5d949632
2 changed files with 23 additions and 0 deletions

View file

@ -25,6 +25,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,hunspell, \
external/hunspell/0001-fix-LibreOffice-build-problem-with-basic_string-appe.patch \
external/hunspell/0001-Resolves-rhbz-2158548-allow-longer-words-for-hunspel.patch \
external/hunspell/0001-Keep-only-REP-ph-or-2-word-dictionary-phrase-suggest.patch \
external/hunspell/bit_cast.patch.0 \
))
# vim: set noet sw=4 ts=4:

22
external/hunspell/bit_cast.patch.0 vendored Normal file
View file

@ -0,0 +1,22 @@
--- src/hunspell/w_char.hxx
+++ src/hunspell/w_char.hxx
@@ -42,9 +42,8 @@
#if __cplusplus >= 202002L
#include <bit>
-#else
+#endif
#include <cstring>
-#endif
#ifndef GCC
struct w_char {
@@ -58,7 +57,7 @@
{
#if defined(__i386__) || defined(_M_IX86) || defined(_M_X64)
//use little-endian optimized version
-#if __cplusplus >= 202002L
+#if __cplusplus >= 202002L && defined __cpp_lib_bit_cast && __cpp_lib_bit_cast >= 201806L
return std::bit_cast<unsigned short>(*this);
#else
unsigned short u;