[libcxx-commits] [libcxx] ddb4693 - [libcxx] [test] Add (void) return casts on functions marked nodiscard in MS STL

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 16 07:37:50 PDT 2020


Author: Martin Storsjö
Date: 2020-10-16T17:36:56+03:00
New Revision: ddb4693a92e763d6cc0e7e2b3b60d662d0716581

URL: https://github.com/llvm/llvm-project/commit/ddb4693a92e763d6cc0e7e2b3b60d662d0716581
DIFF: https://github.com/llvm/llvm-project/commit/ddb4693a92e763d6cc0e7e2b3b60d662d0716581.diff

LOG: [libcxx] [test] Add (void) return casts on functions marked nodiscard in MS STL

Differential Revision: https://reviews.llvm.org/D89533

Added: 
    

Modified: 
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
index d31e30e0551c..707b646be179 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
@@ -98,7 +98,7 @@ TEST_CASE(test_exception_contains_paths)
     CWDGuard guard;
     const path p = "blabla/dne";
     try {
-        canonical(p);
+        (void)canonical(p);
         TEST_REQUIRE(false);
     } catch (filesystem_error const& err) {
         TEST_CHECK(err.path1() == p);
@@ -107,7 +107,7 @@ TEST_CASE(test_exception_contains_paths)
     }
     fs::current_path(static_env.Dir);
     try {
-        canonical(p);
+        (void)canonical(p);
         TEST_REQUIRE(false);
     } catch (filesystem_error const& err) {
         TEST_CHECK(err.path1() == p);

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
index 0d2a55544a1a..347bfa65dfb9 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
@@ -101,7 +101,7 @@ TEST_CASE(test_attributes_get_copied) {
   scoped_test_env env;
   const path file = env.create_file("file1", 42);
   const path dest = env.make_env_path("file2");
-  auto st = status(file);
+  (void)status(file);
   perms new_perms = perms::owner_read;
   permissions(file, new_perms);
   std::error_code ec = GetTestEC();

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
index d2ea65ee183e..15ff08226125 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
@@ -41,7 +41,7 @@ TEST_CASE(test_error_reporting)
     {
 #ifndef TEST_HAS_NO_EXCEPTIONS
         try {
-            fs::read_symlink(f);
+            (void)fs::read_symlink(f);
             return false;
         } catch (filesystem_error const& err) {
             return err.path1() == f

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp
index 0c2727197f57..38ce958da501 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp
@@ -49,7 +49,7 @@ TEST_CASE(test_error_reporting)
     {
 #ifndef TEST_HAS_NO_EXCEPTIONS
         try {
-            space(f);
+            (void)space(f);
             return false;
         } catch (filesystem_error const& err) {
             return err.path1() == f


        


More information about the libcxx-commits mailing list