From: Jonathan Wakely Date: Wed, 18 Apr 2018 11:15:38 +0000 (+0100) Subject: PR libstdc++/84442 if _Exit isn't declared then use _exit instead X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8cc8789fb4063eda4dcd5efd02a0b1cd255874c8;p=gcc.git 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 --- 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(); }