* [PATCH] Remove noexcept from filesystem iterators and operations (LWG 3013, 3014)
@ 2017-10-27 17:52 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2017-10-27 17:52 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 717 bytes --]
These issues haven't been resolved yet, but the discussion is correct
that these operations allocate memory, so the proposed resolutions are
correct.
* 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
Tested powerpc64le-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 8090 bytes --]
commit eeb3ecd4345471956f95e77c853e1ed00fded065
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Oct 27 17:58:22 2017 +0100
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
diff --git a/libstdc++-v3/include/bits/fs_dir.h b/libstdc++-v3/include/bits/fs_dir.h
index cd83d25c4ad..579a269711e 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 563d63de81a..075d61e2a63 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 8e45890b68e..553128e9096 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 947be7ef4c5..fa5e19a36ba 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-10-27 17:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-27 17:52 [PATCH] Remove noexcept from filesystem iterators and operations (LWG 3013, 3014) Jonathan Wakely
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).