From 929ac4c62d71a854e78479e71b517e2426910ff0 Mon Sep 17 00:00:00 2001 From: redi Date: Wed, 18 Apr 2018 11:15:38 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259463 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e407fc66ea7..fb3abb90268 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2018-04-18 Jonathan Wakely + + 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 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 63c3b084c5c..cb6fc3eb120 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 #include #include +#if !_GLIBCXX_USE_C99_STDLIB && defined _GLIBCXX_HAVE_UNISTD_H +# include +#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(); } -- 2.11.4.GIT