public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-3635] libstdc++: Fix testcase by using terminate handler
@ 2020-10-02 21:33 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2020-10-02 21:33 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:1ad08b64cea51d3cb989a1a176baeb8a18071231

commit r11-3635-g1ad08b64cea51d3cb989a1a176baeb8a18071231
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Oct 2 21:10:55 2020 +0100

    libstdc++: Fix testcase by using terminate handler
    
    This test was supposed to verify that when __libc_single_threaded is
    available we successfully detect recursive static initialization even
    when linked to libpthread. But I forgot to that when recursive init is
    detected, we terminate, and so the test fails.
    
    This adds a terminate handler that exits cleanly, so the test passes
    when recursive init is detected.
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/18_support/96817.cc: Use terminate handler that
            calls _Exit(0).

Diff:
---
 libstdc++-v3/testsuite/18_support/96817.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libstdc++-v3/testsuite/18_support/96817.cc b/libstdc++-v3/testsuite/18_support/96817.cc
index 4c4da40afa9..19399c473ef 100644
--- a/libstdc++-v3/testsuite/18_support/96817.cc
+++ b/libstdc++-v3/testsuite/18_support/96817.cc
@@ -21,6 +21,9 @@
 
 // PR libstdc++/96817
 
+#include <exception>
+#include <stdlib.h>
+
 int init()
 {
 #if __has_include(<sys/single_threaded.h>)
@@ -32,8 +35,11 @@ int init()
   return 0;
 }
 
+void clean_terminate() { _Exit(0); }
+
 int
 main (int argc, char **argv)
 {
+  std::set_terminate(clean_terminate);
   init();
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-02 21:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-02 21:33 [gcc r11-3635] libstdc++: Fix testcase by using terminate handler Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).