From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 57B333858D37; Wed, 2 Feb 2022 20:20:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 57B333858D37 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-7005] libstdc++: Fix -Wunused-variable warning for -fno-exceptions build X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: c123096cf14ac87875bba51279e46cceeb18faa1 X-Git-Newrev: 2905e1af94519b7ba3c43a57af8a7d5e10815950 Message-Id: <20220202202023.57B333858D37@sourceware.org> Date: Wed, 2 Feb 2022 20:20:23 +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, 02 Feb 2022 20:20:23 -0000 https://gcc.gnu.org/g:2905e1af94519b7ba3c43a57af8a7d5e10815950 commit r12-7005-g2905e1af94519b7ba3c43a57af8a7d5e10815950 Author: Jonathan Wakely Date: Wed Feb 2 11:40:28 2022 +0000 libstdc++: Fix -Wunused-variable warning for -fno-exceptions build If _GLIBCXX_THROW_OR_ABORT expands to just __builtin_abort() then the bool variable used in the filesystem_error constructor is unused. Mark it as maybe_unused to there's no warning for -fno-exceptions builds. libstdc++-v3/ChangeLog: * src/c++17/fs_dir.cc (fs::recursive_directory_iterator::pop): Add [[maybe_unused]] attribute. * src/filesystem/dir.cc (fs::recursive_directory_iterator::pop): Likewise. Diff: --- libstdc++-v3/src/c++17/fs_dir.cc | 2 +- libstdc++-v3/src/filesystem/dir.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/src/c++17/fs_dir.cc b/libstdc++-v3/src/c++17/fs_dir.cc index 149a8b0740c..a77aabb6dcc 100644 --- a/libstdc++-v3/src/c++17/fs_dir.cc +++ b/libstdc++-v3/src/c++17/fs_dir.cc @@ -347,7 +347,7 @@ fs::recursive_directory_iterator::pop(error_code& ec) void fs::recursive_directory_iterator::pop() { - const bool dereferenceable = _M_dirs != nullptr; + [[maybe_unused]] const bool dereferenceable = _M_dirs != nullptr; error_code ec; pop(ec); if (ec) diff --git a/libstdc++-v3/src/filesystem/dir.cc b/libstdc++-v3/src/filesystem/dir.cc index ac9e70da516..7cf8e62b5e6 100644 --- a/libstdc++-v3/src/filesystem/dir.cc +++ b/libstdc++-v3/src/filesystem/dir.cc @@ -334,7 +334,7 @@ fs::recursive_directory_iterator::pop(error_code& ec) void fs::recursive_directory_iterator::pop() { - const bool dereferenceable = _M_dirs != nullptr; + [[maybe_unused]] const bool dereferenceable = _M_dirs != nullptr; error_code ec; pop(ec); if (ec)