* [patch] libstdc++/71004 fix recursive_directory_iterator default constructor
@ 2016-05-09 10:09 Jonathan Wakely
2016-05-09 11:50 ` Jonathan Wakely
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2016-05-09 10:09 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 177 bytes --]
This fixes some uninitialized members in the
filesystem::recursive_directory_iterator default constructor.
Tested x86_64-linux, committed to trunk. Backports to follow soon.
[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1736 bytes --]
commit 2b1c32ec504886625dae53274b14f86e2082a636
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon May 9 11:01:59 2016 +0100
libstdc++/71004 fix recursive_directory_iterator default constructor
PR libstdc++/71004
* include/experimental/bits/fs_dir.h (recursive_directory_iterator):
Initialize scalar member variables in default constructor.
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: Teste default construction.
diff --git a/libstdc++-v3/include/experimental/bits/fs_dir.h b/libstdc++-v3/include/experimental/bits/fs_dir.h
index 4e28c8e..f128cce 100644
--- a/libstdc++-v3/include/experimental/bits/fs_dir.h
+++ b/libstdc++-v3/include/experimental/bits/fs_dir.h
@@ -301,8 +301,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
struct _Dir_stack;
std::shared_ptr<_Dir_stack> _M_dirs;
- directory_options _M_options;
- bool _M_pending;
+ directory_options _M_options = {};
+ bool _M_pending = false;
};
inline recursive_directory_iterator
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
index 5d2e45b..a263602 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
@@ -97,6 +97,16 @@ test01()
remove_all(p, ec);
}
+void
+test02()
+{
+ // libstdc++71004
+ const fs::recursive_directory_iterator it;
+ assert( it.options() == fs::directory_options{} );
+ assert( it.depth() == 0 );
+ assert(it.recursion_pending() == false);
+}
+
int
main()
{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] libstdc++/71004 fix recursive_directory_iterator default constructor
2016-05-09 10:09 [patch] libstdc++/71004 fix recursive_directory_iterator default constructor Jonathan Wakely
@ 2016-05-09 11:50 ` Jonathan Wakely
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2016-05-09 11:50 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 400 bytes --]
On 09/05/16 11:09 +0100, Jonathan Wakely wrote:
>This fixes some uninitialized members in the
>filesystem::recursive_directory_iterator default constructor.
>
>Tested x86_64-linux, committed to trunk. Backports to follow soon.
Oops, I think I need more caffeine. The new function I added to the
test wasn't called, but would have crashed if it was.
Tested again x86_64-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1209 bytes --]
commit d0bf5c26f645baf1f568466d5bd48021293a806a
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon May 9 12:30:51 2016 +0100
libstdc++/71004 fix recent additions to testcase
PR libstdc++/71004
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: Fix test02 to not call member
functions on invalid iterator, and use VERIFY not assert.
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
index a263602..b5f71be 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
@@ -100,15 +100,16 @@ test01()
void
test02()
{
+ bool test __attribute__((unused)) = false;
+
// libstdc++71004
const fs::recursive_directory_iterator it;
- assert( it.options() == fs::directory_options{} );
- assert( it.depth() == 0 );
- assert(it.recursion_pending() == false);
+ VERIFY( it == fs::recursive_directory_iterator() );
}
int
main()
{
test01();
+ test02();
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-09 11:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 10:09 [patch] libstdc++/71004 fix recursive_directory_iterator default constructor Jonathan Wakely
2016-05-09 11:50 ` 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).