From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75732 invoked by alias); 19 Dec 2018 21:31:21 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 75225 invoked by uid 89); 19 Dec 2018 21:30:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-vk1-f196.google.com Received: from mail-vk1-f196.google.com (HELO mail-vk1-f196.google.com) (209.85.221.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Dec 2018 21:30:41 +0000 Received: by mail-vk1-f196.google.com with SMTP id h128so4835033vkg.11 for ; Wed, 19 Dec 2018 13:30:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NzUmSQSykpe5Nr4AiMKsaMZYQdDgEtPrSbXK38/WJxs=; b=B0f66egmrquYJqKP281CR7eE1hBNhVqWCQneuq3gJoJaq7XIb34G//BlyI01ahMNK/ oLAuGTp61DisBlXiI8V5W4+OJGykUI/gl2//Avs6LS/dVyCc8YFSsKxWhPibr0cdNQIz y73oxYHg6klRewFoMa+TnZTdcPhpSXXvJjZug= MIME-Version: 1.0 References: <20181218155135.GA8112@redhat.com> In-Reply-To: <20181218155135.GA8112@redhat.com> From: Christophe Lyon Date: Wed, 19 Dec 2018 21:31:00 -0000 Message-ID: Subject: Re: [PATCH] LWG 2936: update path::compare logic and optimize string comparisons To: Jonathan Wakely Cc: libstdc++@gcc.gnu.org, gcc Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg01419.txt.bz2 On Tue, 18 Dec 2018 at 16:51, Jonathan Wakely 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)): 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)): Remove special cases > for trailing non-root directory separator. > (path::_M_concat(basic_string_view)): Likewise. > (path::compare(const path&)): Implement LWG 2936. > (path::compare(basic_string_view)): 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