Author: ericwf Date: Sat Oct 15 19:47:59 2016 New Revision: 284318 URL: http://llvm.org/viewvc/llvm-project?rev=284318&view=rev Log: Implement LWG 2712 and update other issues status
Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp libcxx/trunk/www/upcoming_meeting.html Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=284318&r1=284317&r2=284318&view=diff ============================================================================== --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Sat Oct 15 19:47:59 2016 @@ -282,6 +282,10 @@ bool __copy_file(const path& from, const } const bool to_exists = exists(to_st); + if (to_exists && !is_regular_file(to_st)) { + set_or_throw(make_error_code(errc::not_supported), ec, "copy_file", from, to); + return false; + } if (to_exists && bool(copy_options::skip_existing & options)) { return false; } @@ -302,6 +306,8 @@ bool __copy_file(const path& from, const set_or_throw(make_error_code(errc::file_exists), ec, "copy", from, to); return false; } + + _LIBCPP_UNREACHABLE(); } void __copy_symlink(const path& existing_symlink, const path& new_symlink, Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp?rev=284318&r1=284317&r2=284318&view=diff ============================================================================== --- libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp Sat Oct 15 19:47:59 2016 @@ -153,12 +153,36 @@ TEST_CASE(copy_dir_test) scoped_test_env env; const path file = env.create_file("file1", 42); const path dest = env.create_dir("dir1"); - std::error_code ec; + std::error_code ec = GetTestEC(); TEST_CHECK(fs::copy_file(file, dest, ec) == false); TEST_CHECK(ec); - ec.clear(); + TEST_CHECK(ec != GetTestEC()); + ec = GetTestEC(); TEST_CHECK(fs::copy_file(dest, file, ec) == false); TEST_CHECK(ec); + TEST_CHECK(ec != GetTestEC()); +} + +TEST_CASE(non_regular_file_test) +{ + scoped_test_env env; + const path fifo = env.create_fifo("fifo"); + const path dest = env.make_env_path("dest"); + const path file = env.create_file("file", 42); + { + std::error_code ec = GetTestEC(); + TEST_REQUIRE(fs::copy_file(fifo, dest, ec) == false); + TEST_CHECK(ec); + TEST_CHECK(ec != GetTestEC()); + TEST_CHECK(!exists(dest)); + } + { + std::error_code ec = GetTestEC(); + TEST_REQUIRE(fs::copy_file(file, fifo, copy_options::overwrite_existing, ec) == false); + TEST_CHECK(ec); + TEST_CHECK(ec != GetTestEC()); + TEST_CHECK(is_fifo(fifo)); + } } TEST_SUITE_END() Modified: libcxx/trunk/www/upcoming_meeting.html URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284318&r1=284317&r2=284318&view=diff ============================================================================== --- libcxx/trunk/www/upcoming_meeting.html (original) +++ libcxx/trunk/www/upcoming_meeting.html Sat Oct 15 19:47:59 2016 @@ -100,10 +100,10 @@ <tr><td><a href="http://wg21.link/LWG2694">2694</a></td><td>Application of LWG 436 accidentally deleted definition of "facet"</td><td>Issaquah</td><td>Nothing to do</td></tr> <tr><td><a href="http://wg21.link/LWG2696">2696</a></td><td>Interaction between make_shared and enable_shared_from_this is underspecified</td><td>Issaquah</td><td></td></tr> <tr><td><a href="http://wg21.link/LWG2699">2699</a></td><td>Missing restriction in [numeric.requirements]</td><td>Issaquah</td><td></td></tr> - <tr><td><a href="http://wg21.link/LWG2712">2712</a></td><td>copy_file(from, to, ...) has a number of unspecified error conditions</td><td>Issaquah</td><td></td></tr> - <tr><td><a href="http://wg21.link/LWG2722">2722</a></td><td>equivalent incorrectly specifies throws clause</td><td>Issaquah</td><td></td></tr> + <tr><td><a href="http://wg21.link/LWG2712">2712</a></td><td>copy_file(from, to, ...) has a number of unspecified error conditions</td><td>Issaquah</td><td>Implemented in trunk</td></tr> + <tr><td><a href="http://wg21.link/LWG2722">2722</a></td><td>equivalent incorrectly specifies throws clause</td><td>Issaquah</td><td>We already do this</td></tr> <tr><td><a href="http://wg21.link/LWG2729">2729</a></td><td>Missing SFINAE on std::pair::operator=</td><td>Issaquah</td><td></td></tr> - <tr><td><a href="http://wg21.link/LWG2732">2732</a></td><td>Questionable specification of path::operator/= and path::append</td><td>Issaquah</td><td></td></tr> + <tr><td><a href="http://wg21.link/LWG2732">2732</a></td><td>Questionable specification of path::operator/= and path::append</td><td>Issaquah</td><td>Nothing to do</td></tr> <tr><td><a href="http://wg21.link/LWG2733">2733</a></td><td>[fund.ts.v2] gcd / lcm and bool</td><td>Issaquah</td><td></td></tr> <tr><td><a href="http://wg21.link/LWG2735">2735</a></td><td>std::abs(short), std::abs(signed char) and others should return int instead of double in order to be compatible with C++98 and C</td><td>Issaquah</td><td></td></tr> <tr><td><a href="http://wg21.link/LWG2736">2736</a></td><td>nullopt_t insufficiently constrained</td><td>Issaquah</td><td></td></tr> @@ -178,10 +178,10 @@ <li>2694 - Restoring inadvertently deleted text. No code changes needed.</li> <li>2696 - I <b>suspect</b> that this is just better specification of the existing structure. Probably need more tests for this.</li> <li>2699 - I don't think this requires any code changes; look more closely.</li> -<li>2712 - File System; Eric?</li> -<li>2722 - File System; Eric?</li> +<li>2712 - LGTM. </li> +<li>2722 - LGTM </li> <li>2729 - </li> -<li>2732 - File System; Eric?</li> +<li>2732 - Our implementation is already equivalent. </li> <li>2733 - LFTS; same as 2759</li> <li>2735 - I <b>suspect</b> that this is just better specification of the existing structure. Probably need more tests for this.</li> <li>2736 - </li> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits