diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1997-11-20 23:17:48 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1997-11-20 18:17:48 -0500 |
commit | ced78d8b0c319de1c5f00bf0cc0972f317f43309 (patch) | |
tree | 8acaf8c513b3b690a0f58c9e47a4fb5b1c0154d0 /gcc/libgcc2.c | |
parent | a09ff88bb3edd56162937a3f98d4b0d5cac5c241 (diff) | |
download | gcc-ced78d8b0c319de1c5f00bf0cc0972f317f43309.zip gcc-ced78d8b0c319de1c5f00bf0cc0972f317f43309.tar.gz gcc-ced78d8b0c319de1c5f00bf0cc0972f317f43309.tar.bz2 |
Makefile.in (LIB2FUNCS): Remove C++ memory management support.
./: * Makefile.in (LIB2FUNCS): Remove C++ memory management support.
* libgcc2.c: Remove __builtin_new, __builtin_vec_new, set_new_handler,
__builtin_delete, and __builtin_vec_delete.
* except.c (output_exception_table): Don't bother with
__EXCEPTION_END__.
cp/:
* Make-lang.in (CXX_LIB2FUNCS): Add new op new and op delete objs.
(various.o): Likewise.
* inc/new: Add placement deletes. Add throw specs for default new.
* new.cc (set_new_handler): Move here from libgcc2.
* new1.cc (new (nothrow)): Catch a bad_alloc thrown from the handler.
(new): Move from libgcc2. Throw bad_alloc.
* new2.cc: Move the rest of the op news and op deletes from libgcc2.
* decl.c (init_decl_processing): Update exception specs on new and
delete.
From-SVN: r16617
Diffstat (limited to 'gcc/libgcc2.c')
-rw-r--r-- | gcc/libgcc2.c | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c index 6c34da7..7fec5cd 100644 --- a/gcc/libgcc2.c +++ b/gcc/libgcc2.c @@ -42,10 +42,6 @@ Boston, MA 02111-1307, USA. */ #undef abort #endif -#if (SUPPORTS_WEAK == 1) && (defined (ASM_OUTPUT_DEF) || defined (ASM_OUTPUT_WEAK_ALIAS)) -#define WEAK_ALIAS -#endif - /* Permit the tm.h file to select the endianness to use just for this file. This is used when the endianness is determined when the compiler is run. */ @@ -2436,157 +2432,6 @@ stack_overflow:; #endif /* not BLOCK_PROFILER_CODE */ #endif /* L_bb */ -/* Default free-store management functions for C++, per sections 12.5 and - 17.3.3 of the Working Paper. */ - -#ifdef L_op_new -/* operator new (size_t), described in 17.3.3.5. This function is used by - C++ programs to allocate a block of memory to hold a single object. */ - -typedef void (*vfp)(void); -extern vfp __new_handler; -extern void __default_new_handler (void); - -#ifdef WEAK_ALIAS -void * __builtin_new (size_t sz) - __attribute__ ((weak, alias ("___builtin_new"))); -void * -___builtin_new (size_t sz) -#else -void * -__builtin_new (size_t sz) -#endif -{ - void *p; - vfp handler = (__new_handler) ? __new_handler : __default_new_handler; - - /* malloc (0) is unpredictable; avoid it. */ - if (sz == 0) - sz = 1; - p = (void *) malloc (sz); - while (p == 0) - { - (*handler) (); - p = (void *) malloc (sz); - } - - return p; -} -#endif /* L_op_new */ - -#ifdef L_op_vnew -/* void * operator new [] (size_t), described in 17.3.3.6. This function - is used by C++ programs to allocate a block of memory for an array. */ - -extern void * __builtin_new (size_t); - -#ifdef WEAK_ALIAS -void * __builtin_vec_new (size_t sz) - __attribute__ ((weak, alias ("___builtin_vec_new"))); -void * -___builtin_vec_new (size_t sz) -#else -void * -__builtin_vec_new (size_t sz) -#endif -{ - return __builtin_new (sz); -} -#endif /* L_op_vnew */ - -#ifdef L_new_handler -/* set_new_handler (fvoid_t *) and the default new handler, described in - 17.3.3.2 and 17.3.3.5. These functions define the result of a failure - to allocate the amount of memory requested from operator new or new []. */ - -#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 */ - -typedef void (*vfp)(void); -void __default_new_handler (void); - -vfp __new_handler = (vfp) 0; - -vfp -set_new_handler (vfp handler) -{ - vfp prev_handler; - - prev_handler = __new_handler; - if (handler == 0) handler = __default_new_handler; - __new_handler = handler; - return prev_handler; -} - -#define MESSAGE "Virtual memory exceeded in `new'\n" - -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); -} -#endif - -#ifdef L_op_delete -/* operator delete (void *), described in 17.3.3.3. This function is used - by C++ programs to return to the free store a block of memory allocated - as a single object. */ - -#ifdef WEAK_ALIAS -void __builtin_delete (void *ptr) - __attribute__ ((weak, alias ("___builtin_delete"))); -void -___builtin_delete (void *ptr) -#else -void -__builtin_delete (void *ptr) -#endif -{ - if (ptr) - free (ptr); -} -#endif - -#ifdef L_op_vdel -/* operator delete [] (void *), described in 17.3.3.4. This function is - used by C++ programs to return to the free store a block of memory - allocated as an array. */ - -extern void __builtin_delete (void *); - -#ifdef WEAK_ALIAS -void __builtin_vec_delete (void *ptr) - __attribute__ ((weak, alias ("___builtin_vec_delete"))); -void -___builtin_vec_delete (void *ptr) -#else -void -__builtin_vec_delete (void *ptr) -#endif -{ - __builtin_delete (ptr); -} -#endif - -/* End of C++ free-store management functions */ - #ifdef L_shtab unsigned int __shtab[] = { 0x00000001, 0x00000002, 0x00000004, 0x00000008, |