X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fmm%2Fboehm-gc%2Fgc_cpp.cc;h=40153cb8696a735a6c2fd9183de3325f380d9d28;hb=c9ee016a64e925938f84fcb85521f82febcc4f63;hp=f8b803a8baa42a1f59583e48cd7120866be31090;hpb=29c5375943f6b0d6c2e2f77c07c13ae04dae5565;p=cacao.git diff --git a/src/mm/boehm-gc/gc_cpp.cc b/src/mm/boehm-gc/gc_cpp.cc index f8b803a8b..40153cb86 100644 --- a/src/mm/boehm-gc/gc_cpp.cc +++ b/src/mm/boehm-gc/gc_cpp.cc @@ -1,15 +1,16 @@ -/************************************************************************* -Copyright (c) 1994 by Xerox Corporation. All rights reserved. - -THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED -OR IMPLIED. ANY USE IS AT YOUR OWN RISK. - - Last modified on Sat Nov 19 19:31:14 PST 1994 by ellis - on Sat Jun 8 15:10:00 PST 1994 by boehm - -Permission is hereby granted to copy this code for any purpose, -provided the above notices are retained on all copies. +/* + * Copyright (c) 1994 by Xerox Corporation. All rights reserved. + * + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Last modified on Sat Nov 19 19:31:14 PST 1994 by ellis + * + * Permission is hereby granted to copy this code for any purpose, + * provided the above notices are retained on all copies. + */ +/************************************************************************* This implementation module for gc_c++.h provides an implementation of the global operators "new" and "delete" that calls the Boehm allocator. All objects allocated by this implementation will be @@ -22,21 +23,28 @@ built-in "new" and "delete". Authors: John R. Ellis and Jesse Hull **************************************************************************/ -/* Boehm, December 20, 1994 7:26 pm PST */ + +# ifdef HAVE_CONFIG_H +# include "private/config.h" +# endif + +# ifndef GC_BUILD +# define GC_BUILD +# endif #include "gc_cpp.h" void* operator new( size_t size ) { return GC_MALLOC_UNCOLLECTABLE( size );} - + void operator delete( void* obj ) { GC_FREE( obj );} - + #ifdef GC_OPERATOR_NEW_ARRAY void* operator new[]( size_t size ) { return GC_MALLOC_UNCOLLECTABLE( size );} - + void operator delete[]( void* obj ) { GC_FREE( obj );} @@ -46,16 +54,23 @@ void operator delete[]( void* obj ) { // This new operator is used by VC++ in case of Debug builds ! void* operator new( size_t size, - int ,//nBlockUse, - const char * szFileName, - int nLine ) + int ,//nBlockUse, + const char * szFileName, + int nLine ) { #ifndef GC_DEBUG - return GC_malloc_uncollectable( size ); + return GC_malloc_uncollectable( size ); #else - return GC_debug_malloc_uncollectable(size, szFileName, nLine); + return GC_debug_malloc_uncollectable(size, szFileName, nLine); #endif } -#endif /* _MSC_VER */ +#if _MSC_VER > 1020 +// This new operator is used by VC++ 7.0 and later in Debug builds. +void* operator new[](size_t size, int nBlockUse, const char* szFileName, int nLine) +{ + return operator new(size, nBlockUse, szFileName, nLine); +} +#endif +#endif /* _MSC_VER */