[BACK]Return to gc_cpp.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / gc / include

Diff for /OpenXM_contrib2/asir2000/gc/include/gc_cpp.h between version 1.3 and 1.4

version 1.3, 2002/07/24 07:46:32 version 1.4, 2002/07/24 08:00:18
Line 83  Cautions:
Line 83  Cautions:
 1. Be sure the collector has been augmented with "make c++".  1. Be sure the collector has been augmented with "make c++".
   
 2.  If your compiler supports the new "operator new[]" syntax, then  2.  If your compiler supports the new "operator new[]" syntax, then
 add -DOPERATOR_NEW_ARRAY to the Makefile.  add -DGC_OPERATOR_NEW_ARRAY to the Makefile.
   
 If your compiler doesn't support "operator new[]", beware that an  If your compiler doesn't support "operator new[]", beware that an
 array of type T, where T is derived from "gc", may or may not be  array of type T, where T is derived from "gc", may or may not be
Line 137  by UseGC.  GC is an alias for UseGC, unless GC_NAME_CO
Line 137  by UseGC.  GC is an alias for UseGC, unless GC_NAME_CO
 #define _cdecl  #define _cdecl
 #endif  #endif
   
 #if ! defined( OPERATOR_NEW_ARRAY ) \  #if ! defined( GC_NO_OPERATOR_NEW_ARRAY ) \
     && (__BORLANDC__ >= 0x450 || (__GNUC__ >= 2 && __GNUC_MINOR__ >= 6) \      && !defined(_ENABLE_ARRAYNEW) /* Digimars */ \
         || __WATCOMC__ >= 1050 || _MSC_VER >= 1100)      && (defined(__BORLANDC__) && (__BORLANDC__ < 0x450) \
 #   define OPERATOR_NEW_ARRAY          || (defined(__GNUC__) && \
               (__GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 6)) \
           || (defined(__WATCOMC__) && __WATCOMC__ < 1050))
   #   define GC_NO_OPERATOR_NEW_ARRAY
 #endif  #endif
   
   #if !defined(GC_NO_OPERATOR_NEW_ARRAY) && !defined(GC_OPERATOR_NEW_ARRAY)
   #   define GC_OPERATOR_NEW_ARRAY
   #endif
   
 enum GCPlacement {UseGC,  enum GCPlacement {UseGC,
 #ifndef GC_NAME_CONFLICT  #ifndef GC_NAME_CONFLICT
                   GC=UseGC,                    GC=UseGC,
Line 152  enum GCPlacement {UseGC,
Line 159  enum GCPlacement {UseGC,
 class gc {public:  class gc {public:
     inline void* operator new( size_t size );      inline void* operator new( size_t size );
     inline void* operator new( size_t size, GCPlacement gcp );      inline void* operator new( size_t size, GCPlacement gcp );
       inline void* operator new( size_t size, void *p );
           /* Must be redefined here, since the other overloadings */
           /* hide the global definition.                          */
     inline void operator delete( void* obj );      inline void operator delete( void* obj );
       inline void operator delete( void*, void* );
   
 #ifdef OPERATOR_NEW_ARRAY  #ifdef GC_OPERATOR_NEW_ARRAY
     inline void* operator new[]( size_t size );      inline void* operator new[]( size_t size );
     inline void* operator new[]( size_t size, GCPlacement gcp );      inline void* operator new[]( size_t size, GCPlacement gcp );
       inline void* operator new[]( size_t size, void *p );
     inline void operator delete[]( void* obj );      inline void operator delete[]( void* obj );
 #endif /* OPERATOR_NEW_ARRAY */      inline void gc::operator delete[]( void*, void* );
   #endif /* GC_OPERATOR_NEW_ARRAY */
     };      };
     /*      /*
     Instances of classes derived from "gc" will be allocated in the      Instances of classes derived from "gc" will be allocated in the
Line 204  inline void* operator new( 
Line 217  inline void* operator new( 
     classes derived from "gc_cleanup" or containing members derived      classes derived from "gc_cleanup" or containing members derived
     from "gc_cleanup". */      from "gc_cleanup". */
   
 #ifdef OPERATOR_NEW_ARRAY  
   
 #ifdef _MSC_VER  #ifdef _MSC_VER
  /** This ensures that the system default operator new[] doesn't get   /** This ensures that the system default operator new[] doesn't get
Line 213  inline void* operator new( 
Line 225  inline void* operator new( 
   *  There seems to be really redirect new in this environment without    *  There seems to be really redirect new in this environment without
   *  including this everywhere.    *  including this everywhere.
   */    */
  inline void *operator new[]( size_t size )   void *operator new[]( size_t size );
  {  
     return GC_MALLOC_UNCOLLECTABLE( size );   void operator delete[](void* obj);
  }  
   
  inline void operator delete[](void* obj)   void* operator new( size_t size);
  {  
     GC_FREE(obj);  
  };  
   
  inline void* operator new( size_t size)   void operator delete(void* obj);
  {  
     return GC_MALLOC_UNCOLLECTABLE( size);  
  };  
   
  inline void operator delete(void* obj)   // This new operator is used by VC++ in case of Debug builds !
  {   void* operator new(  size_t size,
     GC_FREE(obj);  
  };  
   
   
 // This new operator is used by VC++ in case of Debug builds !  
   inline void* operator new( size_t size,  
                       int ,//nBlockUse,                        int ,//nBlockUse,
                       const char * szFileName,                        const char * szFileName,
                       int nLine                        int nLine );
                       ) {  
 # ifndef GC_DEBUG  
      return GC_malloc_uncollectable( size );  
 # else  
      return GC_debug_malloc_uncollectable(size, szFileName, nLine);  
 # endif  
   }  
   
 #endif /* _MSC_VER */  #endif /* _MSC_VER */
   
   
   #ifdef GC_OPERATOR_NEW_ARRAY
   
 inline void* operator new[](  inline void* operator new[](
     size_t size,      size_t size,
     GCPlacement gcp,      GCPlacement gcp,
Line 257  inline void* operator new[](
Line 251  inline void* operator new[](
     /*      /*
     The operator new for arrays, identical to the above. */      The operator new for arrays, identical to the above. */
   
 #endif /* OPERATOR_NEW_ARRAY */  #endif /* GC_OPERATOR_NEW_ARRAY */
   
 /****************************************************************************  /****************************************************************************
   
Line 276  inline void* gc::operator new( size_t size, GCPlacemen
Line 270  inline void* gc::operator new( size_t size, GCPlacemen
     else      else
         return GC_MALLOC_UNCOLLECTABLE( size );}          return GC_MALLOC_UNCOLLECTABLE( size );}
   
   inline void* gc::operator new( size_t size, void *p ) {
       return p;}
   
 inline void gc::operator delete( void* obj ) {  inline void gc::operator delete( void* obj ) {
     GC_FREE( obj );}      GC_FREE( obj );}
   
   inline void gc::operator delete( void*, void* ) {}
   
 #ifdef OPERATOR_NEW_ARRAY  #ifdef GC_OPERATOR_NEW_ARRAY
   
 inline void* gc::operator new[]( size_t size ) {  inline void* gc::operator new[]( size_t size ) {
     return gc::operator new( size );}      return gc::operator new( size );}
Line 288  inline void* gc::operator new[]( size_t size ) {
Line 286  inline void* gc::operator new[]( size_t size ) {
 inline void* gc::operator new[]( size_t size, GCPlacement gcp ) {  inline void* gc::operator new[]( size_t size, GCPlacement gcp ) {
     return gc::operator new( size, gcp );}      return gc::operator new( size, gcp );}
   
   inline void* gc::operator new[]( size_t size, void *p ) {
       return p;}
   
 inline void gc::operator delete[]( void* obj ) {  inline void gc::operator delete[]( void* obj ) {
     gc::operator delete( obj );}      gc::operator delete( obj );}
   
   inline void gc::operator delete[]( void*, void* ) {}
   
 #endif /* OPERATOR_NEW_ARRAY */  #endif /* GC_OPERATOR_NEW_ARRAY */
   
   
 inline gc_cleanup::~gc_cleanup() {  inline gc_cleanup::~gc_cleanup() {
Line 305  inline gc_cleanup::gc_cleanup() {
Line 308  inline gc_cleanup::gc_cleanup() {
     void* oldData;      void* oldData;
     void* base = GC_base( (void *) this );      void* base = GC_base( (void *) this );
     if (0 != base)  {      if (0 != base)  {
       GC_REGISTER_FINALIZER_IGNORE_SELF(        // Don't call the debug version, since this is a real base address.
         GC_register_finalizer_ignore_self(
         base, (GC_finalization_proc)cleanup, (void*) ((char*) this - (char*) base),          base, (GC_finalization_proc)cleanup, (void*) ((char*) this - (char*) base),
         &oldProc, &oldData );          &oldProc, &oldData );
       if (0 != oldProc) {        if (0 != oldProc) {
         GC_REGISTER_FINALIZER_IGNORE_SELF( base, oldProc, oldData, 0, 0 );}}}          GC_register_finalizer_ignore_self( base, oldProc, oldData, 0, 0 );}}}
   
 inline void* operator new(  inline void* operator new(
     size_t size,      size_t size,
Line 331  inline void* operator new( 
Line 335  inline void* operator new( 
     return obj;}      return obj;}
   
   
 #ifdef OPERATOR_NEW_ARRAY  #ifdef GC_OPERATOR_NEW_ARRAY
   
 inline void* operator new[](  inline void* operator new[](
     size_t size,      size_t size,
Line 341  inline void* operator new[]( 
Line 345  inline void* operator new[]( 
 {  {
     return ::operator new( size, gcp, cleanup, clientData );}      return ::operator new( size, gcp, cleanup, clientData );}
   
 #endif /* OPERATOR_NEW_ARRAY */  #endif /* GC_OPERATOR_NEW_ARRAY */
   
   
 #endif /* GC_CPP_H */  #endif /* GC_CPP_H */

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>