Closed dmik closed 4 years ago
The configure test is this one:
#include <wchar.h>
#include <stddef.h>
wint_t i;
long l = WEOF;
long j = WCHAR_MIN;
long k = WCHAR_MAX;
namespace test
{
using ::btowc;
using ::fgetwc;
using ::fgetws;
using ::fputwc;
using ::fputws;
using ::fwide;
using ::fwprintf;
using ::fwscanf;
using ::getwc;
using ::getwchar;
using ::mbrlen;
using ::mbrtowc;
using ::mbsinit;
using ::mbsrtowcs;
using ::putwc;
using ::putwchar;
using ::swprintf;
using ::swscanf;
using ::ungetwc;
using ::vfwprintf;
using ::vswprintf;
using ::vwprintf;
using ::wcrtomb;
using ::wcscat;
using ::wcschr;
using ::wcscmp;
using ::wcscoll;
using ::wcscpy;
using ::wcscspn;
using ::wcsftime;
using ::wcslen;
using ::wcsncat;
using ::wcsncmp;
using ::wcsncpy;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsrtombs;
using ::wcsspn;
using ::wcsstr;
using ::wcstod;
using ::wcstok;
using ::wcstol;
using ::wcstoul;
using ::wcsxfrm;
using ::wctob;
using ::wmemchr;
using ::wmemcmp;
using ::wmemcpy;
using ::wmemmove;
using ::wmemset;
using ::wprintf;
using ::wscanf;
}
Currently, its compilation fails with this:
t.cpp:10:12: error: '::fgetwc' has not been declared
using ::fgetwc;
^
t.cpp:11:12: error: '::fgetws' has not been declared
using ::fgetws;
^
t.cpp:12:12: error: '::fputwc' has not been declared
using ::fputwc;
^
t.cpp:13:12: error: '::fputws' has not been declared
using ::fputws;
^
t.cpp:15:12: error: '::fwprintf' has not been declared
using ::fwprintf;
^
t.cpp:16:12: error: '::fwscanf' has not been declared
using ::fwscanf;
^
t.cpp:17:12: error: '::getwc' has not been declared
using ::getwc;
^
t.cpp:18:12: error: '::getwchar' has not been declared
using ::getwchar;
^
t.cpp:23:12: error: '::putwc' has not been declared
using ::putwc;
^
t.cpp:24:12: error: '::putwchar' has not been declared
using ::putwchar;
^
t.cpp:25:12: error: '::swprintf' has not been declared
using ::swprintf;
^
t.cpp:26:12: error: '::swscanf' has not been declared
using ::swscanf;
^
t.cpp:27:12: error: '::ungetwc' has not been declared
using ::ungetwc;
^
t.cpp:28:12: error: '::vfwprintf' has not been declared
using ::vfwprintf;
^
t.cpp:29:12: error: '::vswprintf' has not been declared
using ::vswprintf;
^
t.cpp:30:12: error: '::vwprintf' has not been declared
using ::vwprintf;
^
t.cpp:59:12: error: '::wprintf' has not been declared
using ::wprintf;
^
t.cpp:60:12: error: '::wscanf' has not been declared
using ::wscanf;
^
So we miss quite a bit.
Note also that kLIBC has other issues with wchar_t, e.g. WCHAR_MIN and WCHAR_MAX which are currently defined as INT_MIN and INT_MAX. This is seriously wrong because wchar_t
is 2 bytes (not 4 bytes) under OS/2. There is a kLIBC ticket for this: http://trac.netlabs.org/libc/ticket/332. And I also created our own LIBC ticket for this where it's going to be fixed one day: https://github.com/bitwiseworks/libc/issues/8.
The relevant commit with workarounds that need to be undone once this is fixed is this one: https://github.com/bitwiseworks/qtdeclarative-os2/commit/e7a97582cd3174aaa5c8533df37fe86efdc5f740
This is closed in favor of https://github.com/bitwiseworks/gcc-os2/issues/16.
IIRC this is disabled by configure now because kLIBC doesn't implement all necessary wide character functions (so the respective configure test fails).
When enabled, gcc defines
_GLIBCXX_USE_WCHAR_T
which enables special code for wide characters. This code includes e.g. astd::is_integral<wchar_t>
specialization returningtrue
instead offalse
and a lot of other things.The problem was found while working on the
QTypeInfo<wchar_t>
specialization for Qt 5 within https://github.com/bitwiseworks/qtbase-os2/issues/29.Note that we may force such support with
--enable-wchar_t
but a test build needs to be done to check if it will work with our kLIBC.