aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <merrill@gnu.org>1995-02-13 22:08:25 +0000
committerJason Merrill <merrill@gnu.org>1995-02-13 22:08:25 +0000
commit2c62c124a78fee391c2742578af8faf233ecbb4f (patch)
tree39a87a7060bcc2140853d1091a9f190799f9b658 /gcc
parentd01bc86269272c57aef10de19558881bfece420e (diff)
downloadgcc-2c62c124a78fee391c2742578af8faf233ecbb4f.zip
gcc-2c62c124a78fee391c2742578af8faf233ecbb4f.tar.gz
gcc-2c62c124a78fee391c2742578af8faf233ecbb4f.tar.bz2
Don't call write ifdef inhibit_libc.
From-SVN: r8941
Diffstat (limited to 'gcc')
-rw-r--r--gcc/libgcc2.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c
index 68f03ce..e5a1e09 100644
--- a/gcc/libgcc2.c
+++ b/gcc/libgcc2.c
@@ -1671,10 +1671,12 @@ set_new_handler (vfp handler)
void
__default_new_handler ()
{
+#ifndef inhibit_libc
/* don't use fprintf (stderr, ...) because it may need to call malloc. */
/* This should really print the name of the program, but that is hard to
do. We need a standard, clean way to get at the name. */
write (2, MESSAGE, sizeof (MESSAGE));
+#endif
/* don't call exit () because that may call global destructors which
may cause a loop. */
_exit (-1);
@@ -2276,11 +2278,26 @@ __unwind_function(void *ptr)
#endif /* L_eh */
#ifdef L_pure
+#ifndef inhibit_libc
+/* This gets us __GNU_LIBRARY__. */
+#undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch. */
+#include <stdio.h>
+
+#ifdef __GNU_LIBRARY__
+ /* Avoid forcing the library's meaning of `write' on the user program
+ by using the "internal" name (for use within the library) */
+#define write(fd, buf, n) __write((fd), (buf), (n))
+#endif
+#endif /* inhibit_libc */
+
#define MESSAGE "pure virtual method called\n"
+
void
__pure_virtual ()
{
+#ifndef inhibit_libc
write (2, MESSAGE, sizeof (MESSAGE) - 1);
+#endif
_exit (-1);
}
#endif