This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] C++17 P0067R5 std::to_chars and std::from_chars (partial)
- From: Christophe Lyon <christophe dot lyon at linaro dot org>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 6 Oct 2017 09:44:01 +0200
- Subject: Re: [PATCH] C++17 P0067R5 std::to_chars and std::from_chars (partial)
- Authentication-results: sourceware.org; auth=none
- References: <20171002141317.GA12502@redhat.com> <20171003143136.GX4582@redhat.com> <CAKdteOazZPLShTNGLqEs+PpDvSSy=e0p1CMiqBjXg_R5MVes2g@mail.gmail.com> <20171005202706.GA17829@redhat.com>
On 5 October 2017 at 22:27, Jonathan Wakely <jwakely@redhat.com> wrote:
> On 05/10/17 22:00 +0200, Christophe Lyon wrote:
>>
>> Hi Jonathan,
>>
>> On 3 October 2017 at 16:31, Jonathan Wakely <jwakely@redhat.com> wrote:
>>>
>>> On 02/10/17 15:13 +0100, Jonathan Wakely wrote:
>>>>
>>>>
>>>> +#ifndef _GLIBCXX_CHARCONV
>>>> +#define _GLIBCXX_CHARCONV 1
>>>> +
>>>> +#pragma GCC system_header
>>>> +
>>>> +#if __cplusplus >= 201402L
>>>> +
>>>> +#include <type_traits>
>>>> +#include <limits>
>>>> +#include <cctype>
>>>> +#include <bits/error_constants.h> // for std::errc
>>>
>>>
>>>
>>> I forgot to mention that I've made this header work for C++14 not just
>>> C++17. I
>>> did this for similar reasons as we make some C++17 things available for
>>> -std=gnu++11 and -std=gnu++14:
>>>
>>> #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or
>>> gnu++11
>>>
>>> But in this case <charconv> is a completely new header so we don't have
>>> to
>>> limit it to -std=gnu++NN modes only. The new functions won't pollute
>>> namespace
>>> std unless the new header gets included, which strictly-conforming C++14
>>> code
>>> won't do anyway.
>>>
>>
>> Sorry for the delay, I'm still catching up after Linaro Connect.
>>
>> I've noticed that one of the new tests (20_util/to_chars/1.cc)
>> fails to compile on ARM and AArch64 bare-metal targets (with Newlib).
>> That is, arm-none-eabi and aarch64-none-elf targets.
>>
>> The error message I'm seeing is:
>> /libstdc++-v3/testsuite/20_util/to_chars/1.cc: In function 'void
>> test01()':
>> /libstdc++-v3/testsuite/20_util/to_chars/1.cc:88: error:
>> 'std::to_string' has not been declared
>> In file included from /libstdc++-v3/testsuite/20_util/to_chars/1.cc:38:
>> /libstdc++-v3/testsuite/20_util/to_chars/1.cc:90: error: 'to_string'
>> was not declared in this scope
>> /libstdc++-v3/testsuite/util/testsuite_hooks.h:57: note: in definition
>> of macro 'VERIFY'
>
>
> Should be fixed with the attached patch.
>
Indeed, this makes the tests unsupported rather than fail.
Thanks,
Christophe
Reviewed-by: Christophe Lyon <christophe.lyon@linaro.org>