From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2136) id AEE1E396EC20; Wed, 17 Jun 2020 19:28:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AEE1E396EC20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592422081; bh=WfzzTPhmvu4PB3WpFND/LpspzD19FyBhMnokWoGjQhc=; h=From:To:Subject:Date:From; b=LQDX2pmvnPz0jOWuVbUorGmJjhkgnFxDcea2Fdb+o1fwYRBq72iHvhjQD+3bN9uFH PbaCQT7ME/xazUPVolrkinYrKgtSmDB1jPseaLT8BJykT/gLMCd4eDc2YH/dr8PmpW 7KorMzdjf+WkcS8/kps5pzqHbYu0qNx0JMbVPK98= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Aldy Hernandez To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc/devel/ranger] libstdc++: Fix some warnings in filesystem tests X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/devel/ranger X-Git-Oldrev: a5090de45af6c9c0f93306de4b6a4d3b56fccd94 X-Git-Newrev: 9412b35affa46a18f7e657fb449b449ac9a4a599 Message-Id: <20200617192801.AEE1E396EC20@sourceware.org> Date: Wed, 17 Jun 2020 19:28:01 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2020 19:28:01 -0000 https://gcc.gnu.org/g:9412b35affa46a18f7e657fb449b449ac9a4a599 commit 9412b35affa46a18f7e657fb449b449ac9a4a599 Author: Jonathan Wakely Date: Thu Mar 5 17:21:24 2020 +0000 libstdc++: Fix some warnings in filesystem tests 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. Diff: --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/testsuite/27_io/filesystem/operations/all.cc | 2 +- libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc | 2 +- .../testsuite/27_io/filesystem/operations/file_size.cc | 12 ++++++------ .../testsuite/experimental/filesystem/operations/copy.cc | 2 +- .../experimental/filesystem/operations/file_size.cc | 12 ++++++------ 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index fd4d502badd..8c94885ff29 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,12 @@ 2020-03-05 Jonathan Wakely + * 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 . * testsuite/21_strings/basic_string_view/inserters/94051.cc: New test. diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/all.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/all.cc index a53c777e522..982f8626cad 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/all.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/all.cc @@ -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); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc index 69fa693fcb3..f7aac8a302f 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc @@ -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) ); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/file_size.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/file_size.cc index 4aa0ba1ec43..fecd4fb2696 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/file_size.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/file_size.cc @@ -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 diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc index e1bda0ffb6f..e1e6d1dcc15 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc @@ -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) ); diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/file_size.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/file_size.cc index f609da7f395..ea4df63f55b 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/operations/file_size.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/file_size.cc @@ -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