From e3690ba58697bdec5e989cff0360845f239813f5 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 4 Feb 2018 07:35:36 +0000 Subject: [PATCH] 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 --- libcxx/include/experimental/filesystem | 16 ++++++++-------- .../fs.op.copy_file/copy_file.pass.cpp | 4 ++-- .../create_directories.pass.cpp | 2 +- .../fs.op.remove_all/remove_all.pass.cpp | 2 +- libcxx/www/upcoming_meeting.html | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libcxx/include/experimental/filesystem b/libcxx/include/experimental/filesystem index 39750d9b4412..cdfe9e254be7 100644 --- a/libcxx/include/experimental/filesystem +++ b/libcxx/include/experimental/filesystem @@ -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); } diff --git a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp index ee2ad1c46cf9..fe5f00128ea1 100644 --- a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp +++ b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp @@ -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) diff --git a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp index ba060254956f..c7d9339dfd7b 100644 --- a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp +++ b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp @@ -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) diff --git a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp index b0538a179c89..64c5c88c8cf6 100644 --- a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp +++ b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp @@ -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) diff --git a/libcxx/www/upcoming_meeting.html b/libcxx/www/upcoming_meeting.html index 1b918ba614a1..67708aac86c5 100644 --- a/libcxx/www/upcoming_meeting.html +++ b/libcxx/www/upcoming_meeting.html @@ -76,7 +76,7 @@ 3009Including <string_view> doesn't provide std::size/empty/dataJacksonvilleComplete 3010[networking.ts] uses_executor says "if a type T::executor_type exists"Jacksonville 3013(recursive_)directory_iterator construction and traversal should not be noexceptJacksonvilleComplete -3014More noexcept issues with filesystem operationsJacksonville +3014More noexcept issues with filesystem operationsJacksonvilleComplete 3015copy_options::unspecified underspecifiedJacksonville 3017list splice functions should use addressofJacksonville 3020[networking.ts] Remove spurious nested value_type buffer sequence requirementJacksonville @@ -113,7 +113,7 @@
  • 3009 - We do this already; tests added in r323719
  • 3010 - No networking TS implementation yet
  • 3013 - We already implement this
  • -
  • 3014 - Eric?
  • +
  • 3014 - We implement this
  • 3015 - Eric?
  • 3017 - We don't do the splicing stuff yet
  • 3020 - No networking TS implementation yet