[WIP] Support C++11 <cuchar>
Ed Smith-Rowland
3dw4rd@verizon.net
Wed May 20 14:29:00 GMT 2015
On 05/20/2015 08:47 AM, Jonathan Wakely wrote:
> On 21 November 2013 at 22:58, Ed Smith-Rowland wrote:
>> Greetings,
>>
>> This effort tries to add the C++11 header <cuchar> that is a wrapper for the C11 header uchar.h. This feature supports conversion to and from char16_t/char32_t and multibyte sequences and is supported on newer glibc systems.
>>
>> Honestly, my main goal was to check off a low-priority box and to learn some things ahead of finishing, say, filesystem. The main things that are getting me are configuration issues and autohell. Also, in the cases where uchar.h is not supported - what to do? I have a #warning in cuchar about missing support and the guts are then #if-d out. I want a macro maybe to let the user test if this <cuchar> is actually working on their system.
> Hi Ed,
>
> This patch of yours (from 2013) looks like a good start.
>
> We don't need to test for uchar.h twice, so adding it to
> AC_CHECK_HEADERS should be sufficient, which means your
> GLIBCXX_CHECK_CUCHAR macro isn't needed (you weren't using it anyway,
> to use it you'd need to add it to configure.ac as well as defining it
> in acinclude.m4). It's possible that on some platforms including
> <uchar.h> without at least -std=c11 or -std=c++11 would give an error,
> in which case we would want something like GLIBCXX_CHECK_CUCHAR, but
> it would need to save the CXXFLAGS, add -std=c++11 to them while doing
> the test, then restore the old CXXFLAGS. For now let's assume that
> just adding uchar.h to AC_CHECK_HEADERS is enough.
>
> Another approach, which might be better, would be to only install
> <cuchar> when <uchar.h> is available, which would do away with the
> need for a macro, because we'd never install a broken <cuchar>. The
> way to do that would be an automake variable (rather than an autoconf
> macro), similar to how ENABLE_FILESYSTEM_TS is used in
> include/Makefile.am. The testsuite could then use
> __has_include(uchar.h) or __has_include(cuchar) to include them
> conditionally.
>
> The comments in the <cuchar> headers refer to clause 21.4 but should
> be 21.7, and should refer to the C++11 standard explicitly, because
> that subclause has moved to 21.8 in C++14, i.e.
> +// ISO C++ 14882:2011 21.7
> (We have dozens of incorrect subclause references like this throughout
> our headers, at some point we need to review them all and make them
> mention the standard revision explicitly, i.e. change every 21.7 to
> "ISO/IEC C++ 14882:2011 21.7" or just "C++11 21.7", but that's deathly
> boring work so I doubt anyone is going to do it anytime soon!)
>
> I might be missing something, but why are you including <cwchar> in
> <cuchar>? Is that required?
>
> Do you want to resume work on this yourself, or should I finish it off?
Hi Jonathan,
I would like to finish it off.
I would rather not install a broken header. That's the one thnig that
made me feel bad about my original patch.
If I run into trouble I'll ask - I'm weak on auto* stuff.
Ed
P.S. Do you know what the committee thought about special functions?
It looked like they said No.
I want to put them in per TR29124 in either case.
More information about the Libstdc++
mailing list