diff --git a/src/ca/netIO.h b/src/ca/netIO.h index a88d1df1b..4be60afcd 100644 --- a/src/ca/netIO.h +++ b/src/ca/netIO.h @@ -25,10 +25,6 @@ # if _MSC_VER >= 1200 # define NETIO_PLACEMENT_DELETE # endif -#elif defined (__GNUC__) && 0 -# if __GNUC__>2 || ( __GNUC__==2 && __GNUC_MINOR_>=96 ) -# define NETIO_PLACEMENT_DELETE -# endif #else # define NETIO_PLACEMENT_DELETE #endif @@ -89,6 +85,8 @@ private: netSubscription ( nciu &chan, unsigned type, arrayElementCount count, unsigned mask, cacStateNotify ¬ify ); class netSubscription * isSubscription (); + void * operator new ( size_t ); + void operator delete ( void * ); void * operator new ( size_t, tsFreeList < class netSubscription, 1024, epicsMutexNOOP > & ); # if defined ( NETIO_PLACEMENT_DELETE ) @@ -98,12 +96,6 @@ private: netSubscription ( const netSubscription & ); netSubscription & operator = ( const netSubscription & ); ~netSubscription (); -# if defined (_MSC_VER) && _MSC_VER <= 1300 - void operator delete ( void * ); // avoid visual c++ 7 bug -# endif -# if __GNUC__==2 && __GNUC_MINOR_<=96 - void operator delete ( void *, size_t ); // avoid gnu g++ bug -# endif }; class netReadNotifyIO : public baseNMIU { @@ -122,6 +114,8 @@ public: private: cacReadNotify & notify; netReadNotifyIO ( nciu & chan, cacReadNotify & notify ); + void * operator new ( size_t ); + void operator delete ( void * ); void * operator new ( size_t, tsFreeList < class netReadNotifyIO, 1024, epicsMutexNOOP > & ); # if defined ( NETIO_PLACEMENT_DELETE ) @@ -131,12 +125,6 @@ private: ~netReadNotifyIO (); netReadNotifyIO ( const netReadNotifyIO & ); netReadNotifyIO & operator = ( const netReadNotifyIO & ); -# if defined (_MSC_VER) && _MSC_VER <= 1300 - void operator delete ( void * ); // avoid visual c++ 7 bug -# endif -# if __GNUC__==2 && __GNUC_MINOR_<=96 - void operator delete ( void *, size_t ); // avoid gnu g++ bug -# endif }; class netWriteNotifyIO : public baseNMIU { @@ -155,6 +143,8 @@ public: private: cacWriteNotify ¬ify; netWriteNotifyIO ( nciu &chan, cacWriteNotify ¬ify ); + void * operator new ( size_t ); + void operator delete ( void * ); void * operator new ( size_t, tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > & ); # if defined ( NETIO_PLACEMENT_DELETE ) @@ -164,12 +154,6 @@ private: netWriteNotifyIO ( const netWriteNotifyIO & ); netWriteNotifyIO & operator = ( const netWriteNotifyIO & ); ~netWriteNotifyIO (); -# if defined (_MSC_VER) && _MSC_VER <= 1300 - void operator delete ( void * ); // avoid visual c++ 7 bug -# endif -# if __GNUC__==2 && __GNUC_MINOR_<=96 - void operator delete ( void *, size_t ); // avoid gnu g++ bug -# endif }; inline ca_uint32_t baseNMIU::getID () const @@ -188,6 +172,24 @@ inline void * netSubscription::operator new ( size_t size, return freeList.allocate ( size ); } +#if defined ( NETIO_PLACEMENT_DELETE ) + inline void netSubscription::operator delete ( void *pCadaver, + tsFreeList < class netSubscription, 1024, epicsMutexNOOP > &freeList ) + { + freeList.release ( pCadaver, sizeof ( netSubscription ) ); + } +#endif + +inline void * netSubscription::operator new ( size_t sizeIn ) +{ + return ::operator new ( sizeIn ); +} + +inline void netSubscription::operator delete ( void * p ) +{ + ::operator delete ( p ); +} + inline netSubscription * netSubscription::factory ( tsFreeList < class netSubscription, 1024, epicsMutexNOOP > &freeList, nciu &chan, unsigned type, arrayElementCount count, @@ -231,6 +233,24 @@ inline void * netReadNotifyIO::operator new ( size_t size, return freeList.allocate ( size ); } +#if defined ( NETIO_PLACEMENT_DELETE ) + inline void netReadNotifyIO::operator delete ( void *pCadaver, + tsFreeList < class netReadNotifyIO, 1024, epicsMutexNOOP > &freeList ) + { + freeList.release ( pCadaver, sizeof ( netWriteNotifyIO ) ); + } +#endif + +inline void * netReadNotifyIO::operator new ( size_t sizeIn ) +{ + return ::operator new ( sizeIn ); +} + +inline void netReadNotifyIO::operator delete ( void * p ) +{ + ::operator delete ( p ); +} + inline netWriteNotifyIO * netWriteNotifyIO::factory ( tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > &freeList, nciu &chan, cacWriteNotify ¬ify ) @@ -244,4 +264,22 @@ inline void * netWriteNotifyIO::operator new ( size_t size, return freeList.allocate ( size ); } +#if defined ( NETIO_PLACEMENT_DELETE ) + inline void netWriteNotifyIO::operator delete ( void *pCadaver, + tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > &freeList ) + { + freeList.release ( pCadaver, sizeof ( netWriteNotifyIO ) ); + } +#endif + +inline void * netWriteNotifyIO::operator new ( size_t sizeIn ) +{ + return ::operator new ( sizeIn ); +} + +inline void netWriteNotifyIO::operator delete ( void * p ) +{ + ::operator delete ( p ); +} + #endif // ifdef netIOh diff --git a/src/ca/netReadNotifyIO.cpp b/src/ca/netReadNotifyIO.cpp index 852c1f053..db0b1045e 100644 --- a/src/ca/netReadNotifyIO.cpp +++ b/src/ca/netReadNotifyIO.cpp @@ -64,31 +64,3 @@ void netReadNotifyIO::completion ( unsigned type, this->notify.completion ( type, count, pData ); } -// NOTE: The constructor for netReadNotifyIO::netReadNotifyIO() currently does -// not throw an exception, but we should eventually have placement delete -// defined for class netReadNotifyIO when compilers support this so that -// there is no possibility of a leak if there was an exception in -// a future version of netReadNotifyIO::netReadNotifyIO() -#if defined ( NETIO_PLACEMENT_DELETE ) - void netReadNotifyIO::operator delete ( void *pCadaver, - tsFreeList < class netReadNotifyIO, 1024, epicsMutexNOOP > & freeList ) { - freeList.release ( pCadaver, sizeof ( netReadNotifyIO ) ); - } -#endif - -# if defined (_MSC_VER) && _MSC_VER <= 1300 - void netReadNotifyIO::operator delete ( void * ) // avoid visual c++ 7 bug - { - throw std::logic_error ( "bogus operator delete called?" ); - } -# endif - -# if __GNUC__==2 && __GNUC_MINOR_<=96 - void netReadNotifyIO::operator delete ( void *, size_t ) // avoid gnu g++ bug - { - throw std::logic_error ( "bogus operator delete called?" ); - } -# endif - - - diff --git a/src/ca/netSubscription.cpp b/src/ca/netSubscription.cpp index 22c2639e8..989e6a3eb 100644 --- a/src/ca/netSubscription.cpp +++ b/src/ca/netSubscription.cpp @@ -82,32 +82,8 @@ void netSubscription::completion ( unsigned typeIn, this->notify.current ( typeIn, countIn, pDataIn ); } -// NOTE: The constructor for netSubscription::netSubscription() currently does -// not throw an exception, but we should eventually have placement delete -// defined for class netSubscription when compilers support this so that -// there is no possibility of a leak if there was an exception in -// a future version of netSubscription::netSubscription() -#if defined ( NETIO_PLACEMENT_DELETE ) - void netSubscription::operator delete ( void *pCadaver, - tsFreeList < class netSubscription, 1024, epicsMutexNOOP > &freeList ) - { - freeList.release ( pCadaver, sizeof ( netSubscription ) ); - } -#endif - -# if defined (_MSC_VER) && _MSC_VER <= 1300 - void netSubscription::operator delete ( void * ) // avoid visual c++ 7 bug - { - throw std::logic_error ( "bogus operator delete called?" ); - } -# endif - -# if __GNUC__==2 && __GNUC_MINOR_<=96 - void netSubscription::operator delete ( void *, size_t ) // avoid gnu g++ bug - { - throw std::logic_error ( "bogus operator delete called?" ); - } -# endif + + diff --git a/src/ca/netWriteNotifyIO.cpp b/src/ca/netWriteNotifyIO.cpp index 01393a8d3..6eeca0f07 100644 --- a/src/ca/netWriteNotifyIO.cpp +++ b/src/ca/netWriteNotifyIO.cpp @@ -65,33 +65,3 @@ void netWriteNotifyIO::completion ( unsigned /* type */, this->chan.getClient().printf ( "Write response with data ?\n" ); } -// NOTE: The constructor for netWriteNotifyIO::netWriteNotifyIO() currently does -// not throw an exception, but we should eventually have placement delete -// defined for class netWriteNotifyIO when compilers support this so that -// there is no possibility of a leak if there was an exception in -// a future version of netWriteNotifyIO::netWriteNotifyIO() -#if defined ( NETIO_PLACEMENT_DELETE ) - void netWriteNotifyIO::operator delete ( void *pCadaver, - tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > &freeList ) - { - freeList.release ( pCadaver, sizeof ( netWriteNotifyIO ) ); - } -#endif - -# if defined (_MSC_VER) && _MSC_VER <= 1300 - void netWriteNotifyIO::operator delete ( void * ) // avoid visual c++ 7 bug - { - throw std::logic_error ( "bogus operator delete called?" ); - } -# endif - -# if __GNUC__==2 && __GNUC_MINOR_<=96 - void netWriteNotifyIO::operator delete ( void *, size_t ) // avoid gnu g++ bug - { - throw std::logic_error ( "bogus operator delete called?" ); - } -# endif - - - - diff --git a/src/ca/syncGroup.h b/src/ca/syncGroup.h index 1dcde7cba..0784781be 100644 --- a/src/ca/syncGroup.h +++ b/src/ca/syncGroup.h @@ -89,6 +89,8 @@ protected: private: void *pValue; syncGroupReadNotify ( struct CASG &sgIn, chid, void *pValueIn ); + void * operator new ( size_t ); + void operator delete ( void * ); void * operator new ( size_t, tsFreeList < class syncGroupReadNotify, 128, epicsMutexNOOP > & ); # if defined ( CASG_PLACEMENT_DELETE ) @@ -101,12 +103,6 @@ private: int status, const char *pContext, unsigned type, arrayElementCount count ); syncGroupReadNotify ( const syncGroupReadNotify & ); syncGroupReadNotify & operator = ( const syncGroupReadNotify & ); -# if defined (_MSC_VER) && _MSC_VER <= 1300 - void operator delete ( void * ); // avoid visual c++ 7 bug -# endif -# if __GNUC__==2 && __GNUC_MINOR_<=96 - void operator delete ( void *, size_t ); // avoid gnu g++ bug -# endif }; class syncGroupWriteNotify : public syncGroupNotify, public cacWriteNotify { @@ -123,6 +119,8 @@ protected: private: void *pValue; syncGroupWriteNotify ( struct CASG &, chid ); + void * operator new ( size_t ); + void operator delete ( void * ); void * operator new ( size_t, tsFreeList < class syncGroupWriteNotify, 128, epicsMutexNOOP > & ); # if defined ( CASG_PLACEMENT_DELETE ) @@ -134,12 +132,6 @@ private: unsigned type, arrayElementCount count ); syncGroupWriteNotify ( const syncGroupWriteNotify & ); syncGroupWriteNotify & operator = ( const syncGroupWriteNotify & ); -# if defined (_MSC_VER) && _MSC_VER <= 1300 - void operator delete ( void * ); // avoid visual c++ 7 bug -# endif -# if __GNUC__==2 && __GNUC_MINOR_<=96 - void operator delete ( void *, size_t ); // avoid gnu g++ bug -# endif }; struct oldCAC; diff --git a/src/ca/syncGroupReadNotify.cpp b/src/ca/syncGroupReadNotify.cpp index 5778b9b92..db781e943 100644 --- a/src/ca/syncGroupReadNotify.cpp +++ b/src/ca/syncGroupReadNotify.cpp @@ -104,6 +104,16 @@ void syncGroupReadNotify::show ( unsigned level ) const } } +void * syncGroupReadNotify::operator new ( size_t sizeIn ) +{ + return ::operator new ( sizeIn ); +} + +void syncGroupReadNotify::operator delete ( void * p ) +{ + ::operator delete ( p ); +} + void * syncGroupReadNotify::operator new ( size_t size, tsFreeList < class syncGroupReadNotify, 128, epicsMutexNOOP > & freeList ) { @@ -117,18 +127,3 @@ void syncGroupReadNotify::operator delete ( void *pCadaver, freeList.release ( pCadaver, sizeof ( syncGroupReadNotify ) ); } #endif - -# if defined (_MSC_VER) && _MSC_VER <= 1300 - void syncGroupReadNotify::operator delete ( void * ) // avoid visual c++ 7 bug - { - throw std::logic_error ( "bogus operator delete called?" ); - } -# endif - -# if __GNUC__==2 && __GNUC_MINOR_<=96 - void syncGroupReadNotify::operator delete ( void *, size_t ) // avoid gnu g++ bug - { - throw std::logic_error ( "bogus operator delete called?" ); - } -# endif - diff --git a/src/ca/syncGroupWriteNotify.cpp b/src/ca/syncGroupWriteNotify.cpp index bc4050be9..dbf4e1f29 100644 --- a/src/ca/syncGroupWriteNotify.cpp +++ b/src/ca/syncGroupWriteNotify.cpp @@ -99,6 +99,16 @@ void syncGroupWriteNotify::show ( unsigned level ) const } } +void * syncGroupWriteNotify::operator new ( size_t sizeIn ) +{ + return ::operator new ( sizeIn ); +} + +void syncGroupWriteNotify::operator delete ( void * p ) +{ + ::operator delete ( p ); +} + void * syncGroupWriteNotify::operator new ( size_t size, tsFreeList < class syncGroupWriteNotify, 128, epicsMutexNOOP > & freeList ) { @@ -113,17 +123,3 @@ void syncGroupWriteNotify::operator delete ( void *pCadaver, } #endif -# if defined (_MSC_VER) && _MSC_VER <= 1300 - void syncGroupWriteNotify::operator delete ( void * ) // avoid visual c++ 7 bug - { - throw std::logic_error ( "bogus operator delete called?" ); - } -# endif - -# if __GNUC__==2 && __GNUC_MINOR_<=96 - void syncGroupWriteNotify::operator delete ( void *, size_t ) // avoid gnu g++ bug - { - throw std::logic_error ( "bogus operator delete called?" ); - } -# endif -