public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7005] libstdc++: Fix -Wunused-variable warning for -fno-exceptions build
@ 2022-02-02 20:20 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-02-02 20:20 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:2905e1af94519b7ba3c43a57af8a7d5e10815950

commit r12-7005-g2905e1af94519b7ba3c43a57af8a7d5e10815950
Author: Jonathan Wakely <jwakely@redhat.com>
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)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-02 20:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 20:20 [gcc r12-7005] libstdc++: Fix -Wunused-variable warning for -fno-exceptions build Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).