From: Jonathan Wakely Date: Mon, 9 Jan 2017 13:06:03 +0000 (+0000) Subject: Define testsuite macro for correct thread_local destructors X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dc8bc65be398b32cee5dcec40edd9b4469a9680c;p=gcc.git 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 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 79b12ccab09..4111bae8342 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2017-01-09 Jonathan Wakely + + * 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 Aditya Kumar 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 3f6885d1942..cedb2abf2bf 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 #include #include +#include std::mutex mx; std::condition_variable cv; @@ -40,12 +41,12 @@ void func() { std::unique_lock 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 6baff15e695..6f064a41c85 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