]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix -Wunused-variable warning for -fno-exceptions build
authorJonathan Wakely <jwakely@redhat.com>
Wed, 2 Feb 2022 11:40:28 +0000 (11:40 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 2 Feb 2022 17:55:16 +0000 (17:55 +0000)
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.

libstdc++-v3/src/c++17/fs_dir.cc
libstdc++-v3/src/filesystem/dir.cc

index 149a8b0740cf82d8092c2cd25f9a6d93a9dbc65b..a77aabb6dcced367bb9aacc8f1e9f0ece583b545 100644 (file)
@@ -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)
index ac9e70da5168f620a95be71090c30601e6841553..7cf8e62b5e676259a6ff24f28b1a572dc1a0bbea 100644 (file)
@@ -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)