Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure special wchar_t support is enabled #30

Open
dmik opened this issue Sep 28, 2018 · 2 comments

Comments

Projects
None yet
1 participant
@dmik
Copy link
Collaborator

commented Sep 28, 2018

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. a std::is_integral<wchar_t> specialization returning true instead of false and a lot of other things.

The problem was found while working on the QTypeInfo<wchar_t> specialization for Qt 5 within bitwiseworks/qtbase-os2#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.

@dmik

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 28, 2018

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.

@dmik

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 28, 2018

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: bitwiseworks/libc#8.

dmik added a commit to bitwiseworks/qtbase-os2 that referenced this issue Oct 2, 2018

corelib: Specialize QTypeInfo<wchar_t> on OS/2.
This is due to the following GCC bug: psmedley/gcc#30.

Needed for #29.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.