aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2017-01-09 13:06:03 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2017-01-09 13:06:03 +0000
commitdc8bc65be398b32cee5dcec40edd9b4469a9680c (patch)
tree134f59b6296f289943fb8108c3521a61be575fdc
parentcb627cdf5c0761f9e1be587a1416db9446a4801b (diff)
downloadgcc-dc8bc65be398b32cee5dcec40edd9b4469a9680c.zip
gcc-dc8bc65be398b32cee5dcec40edd9b4469a9680c.tar.gz
gcc-dc8bc65be398b32cee5dcec40edd9b4469a9680c.tar.bz2
Define testsuite macro for correct thread_local destructors
* testsuite/30_threads/condition_variable/members/3.cc: Use new macro to detect correct thread_local destructors. * testsuite/util/testsuite_hooks.h (CORRECT_THREAD_LOCAL_DTORS): Define. From-SVN: r244226
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc9
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_hooks.h6
3 files changed, 18 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 79b12cc..4111bae 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,4 +1,11 @@
2017-01-09 Jonathan Wakely <jwakely@redhat.com>
+
+ * testsuite/30_threads/condition_variable/members/3.cc: Use new macro
+ to detect correct thread_local destructors.
+ * testsuite/util/testsuite_hooks.h (CORRECT_THREAD_LOCAL_DTORS):
+ Define.
+
+2017-01-09 Jonathan Wakely <jwakely@redhat.com>
Aditya Kumar <hiraditya@msn.com>
PR libstdc++/66414
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc
index 3f6885d..cedb2ab 100644
--- a/libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc
+++ b/libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc
@@ -24,6 +24,7 @@
#include <condition_variable>
#include <thread>
#include <mutex>
+#include <testsuite_hooks.h>
std::mutex mx;
std::condition_variable cv;
@@ -40,12 +41,12 @@ void func()
{
std::unique_lock<std::mutex> lock{mx};
std::notify_all_at_thread_exit(cv, std::move(lock));
-#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
+#if CORRECT_THREAD_LOCAL_DTORS
// Correct order of thread_local destruction needs __cxa_thread_atexit_impl
- static thread_local Inc inc;
-#else
- Inc inc;
+ // or similar support from libc.
+ static thread_local
#endif
+ Inc inc;
}
int main()
diff --git a/libstdc++-v3/testsuite/util/testsuite_hooks.h b/libstdc++-v3/testsuite/util/testsuite_hooks.h
index 6baff15..6f064a4 100644
--- a/libstdc++-v3/testsuite/util/testsuite_hooks.h
+++ b/libstdc++-v3/testsuite/util/testsuite_hooks.h
@@ -81,6 +81,12 @@
# define THROW(X) noexcept(false)
#endif
+#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT || _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
+// Correct order of thread_local destruction needs __cxa_thread_atexit_impl
+// or similar support from libc.
+# define CORRECT_THREAD_LOCAL_DTORS 1
+#endif
+
namespace __gnu_test
{
// All macros are defined in GLIBCXX_CONFIGURE_TESTSUITE and imported