Implement LWG 3014 - Fix more noexcept issues in filesystem.

This patch removes the noexcept declaration from filesystem
operations which require creating temporary paths or
creating a directory iterator. Either of these operations
can throw.

llvm-svn: 324192
This commit is contained in:
Eric Fiselier 2018-02-04 07:35:36 +00:00
parent 309f8b1168
commit e3690ba586
5 changed files with 14 additions and 14 deletions

View File

@ -88,17 +88,17 @@
error_code& ec);
bool copy_file(const path& from, const path& to);
bool copy_file(const path& from, const path& to, error_code& ec) _NOEXCEPT;
bool copy_file(const path& from, const path& to, error_code& 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;
@ -188,7 +188,7 @@
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;
@ -1375,7 +1375,7 @@ bool copy_file(const path& __from, const path& __to) {
}
inline _LIBCPP_INLINE_VISIBILITY
bool copy_file(const path& __from, const path& __to, error_code& __ec) _NOEXCEPT {
bool copy_file(const path& __from, const path& __to, error_code& __ec) {
return __copy_file(__from, __to, copy_options::none, &__ec);
}
@ -1386,7 +1386,7 @@ bool copy_file(const path& __from, const path& __to, copy_options __opt) {
inline _LIBCPP_INLINE_VISIBILITY
bool copy_file(const path& __from, const path& __to,
copy_options __opt, error_code& __ec) _NOEXCEPT {
copy_options __opt, error_code& __ec){
return __copy_file(__from, __to, __opt, &__ec);
}
@ -1406,7 +1406,7 @@ bool create_directories(const path& __p) {
}
inline _LIBCPP_INLINE_VISIBILITY
bool create_directories(const path& __p, error_code& __ec) _NOEXCEPT {
bool create_directories(const path& __p, error_code& __ec) {
return __create_directories(__p, &__ec);
}
@ -1699,7 +1699,7 @@ uintmax_t remove_all(const path& __p) {
}
inline _LIBCPP_INLINE_VISIBILITY
uintmax_t remove_all(const path& __p, error_code& __ec) _NOEXCEPT {
uintmax_t remove_all(const path& __p, error_code& __ec) {
return __remove_all(__p, &__ec);
}

View File

@ -44,8 +44,8 @@ TEST_CASE(test_signatures)
ASSERT_SAME_TYPE(decltype(fs::copy_file(p, p, opts, ec)), bool);
ASSERT_NOT_NOEXCEPT(fs::copy_file(p, p));
ASSERT_NOT_NOEXCEPT(fs::copy_file(p, p, opts));
ASSERT_NOEXCEPT(fs::copy_file(p, p, ec));
ASSERT_NOEXCEPT(fs::copy_file(p, p, opts, ec));
ASSERT_NOT_NOEXCEPT(fs::copy_file(p, p, ec));
ASSERT_NOT_NOEXCEPT(fs::copy_file(p, p, opts, ec));
}
TEST_CASE(test_error_reporting)

View File

@ -34,7 +34,7 @@ TEST_CASE(test_signatures)
ASSERT_SAME_TYPE(decltype(fs::create_directories(p)), bool);
ASSERT_SAME_TYPE(decltype(fs::create_directories(p, ec)), bool);
ASSERT_NOT_NOEXCEPT(fs::create_directories(p));
ASSERT_NOEXCEPT(fs::create_directories(p, ec));
ASSERT_NOT_NOEXCEPT(fs::create_directories(p, ec));
}
TEST_CASE(create_existing_directory)

View File

@ -33,7 +33,7 @@ TEST_CASE(test_signatures)
ASSERT_SAME_TYPE(decltype(fs::remove_all(p, ec)), std::uintmax_t);
ASSERT_NOT_NOEXCEPT(fs::remove_all(p));
ASSERT_NOEXCEPT(fs::remove_all(p, ec));
ASSERT_NOT_NOEXCEPT(fs::remove_all(p, ec));
}
TEST_CASE(test_error_reporting)

View File

@ -76,7 +76,7 @@
<tr><td><a href="https://wg21.link/LWG3009">3009</a></td><td>Including <tt>&lt;string_view&gt;</tt> doesn't provide <tt>std::size/empty/data</tt></td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG3010">3010</a></td><td>[networking.ts] <tt>uses_executor</tt> says "if a type <tt>T::executor_type</tt> exists"</td><td>Jacksonville</td><td></td></tr>
<tr><td><a href="https://wg21.link/LWG3013">3013</a></td><td><tt>(recursive_)directory_iterator</tt> construction and traversal should not be <tt>noexcept</tt></td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG3014">3014</a></td><td>More <tt>noexcept</tt> issues with filesystem operations</td><td>Jacksonville</td><td></td></tr>
<tr><td><a href="https://wg21.link/LWG3014">3014</a></td><td>More <tt>noexcept</tt> issues with filesystem operations</td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG3015">3015</a></td><td><tt>copy_options::<i>unspecified</i></tt> underspecified</td><td>Jacksonville</td><td></td></tr>
<tr><td><a href="https://wg21.link/LWG3017">3017</a></td><td><tt>list splice</tt> functions should use <tt>addressof</tt></td><td>Jacksonville</td><td></td></tr>
<tr><td><a href="https://wg21.link/LWG3020">3020</a></td><td>[networking.ts] Remove spurious nested <tt>value_type</tt> buffer sequence requirement</td><td>Jacksonville</td><td></td></tr>
@ -113,7 +113,7 @@
<li> 3009 - We do this already; tests added in r323719</li>
<li> 3010 - No networking TS implementation yet</li>
<li> 3013 - We already implement this</li>
<li> 3014 - Eric? </li>
<li> 3014 - We implement this</li>
<li> 3015 - Eric? </li>
<li> 3017 - We don't do the splicing stuff yet</li>
<li> 3020 - No networking TS implementation yet</li>