This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] LWG 2936: update path::compare logic and optimize string comparisons
- 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, gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 19 Dec 2018 22:30:25 +0100
- Subject: Re: [PATCH] LWG 2936: update path::compare logic and optimize string comparisons
- References: <20181218155135.GA8112@redhat.com>
On Tue, 18 Dec 2018 at 16:51, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> The resolution for LWG 2936 defines the comparison more precisely, which
> this patch implements. The patch also defines comparisons with strings
> to work without constructing a temporary path object (so avoids any
> memory allocations).
>
> * include/bits/fs_path.h (path::compare(const string_type&))
> (path::compare(const value_type*)): Add noexcept and construct a
> string view to compare to instead of a path.
> (path::compare(basic_string_view<value_type>)): Add noexcept. Remove
> inline definition.
> * src/filesystem/std-path.cc (path::_Parser): Track last type read
> from input.
> (path::_Parser::next()): Return a final empty component when the
> input ends in a non-root directory separator.
> (path::_M_append(basic_string_view<value_type>)): Remove special cases
> for trailing non-root directory separator.
> (path::_M_concat(basic_string_view<value_type>)): Likewise.
> (path::compare(const path&)): Implement LWG 2936.
> (path::compare(basic_string_view<value_type>)): Define in terms of
> components returned by parser, consistent with LWG 2936.
> * testsuite/27_io/filesystem/path/compare/lwg2936.cc: New.
> * testsuite/27_io/filesystem/path/compare/path.cc: Test more cases.
> * testsuite/27_io/filesystem/path/compare/strings.cc: Likewise.
>
> Tested x86_64-linux, committed to trunk.
>
Hi,
The updated test fails on aarch64-linux-gnu:
FAIL: 27_io/filesystem/path/compare/strings.cc execution test
In the logs I can see:
/libstdc++-v3/testsuite/27_io/filesystem/path/compare/strings.cc:40:
void test01(): Assertion 'p.compare(p0) == p.compare(s0)' failed.
Christophe