From 3b039c1c02b10278c309e92a87afd8dd377bbd3b Mon Sep 17 00:00:00 2001 From: Bill Sommerfeld Date: Fri, 9 May 2025 15:17:08 -0700 Subject: [PATCH 1000/1002] Avoid undefined symbols when using the dragonfly locale backend From Jonathan Perkin's patch in pkgsrc-extra --- .../config/locale/dragonfly/ctype_members.cc | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/libstdc++-v3/config/locale/dragonfly/ctype_members.cc b/libstdc++-v3/config/locale/dragonfly/ctype_members.cc index 92b0e437ad3..8e20f74e635 100644 --- a/libstdc++-v3/config/locale/dragonfly/ctype_members.cc +++ b/libstdc++-v3/config/locale/dragonfly/ctype_members.cc @@ -135,6 +135,66 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __hi; } +/* + * Taken verbatim from config/locale/generic/ctype_members.cc. DragonFly + * implements these in config/os/bsd/dragonfly/ctype_inline.h. + */ +#if defined(__illumos__) + bool + ctype:: + do_is(mask __m, char_type __c) const + { + bool __ret = false; + // Generically, 15 (instead of 11) since we don't know the numerical + // encoding of the various categories in /usr/include/ctype.h. + const size_t __bitmasksize = 15; + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) + if (__m & _M_bit[__bitcur] + && iswctype(__c, _M_wmask[__bitcur])) + { + __ret = true; + break; + } + return __ret; + } + + const wchar_t* + ctype:: + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const + { + for (;__lo < __hi; ++__vec, ++__lo) + { + // Generically, 15 (instead of 11) since we don't know the numerical + // encoding of the various categories in /usr/include/ctype.h. + const size_t __bitmasksize = 15; + mask __m = 0; + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) + if (iswctype(*__lo, _M_wmask[__bitcur])) + __m |= _M_bit[__bitcur]; + *__vec = __m; + } + return __hi; + } + + const wchar_t* + ctype:: + do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const + { + while (__lo < __hi && !this->do_is(__m, *__lo)) + ++__lo; + return __lo; + } + + const wchar_t* + ctype:: + do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const + { + while (__lo < __hi && this->do_is(__m, *__lo) != 0) + ++__lo; + return __lo; + } +#endif + wchar_t ctype:: do_widen(char __c) const -- 2.51.0