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
This commit is contained in:
Jonathan Wakely 2017-10-27 18:49:29 +01:00 committed by Jonathan Wakely
parent 9a3effa411
commit 29453a9ffd
5 changed files with 32 additions and 24 deletions

View File

@ -1,5 +1,15 @@
2017-10-27 Jonathan Wakely <jwakely@redhat.com>
* 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.

View File

@ -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)
{

View File

@ -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;

View File

@ -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)
{

View File

@ -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;