From 29453a9ffd873b2e463727bc93bad48c9535b99c Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 27 Oct 2017 18:49:29 +0100 Subject: Remove noexcept from filesystem iterators and operations (LWG 3013, 3014) * include/bits/fs_dir.h (directory_iterator): Remove noexcept from constructors and increment member (LWG 3013). (recursive_directory_iterator): Likewise. * include/bits/fs_ops.h (copy, copy_file, create_directories) (is_empty, remove_all): Remove noexcept (LWG 3013 and LWG 3014). * src/filesystem/std-dir.cc (directory_iterator::increment) (recursive_directory_iterator::increment): Remove noexcept. * src/filesystem/std-ops.cc (copy, copy_file, create_directories) (is_empty, remove_all): Remove noexcept From-SVN: r254160 --- libstdc++-v3/ChangeLog | 10 ++++++++++ libstdc++-v3/include/bits/fs_dir.h | 18 ++++++++---------- libstdc++-v3/include/bits/fs_ops.h | 14 +++++++------- libstdc++-v3/src/filesystem/std-dir.cc | 4 ++-- libstdc++-v3/src/filesystem/std-ops.cc | 10 +++++----- 5 files changed, 32 insertions(+), 24 deletions(-) (limited to 'libstdc++-v3') diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f924ad4..efd8546 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,15 @@ 2017-10-27 Jonathan Wakely + * include/bits/fs_dir.h (directory_iterator): Remove noexcept from + constructors and increment member (LWG 3013). + (recursive_directory_iterator): Likewise. + * include/bits/fs_ops.h (copy, copy_file, create_directories) + (is_empty, remove_all): Remove noexcept (LWG 3013 and LWG 3014). + * src/filesystem/std-dir.cc (directory_iterator::increment) + (recursive_directory_iterator::increment): Remove noexcept. + * src/filesystem/std-ops.cc (copy, copy_file, create_directories) + (is_empty, remove_all): Remove noexcept + * include/bits/fs_dir.h (file_status): Make default constructor non-explicit (LWG 2787). * testsuite/27_io/filesystem/file_status/1.cc: New test. diff --git a/libstdc++-v3/include/bits/fs_dir.h b/libstdc++-v3/include/bits/fs_dir.h index cd83d25..579a269 100644 --- a/libstdc++-v3/include/bits/fs_dir.h +++ b/libstdc++-v3/include/bits/fs_dir.h @@ -355,12 +355,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 directory_iterator(const path& __p, directory_options __options) : directory_iterator(__p, __options, nullptr) { } - directory_iterator(const path& __p, error_code& __ec) noexcept + directory_iterator(const path& __p, error_code& __ec) : directory_iterator(__p, directory_options::none, __ec) { } - directory_iterator(const path& __p, - directory_options __options, - error_code& __ec) noexcept + directory_iterator(const path& __p, directory_options __options, + error_code& __ec) : directory_iterator(__p, __options, &__ec) { } directory_iterator(const directory_iterator& __rhs) = default; @@ -378,7 +377,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 const directory_entry& operator*() const; const directory_entry* operator->() const { return &**this; } directory_iterator& operator++(); - directory_iterator& increment(error_code& __ec) noexcept; + directory_iterator& increment(error_code& __ec); __directory_iterator_proxy operator++(int) { @@ -436,12 +435,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 recursive_directory_iterator(const path& __p, directory_options __options) : recursive_directory_iterator(__p, __options, nullptr) { } - recursive_directory_iterator(const path& __p, - directory_options __options, - error_code& __ec) noexcept + recursive_directory_iterator(const path& __p, directory_options __options, + error_code& __ec) : recursive_directory_iterator(__p, __options, &__ec) { } - recursive_directory_iterator(const path& __p, error_code& __ec) noexcept + recursive_directory_iterator(const path& __p, error_code& __ec) : recursive_directory_iterator(__p, directory_options::none, &__ec) { } recursive_directory_iterator( @@ -466,7 +464,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 operator=(recursive_directory_iterator&& __rhs) noexcept; recursive_directory_iterator& operator++(); - recursive_directory_iterator& increment(error_code& __ec) noexcept; + recursive_directory_iterator& increment(error_code& __ec); __directory_iterator_proxy operator++(int) { diff --git a/libstdc++-v3/include/bits/fs_ops.h b/libstdc++-v3/include/bits/fs_ops.h index 563d63d..075d61e 100644 --- a/libstdc++-v3/include/bits/fs_ops.h +++ b/libstdc++-v3/include/bits/fs_ops.h @@ -56,31 +56,31 @@ namespace filesystem { copy(__from, __to, copy_options::none); } inline void - copy(const path& __from, const path& __to, error_code& __ec) noexcept + copy(const path& __from, const path& __to, error_code& __ec) { copy(__from, __to, copy_options::none, __ec); } void copy(const path& __from, const path& __to, copy_options __options); void copy(const path& __from, const path& __to, copy_options __options, - error_code& __ec) noexcept; + error_code& __ec); inline bool copy_file(const path& __from, const path& __to) { return copy_file(__from, __to, copy_options::none); } inline bool - copy_file(const path& __from, const path& __to, error_code& __ec) noexcept + copy_file(const path& __from, const path& __to, error_code& __ec) { return copy_file(__from, __to, copy_options::none, __ec); } bool copy_file(const path& __from, const path& __to, copy_options __option); bool copy_file(const path& __from, const path& __to, copy_options __option, - error_code& __ec) noexcept; + error_code& __ec); void copy_symlink(const path& __existing_symlink, const path& __new_symlink); void copy_symlink(const path& __existing_symlink, const path& __new_symlink, error_code& __ec) noexcept; bool create_directories(const path& __p); - bool create_directories(const path& __p, error_code& __ec) noexcept; + bool create_directories(const path& __p, error_code& __ec); bool create_directory(const path& __p); bool create_directory(const path& __p, error_code& __ec) noexcept; @@ -172,7 +172,7 @@ namespace filesystem { return is_directory(status(__p, __ec)); } bool is_empty(const path& __p); - bool is_empty(const path& __p, error_code& __ec) noexcept; + bool is_empty(const path& __p, error_code& __ec); inline bool is_fifo(file_status __s) noexcept @@ -274,7 +274,7 @@ namespace filesystem bool remove(const path& __p, error_code& __ec) noexcept; uintmax_t remove_all(const path& __p); - uintmax_t remove_all(const path& __p, error_code& __ec) noexcept; + uintmax_t remove_all(const path& __p, error_code& __ec); void rename(const path& __from, const path& __to); void rename(const path& __from, const path& __to, error_code& __ec) noexcept; diff --git a/libstdc++-v3/src/filesystem/std-dir.cc b/libstdc++-v3/src/filesystem/std-dir.cc index 8e45890..553128e 100644 --- a/libstdc++-v3/src/filesystem/std-dir.cc +++ b/libstdc++-v3/src/filesystem/std-dir.cc @@ -158,7 +158,7 @@ fs::directory_iterator::operator++() } fs::directory_iterator& -fs::directory_iterator::increment(error_code& ec) noexcept +fs::directory_iterator::increment(error_code& ec) { if (!_M_dir) { @@ -243,7 +243,7 @@ fs::recursive_directory_iterator::operator++() } fs::recursive_directory_iterator& -fs::recursive_directory_iterator::increment(error_code& ec) noexcept +fs::recursive_directory_iterator::increment(error_code& ec) { if (!_M_dirs) { diff --git a/libstdc++-v3/src/filesystem/std-ops.cc b/libstdc++-v3/src/filesystem/std-ops.cc index 947be7e..fa5e19a 100644 --- a/libstdc++-v3/src/filesystem/std-ops.cc +++ b/libstdc++-v3/src/filesystem/std-ops.cc @@ -430,7 +430,7 @@ fs::do_copy_file(const char* from, const char* to, void fs::copy(const path& from, const path& to, copy_options options, - error_code& ec) noexcept + error_code& ec) { const bool skip_symlinks = is_set(options, copy_options::skip_symlinks); const bool create_symlinks = is_set(options, copy_options::create_symlinks); @@ -544,7 +544,7 @@ fs::copy_file(const path& from, const path& to, copy_options option) bool fs::copy_file(const path& from, const path& to, copy_options options, - error_code& ec) noexcept + error_code& ec) { #ifdef _GLIBCXX_HAVE_SYS_STAT_H return do_copy_file(from.c_str(), to.c_str(), copy_file_options(options), @@ -596,7 +596,7 @@ fs::create_directories(const path& p) } bool -fs::create_directories(const path& p, error_code& ec) noexcept +fs::create_directories(const path& p, error_code& ec) { if (p.empty()) { @@ -1008,7 +1008,7 @@ fs::is_empty(const path& p) } bool -fs::is_empty(const path& p, error_code& ec) noexcept +fs::is_empty(const path& p, error_code& ec) { auto s = status(p, ec); if (ec) @@ -1268,7 +1268,7 @@ fs::remove_all(const path& p) } std::uintmax_t -fs::remove_all(const path& p, error_code& ec) noexcept +fs::remove_all(const path& p, error_code& ec) { auto fs = symlink_status(p, ec); uintmax_t count = 0; -- cgit v1.1