This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: one idea for next GSoC: libstdc++ locale support based on POSIX 2008 duplocale/uselocale, etc.
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Václav Zeman <vhaisman at gmail dot com>
- Cc: Jonathan Wakely <jwakely dot gcc at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Mon, 25 Nov 2013 16:36:27 +0100
- Subject: Re: one idea for next GSoC: libstdc++ locale support based on POSIX 2008 duplocale/uselocale, etc.
- Authentication-results: sourceware.org; auth=none
- References: <52928341 dot 3030409 at gmail dot com> <20131124235530 dot GR892 at tucnak dot redhat dot com> <5292F23B dot 9040508 at gmail dot com> <CAH6eHdQQmoJoFbW6XEsv4HOWDDfaiR9=yRddjKnKvirjO67U5Q at mail dot gmail dot com> <CAKw7uVg7qnjy10x0YFx5+WkVS4P5cV2DBBTNRv6f6Dkd6Q342Q at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Nov 25, 2013 at 04:24:35PM +0100, Václav Zeman wrote:
> >> What I am proposing is that somebody takes the pure POSIX 2008 API and
> >> implements `std::locale` on top of that.
> >
> > This would be helpful for non-GNU platforms, but would not add any
> > functionality for glibc-based targets, which already have a fully
> > functional <locale> implementation using the GNU-specific features.
>
> True. That is why I am proposing this as a GSoC task so that non-GNU
> platforms like said FreeBSD and Darwin have decent C++ locale support
> based on POSIX 2008 API.
Isn't that not enough work for GSoC? I mean, this is an 1-2 hours
coding task plus testing, say abstract the fact whether uselocale/etc.
APIs are available into say some constexpr bool and wrap all the APIs
into some wrapper functions in some special namespace or class, whatever
the libstdc++-v3 maintainers prefer. Then just use the constexpr bool
instead of the current
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
preprocessor tests and use the wrappers.
Even glibc 2.3 had both the __uselocale etc. APIs and uselocale, the reason
for using __uselocale is that when uselocale was just a GNU extension, then
say a valid ISO C++98 program could define ::uselocale function and do something
completely different there. So, if libstdc++ then calls uselocale, it could
crash or misbehave. So, if __uselocale (which is in implementation
namespace) is available, we certainly want to prefer that over uselocale.
Jakub