diff options
author | Loren J. Rittle <ljrittle@acm.org> | 2001-06-08 03:55:43 +0000 |
---|---|---|
committer | Loren J. Rittle <ljrittle@gcc.gnu.org> | 2001-06-08 03:55:43 +0000 |
commit | 7628e178ef59d7f9daf52db48d29e9fc45e17136 (patch) | |
tree | 6239388e1090fcbfc9935d11c77afe9563d5707f | |
parent | 5e21803304ad8ecae564e1119508a45cc8705471 (diff) | |
download | gcc-7628e178ef59d7f9daf52db48d29e9fc45e17136.zip gcc-7628e178ef59d7f9daf52db48d29e9fc45e17136.tar.gz gcc-7628e178ef59d7f9daf52db48d29e9fc45e17136.tar.bz2 |
eh_alloc.cc: Ensure that required macros are defined before including gthr.h.
* libsupc++/eh_alloc.cc: Ensure that required macros are
defined before including gthr.h. Ensure that we get the
version of gthr.h for which we know how to provide a
configuration.
* libsupc++/eh_globals.cc: Likewise. And, bring the threading
code path into line with the current EH model. Use std, where
appropriate.
Co-Authored-By: John David Anglin <dave@hiauly1.hia.nrc.ca>
From-SVN: r42999
-rw-r--r-- | libstdc++-v3/ChangeLog | 11 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/eh_alloc.cc | 3 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/eh_globals.cc | 30 |
3 files changed, 27 insertions, 17 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5b8293a..724b5b9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,6 +1,17 @@ 2001-06-07 Loren J. Rittle <ljrittle@acm.org> John David Anglin <dave@hiauly1.hia.nrc.ca> + * libsupc++/eh_alloc.cc: Ensure that required macros are + defined before including gthr.h. Ensure that we get the + version of gthr.h for which we know how to provide a + configuration. + * libsupc++/eh_globals.cc: Likewise. And, bring the threading + code path into line with the current EH model. Use std, where + appropriate. + +2001-06-07 Loren J. Rittle <ljrittle@acm.org> + John David Anglin <dave@hiauly1.hia.nrc.ca> + * config/threads-no.h: Remove file. * config/threads-posix.h: Remove file. diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc index ee9f31c..8b55d6c 100644 --- a/libstdc++-v3/libsupc++/eh_alloc.cc +++ b/libstdc++-v3/libsupc++/eh_alloc.cc @@ -35,7 +35,8 @@ #include <cstring> #include <limits.h> #include "unwind-cxx.h" -#include "gthr.h" +#include "bits/c++config.h" +#include "bits/gthr.h" using namespace __cxxabiv1; diff --git a/libstdc++-v3/libsupc++/eh_globals.cc b/libstdc++-v3/libsupc++/eh_globals.cc index a247b84..3033619 100644 --- a/libstdc++-v3/libsupc++/eh_globals.cc +++ b/libstdc++-v3/libsupc++/eh_globals.cc @@ -29,8 +29,10 @@ #include <exception> +#include <cstdlib> #include "unwind-cxx.h" -#include "gthr.h" +#include "bits/c++config.h" +#include "bits/gthr.h" using namespace __cxxabiv1; @@ -47,7 +49,7 @@ get_globals_dtor (void *ptr) { __gthread_key_dtor (globals_key, ptr); if (ptr) - free (ptr); + std::free (ptr); } static void @@ -90,24 +92,20 @@ __cxa_get_globals () return &globals_static; if (use_thread_key < 0) - get_globals_init_once (); + { + get_globals_init_once (); + + // Make sure use_thread_key got initialized. + if (use_thread_key == 0) + return &globals_static; + } g = (__cxa_eh_globals *) __gthread_getspecific (globals_key); if (! g) { - static __gthread_once_t once = __GTHREAD_ONCE_INIT; - - // Make sure use_thread_key got initialized. Some systems have - // dummy thread routines in their libc that return a success. - if (__gthread_once (&once, eh_threads_initialize) != 0 - || use_thread_key < 0) - { - use_thread_key = 0; - return &globals_static; - } - - if ((g = malloc (sizeof (__cxa_eh_globals))) == 0 - || __gthread_setspecific (eh_context_key, (void *) g) != 0) + if ((g = (__cxa_eh_globals *) + std::malloc (sizeof (__cxa_eh_globals))) == 0 + || __gthread_setspecific (globals_key, (void *) g) != 0) std::terminate (); g->caughtExceptions = 0; g->uncaughtExceptions = 0; |