public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r10-10186] libstdc++: Fix inefficiency in filesystem::absolute [PR99876] Date: Tue, 12 Oct 2021 16:28:21 +0000 (GMT) [thread overview] Message-ID: <20211012162821.17AD63857424@sourceware.org> (raw) https://gcc.gnu.org/g:154316697dbea9ba96bc14680b642b3ae35dadbd commit r10-10186-g154316697dbea9ba96bc14680b642b3ae35dadbd Author: Jonathan Wakely <jwakely@redhat.com> Date: Fri Aug 27 10:59:54 2021 +0100 libstdc++: Fix inefficiency in filesystem::absolute [PR99876] When the path is already absolute, the call to current_path() is wasteful, because operator/ will ignore the left operand anyway. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/99876 * src/c++17/fs_ops.cc (fs::absolute): Call non-throwing form, to avoid unnecessary current_path() call. (cherry picked from commit 07b990ee23e0c7a92d362dbb25fd5d57d95eb8be) Diff: --- libstdc++-v3/src/c++17/fs_ops.cc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/libstdc++-v3/src/c++17/fs_ops.cc b/libstdc++-v3/src/c++17/fs_ops.cc index 1a340477b3a..008195c2d31 100644 --- a/libstdc++-v3/src/c++17/fs_ops.cc +++ b/libstdc++-v3/src/c++17/fs_ops.cc @@ -65,19 +65,12 @@ namespace posix = std::filesystem::__gnu_posix; fs::path fs::absolute(const path& p) { -#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS error_code ec; path ret = absolute(p, ec); if (ec) _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot make absolute path", p, ec)); return ret; -#else - if (p.empty()) - _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot make absolute path", p, - make_error_code(std::errc::invalid_argument))); - return current_path() / p; -#endif } fs::path
reply other threads:[~2021-10-12 16:28 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211012162821.17AD63857424@sourceware.org \ --to=redi@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).