]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Fix some warnings in filesystem tests
authorJonathan Wakely <jwakely@redhat.com>
Thu, 5 Mar 2020 17:21:24 +0000 (17:21 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 5 Mar 2020 17:23:44 +0000 (17:23 +0000)
There's a -Wunused-but-set-variable warning in operations/all.cc which
can be fixed with [[maybe_unused]].

The statements in operations/copy.cc give -Wunused-value warnings. I
think I meant to use |= rather than !=.

And operations/file_size.cc gets -Wsign-compare warnings.

* testsuite/27_io/filesystem/operations/all.cc: Mark unused variable.
* testsuite/27_io/filesystem/operations/copy.cc: Fix typo.
* testsuite/experimental/filesystem/operations/copy.cc: Likewise.
* testsuite/27_io/filesystem/operations/file_size.cc: Use correct type
for return value, and in comparison.
* testsuite/experimental/filesystem/operations/file_size.cc: Likewise.

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/27_io/filesystem/operations/all.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/file_size.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/file_size.cc

index fd4d502badd6febb2ce4b3d7a9df5e89512979e4..8c94885ff2962e379cd795e73b1516be788904d6 100644 (file)
@@ -1,5 +1,12 @@
 2020-03-05  Jonathan Wakely  <jwakely@redhat.com>
 
+       * testsuite/27_io/filesystem/operations/all.cc: Mark unused variable.
+       * testsuite/27_io/filesystem/operations/copy.cc: Fix typo.
+       * testsuite/experimental/filesystem/operations/copy.cc: Likewise.
+       * testsuite/27_io/filesystem/operations/file_size.cc: Use correct type
+       for return value, and in comparison.
+       * testsuite/experimental/filesystem/operations/file_size.cc: Likewise.
+
        PR libstdc++/94051
        * include/std/string_view: Include <bits/ostream_insert.h>.
        * testsuite/21_strings/basic_string_view/inserters/94051.cc: New test.
index a53c777e5226c39f47cebd4f2a806aece741c794..982f8626cad4616369aba15dcdd0768fe2c4d223 100644 (file)
@@ -39,7 +39,7 @@ main()
   const std::filesystem::perm_options permopts{};
   std::filesystem::space_info sp;
   std::error_code ec;
-  bool b;
+  bool b [[maybe_unused]];
   std::uintmax_t size;
 
   std::filesystem::absolute(p);
index 69fa693fcb34af8cd8e2956b8a7733b8b43b9e53..f7aac8a302fa003e3f04c65f57f75b6529d0418b 100644 (file)
@@ -57,7 +57,7 @@ test01()
   VERIFY( !exists(to) );
 
   ec.clear();
-  opts != fs::copy_options::recursive;
+  opts |= fs::copy_options::recursive;
   fs::copy("/", to, opts, ec);
   VERIFY( ec == std::make_error_code(std::errc::is_a_directory) );
   VERIFY( !exists(to) );
index 4aa0ba1ec4308551848d2cca314c8bc57e932da6..fecd4fb2696c4198aad5d3fe850a6e4f7b993058 100644 (file)
@@ -29,9 +29,9 @@ void
 test01()
 {
   std::error_code ec;
-  size_t size = fs::file_size(".", ec);
+  auto size = fs::file_size(".", ec);
   VERIFY( ec == std::errc::is_a_directory );
-  VERIFY( size == -1 );
+  VERIFY( size == (std::uintmax_t)-1 );
 
   try {
     size = fs::file_size(".");
@@ -40,7 +40,7 @@ test01()
     ec = e.code();
   }
   VERIFY( ec == std::errc::is_a_directory );
-  VERIFY( size == -1 );
+  VERIFY( size == (std::uintmax_t)-1 );
 }
 
 void
@@ -49,9 +49,9 @@ test02()
   fs::path p = __gnu_test::nonexistent_path();
 
   std::error_code ec;
-  size_t size = fs::file_size(p, ec);
+  auto size = fs::file_size(p, ec);
   VERIFY( ec );
-  VERIFY( size == -1 );
+  VERIFY( size == (std::uintmax_t)-1 );
 
   try {
     size = fs::file_size(p);
@@ -60,7 +60,7 @@ test02()
     ec = e.code();
   }
   VERIFY( ec );
-  VERIFY( size == -1 );
+  VERIFY( size == (std::uintmax_t)-1 );
 }
 
 int
index e1bda0ffb6f4dc3f54f7670daf521baff01cbabf..e1e6d1dcc1510c53a9f4b49f8521c167e58500dd 100644 (file)
@@ -57,7 +57,7 @@ test01()
   VERIFY( !exists(to) );
 
   ec.clear();
-  opts != fs::copy_options::recursive;
+  opts |= fs::copy_options::recursive;
   fs::copy("/", to, opts, ec);
   VERIFY( ec == std::make_error_code(std::errc::is_a_directory) );
   VERIFY( !exists(to) );
index f609da7f395c5ac4f19bc7876178924b5eb8e5fb..ea4df63f55b4a60dc8f793b063898f5514cf16f7 100644 (file)
@@ -29,9 +29,9 @@ void
 test01()
 {
   std::error_code ec;
-  size_t size = fs::file_size(".", ec);
+  auto size = fs::file_size(".", ec);
   VERIFY( ec == std::errc::is_a_directory );
-  VERIFY( size == -1 );
+  VERIFY( size == (std::uintmax_t)-1 );
 
   try {
     size = fs::file_size(".");
@@ -40,7 +40,7 @@ test01()
     ec = e.code();
   }
   VERIFY( ec == std::errc::is_a_directory );
-  VERIFY( size == -1 );
+  VERIFY( size == (std::uintmax_t)-1 );
 }
 
 void
@@ -49,9 +49,9 @@ test02()
   fs::path p = __gnu_test::nonexistent_path();
 
   std::error_code ec;
-  size_t size = fs::file_size(p, ec);
+  auto size = fs::file_size(p, ec);
   VERIFY( ec );
-  VERIFY( size == -1 );
+  VERIFY( size == (std::uintmax_t)-1 );
 
   try {
     size = fs::file_size(p);
@@ -60,7 +60,7 @@ test02()
     ec = e.code();
   }
   VERIFY( ec );
-  VERIFY( size == -1 );
+  VERIFY( size == (std::uintmax_t)-1 );
 }
 
 int
This page took 0.075692 seconds and 5 git commands to generate.