aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-04-18 12:15:38 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2018-04-18 12:15:38 +0100
commit8cc8789fb4063eda4dcd5efd02a0b1cd255874c8 (patch)
treea71da9212b07342bc0e9dbcffbcd37b20b0779f2 /libstdc++-v3
parent001ddaa852f8e18468e5a9356ba5d2eebb1f7f66 (diff)
downloadgcc-8cc8789fb4063eda4dcd5efd02a0b1cd255874c8.zip
gcc-8cc8789fb4063eda4dcd5efd02a0b1cd255874c8.tar.gz
gcc-8cc8789fb4063eda4dcd5efd02a0b1cd255874c8.tar.bz2
PR libstdc++/84442 if _Exit isn't declared then use _exit instead
PR libstdc++/84442 * testsuite/30_threads/thread/cons/terminate.cc [!_GLIBCXX_USE_C99_STDLIB] : Use _exit or std::exit instead of _Exit. From-SVN: r259463
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc11
2 files changed, 17 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index e407fc6..fb3abb9 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2018-04-18 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/84442
+ * testsuite/30_threads/thread/cons/terminate.cc
+ [!_GLIBCXX_USE_C99_STDLIB] : Use _exit or std::exit instead of _Exit.
+
2018-04-18 David Malcolm <dmalcolm@redhat.com>
PR jit/85384
diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc
index 63c3b08..cb6fc3e 100644
--- a/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc
+++ b/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc
@@ -25,10 +25,19 @@
#include <thread>
#include <exception>
#include <cstdlib>
+#if !_GLIBCXX_USE_C99_STDLIB && defined _GLIBCXX_HAVE_UNISTD_H
+# include <unistd.h>
+#endif
void handle_terminate()
{
+#if _GLIBCXX_USE_C99_STDLIB
std::_Exit(0);
+#elif defined _GLIBCXX_HAVE_UNISTD_H
+ _exit(0);
+#else
+ std::exit(0);
+#endif
}
void f() { throw 1; }
@@ -38,7 +47,9 @@ test01()
{
std::set_terminate(handle_terminate);
std::thread t(f);
+ // This should call the terminate handler and exit with zero status:
t.join();
+ // Should not reach here:
std::abort();
}