aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2004-02-23 19:17:06 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2004-02-23 19:17:06 +0000
commit6f94dea7854dac34ce80692eed3c9b24f8cb8912 (patch)
treeba397cf2f76dbc2bc4955ca1a4d8e247b2cf74d6
parente074089354dafda49a966490255cb60250b9ec12 (diff)
downloadgcc-6f94dea7854dac34ce80692eed3c9b24f8cb8912.zip
gcc-6f94dea7854dac34ce80692eed3c9b24f8cb8912.tar.gz
gcc-6f94dea7854dac34ce80692eed3c9b24f8cb8912.tar.bz2
vterminate.cc (__gnu_cxx::__verbose_terminate_handler): Only use fputs, not write.
2004-02-23 Benjamin Kosnik <bkoz@redhat.com> * libsupc++/vterminate.cc (__gnu_cxx::__verbose_terminate_handler): Only use fputs, not write. From-SVN: r78327
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/libsupc++/vterminate.cc44
2 files changed, 22 insertions, 27 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 932e20d..6e2dc6e 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,10 @@
2004-02-23 Benjamin Kosnik <bkoz@redhat.com>
+ * libsupc++/vterminate.cc (__gnu_cxx::__verbose_terminate_handler):
+ Only use fputs, not write.
+
+2004-02-23 Benjamin Kosnik <bkoz@redhat.com>
+
* include/ext/malloc_allocator.h: Add operators ==, !=.
* include/ext/new_allocator.h: Add operators ==, !=.
* include/ext/mt_allocator.h (__mt_alloc::tune): New.
diff --git a/libstdc++-v3/libsupc++/vterminate.cc b/libstdc++-v3/libsupc++/vterminate.cc
index 0ec9f2c..b53e9ce 100644
--- a/libstdc++-v3/libsupc++/vterminate.cc
+++ b/libstdc++-v3/libsupc++/vterminate.cc
@@ -1,6 +1,6 @@
// Verbose terminate_handler -*- C++ -*-
-// Copyright (C) 2001, 2002 Free Software Foundation
+// Copyright (C) 2001, 2002, 2004 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -32,76 +32,66 @@
#include <exception>
#include <exception_defines.h>
#include <cxxabi.h>
-
-#ifdef _GLIBCXX_HAVE_UNISTD_H
-# include <unistd.h>
-# define writestr(str) write(2, str, __builtin_strlen(str))
-#else
# include <cstdio>
-# define writestr(str) std::fputs(str, stderr)
-#endif
using namespace std;
using namespace abi;
namespace __gnu_cxx
{
- /* A replacement for the standard terminate_handler which prints
- more information about the terminating exception (if any) on
- stderr. */
+ // A replacement for the standard terminate_handler which prints
+ // more information about the terminating exception (if any) on
+ // stderr.
void __verbose_terminate_handler()
{
static bool terminating;
-
if (terminating)
{
- writestr ("terminate called recursively\n");
+ fputs("terminate called recursively\n", stderr);
abort ();
}
-
- terminating = true;
+ terminating = true;
// Make sure there was an exception; terminate is also called for an
// attempt to rethrow when there is no suitable exception.
type_info *t = __cxa_current_exception_type();
if (t)
{
- char const *name = t->name();
// Note that "name" is the mangled name.
-
+ char const *name = t->name();
{
int status = -1;
char *dem = 0;
dem = __cxa_demangle(name, 0, 0, &status);
- writestr("terminate called after throwing an instance of '");
+ fputs("terminate called after throwing an instance of '", stderr);
if (status == 0)
- writestr(dem);
+ fputs(dem, stderr);
else
- writestr(name);
- writestr("'\n");
+ fputs(name, stderr);
+ fputs("'\n", stderr);
if (status == 0)
free(dem);
}
- // If the exception is derived from std::exception, we can give more
- // information.
+ // If the exception is derived from std::exception, we can
+ // give more information.
try { __throw_exception_again; }
#ifdef __EXCEPTIONS
catch (exception &exc)
{
char const *w = exc.what();
- writestr(" what(): ");
- writestr(w);
- writestr("\n");
+ fputs(" what(): ", stderr);
+ fputs(w, stderr);
+ fputs("\n", stderr);
}
#endif
catch (...) { }
}
else
- writestr("terminate called without an active exception\n");
+ fputs("terminate called without an active exception\n", stderr);
abort();
}