upgraded compiler specific macros

This commit is contained in:
Jeff Hill
2002-10-30 17:19:26 +00:00
parent f0b5bbf467
commit 0dce06f4cf
8 changed files with 51 additions and 52 deletions

View File

@@ -42,33 +42,33 @@ public:
// inline func def required by visual c++ 7
class reference {
public:
reference ( TYPE & tIn ) epics_throws (()) :
reference ( TYPE & tIn ) epicsThrows (()) :
instance ( tIn )
{
}
~reference () epics_throws (())
~reference () epicsThrows (())
{
}
TYPE * operator -> () epics_throws (())
TYPE * operator -> () epicsThrows (())
{
return & this->instance;
}
const TYPE * operator -> () const epics_throws (())
const TYPE * operator -> () const epicsThrows (())
{
typename epicsSingleton<TYPE>::reference & ref =
const_cast < typename epicsSingleton<TYPE>::reference & > ( *this );
return ref.operator -> ();
}
TYPE & operator * () epics_throws (())
TYPE & operator * () epicsThrows (())
{
return * this->operator -> ();
}
const TYPE & operator * () const epics_throws (())
const TYPE & operator * () const epicsThrows (())
{
return * this->operator -> ();
}

View File

@@ -86,21 +86,21 @@ template < class T, unsigned N = 0x400,
class tsFreeList {
public:
tsFreeList ()
epics_throws (());
epicsThrows (());
~tsFreeList ()
epics_throws (());
epicsThrows (());
void * allocate ( size_t size )
epics_throws (( std::bad_alloc ));
epicsThrows (( std::bad_alloc ));
void release ( void * p )
epics_throws (());
epicsThrows (());
void release ( void * p, size_t size )
epics_throws (());
epicsThrows (());
private:
MUTEX mutex;
tsFreeListItem < T > * pFreeList;
tsFreeListChunk < T, N > * pChunkList;
void * allocateFromNewChunk ()
epics_throws (( std::bad_alloc ));
epicsThrows (( std::bad_alloc ));
};
template < class T >
@@ -118,10 +118,10 @@ struct tsFreeListChunk {
template < class T, unsigned N, class MUTEX >
inline tsFreeList < T, N, MUTEX > :: tsFreeList ()
epics_throws (()) : pFreeList ( 0 ), pChunkList ( 0 ) {}
epicsThrows (()) : pFreeList ( 0 ), pChunkList ( 0 ) {}
template < class T, unsigned N, class MUTEX >
tsFreeList < T, N, MUTEX > :: ~tsFreeList () epics_throws (())
tsFreeList < T, N, MUTEX > :: ~tsFreeList () epicsThrows (())
{
while ( tsFreeListChunk < T, N > *pChunk = this->pChunkList ) {
this->pChunkList = this->pChunkList->pNext;
@@ -131,7 +131,7 @@ tsFreeList < T, N, MUTEX > :: ~tsFreeList () epics_throws (())
template < class T, unsigned N, class MUTEX >
void * tsFreeList < T, N, MUTEX >::allocate ( size_t size )
epics_throws (( std::bad_alloc ))
epicsThrows (( std::bad_alloc ))
{
if ( size != sizeof ( T ) || N == 0u || tsFreeListDebugBypass ) {
void * p = ::operator new ( size );
@@ -151,7 +151,7 @@ void * tsFreeList < T, N, MUTEX >::allocate ( size_t size )
template < class T, unsigned N, class MUTEX >
void * tsFreeList < T, N, MUTEX >::allocateFromNewChunk ()
epics_throws (( std::bad_alloc ))
epicsThrows (( std::bad_alloc ))
{
tsFreeListChunk < T, N > * pChunk =
new tsFreeListChunk < T, N >;
@@ -171,7 +171,7 @@ void * tsFreeList < T, N, MUTEX >::allocateFromNewChunk ()
template < class T, unsigned N, class MUTEX >
void tsFreeList < T, N, MUTEX >::release ( void * pCadaver, size_t size )
epics_throws (())
epicsThrows (())
{
if ( size != sizeof ( T ) ) {
tsFreeListMemSetDelete ( pCadaver, size );
@@ -184,7 +184,7 @@ void tsFreeList < T, N, MUTEX >::release ( void * pCadaver, size_t size )
template < class T, unsigned N, class MUTEX >
void tsFreeList < T, N, MUTEX >::release ( void * pCadaver )
epics_throws (())
epicsThrows (())
{
if ( N == 0u || tsFreeListDebugBypass ) {
tsFreeListMemSetDelete ( pCadaver, sizeof ( T ) );

View File

@@ -52,11 +52,18 @@
# define CXX_THROW_SPECIFICATION
#endif
// usage: void func () epics_throws (( std::bad_alloc, std::logic_error ))
// usage: void func () epicsThrows (( std::bad_alloc, std::logic_error ))
#if defined ( CXX_THROW_SPECIFICATION )
# define epics_throws(X) throw X
# define epicsThrows(X) throw X
#else
# define epics_throws(X)
# define epicsThrows(X)
#endif
// usage: epicsPlacementDeleteOperator (( void *, myMemoryManager & ))
#if defined ( CXX_PLACEMENT_DELETE )
# define epicsPlacementDeleteOperator(X) void operator delete X epicsThrows ();
#else
# define epicsPlacementDeleteOperator(X)
#endif
#endif // ifndef cxxCompilerDependencies_h

View File

@@ -127,7 +127,7 @@ void epicsShareAPI epicsMutexShowAll(int onlyLocked,unsigned int level)
epicsMutexUnlock(epicsMutexGlobalLock);
}
epicsMutex :: epicsMutex () epics_throws (( epicsMutex::mutexCreateFailed )) :
epicsMutex :: epicsMutex () epicsThrows (( epicsMutex::mutexCreateFailed )) :
id ( epicsMutexCreate () )
{
if ( this->id == 0 ) {
@@ -136,13 +136,13 @@ epicsMutex :: epicsMutex () epics_throws (( epicsMutex::mutexCreateFailed )) :
}
epicsMutex ::~epicsMutex ()
epics_throws (())
epicsThrows (())
{
epicsMutexDestroy ( this->id );
}
void epicsMutex::lock ()
epics_throws (( epicsMutex::invalidMutex ))
epicsThrows (( epicsMutex::invalidMutex ))
{
epicsMutexLockStatus status = epicsMutexLock ( this->id );
if ( status != epicsMutexLockOK ) {
@@ -151,7 +151,7 @@ void epicsMutex::lock ()
}
bool epicsMutex::lock ( double timeOut ) // X aCC 361
epics_throws (( epicsMutex::invalidMutex ))
epicsThrows (( epicsMutex::invalidMutex ))
{
epicsMutexLockStatus status = epicsMutexLockWithTimeout ( this->id, timeOut );
if ( status == epicsMutexLockOK ) {
@@ -167,7 +167,7 @@ bool epicsMutex::lock ( double timeOut ) // X aCC 361
}
bool epicsMutex::tryLock () // X aCC 361
epics_throws (( epicsMutex::invalidMutex ))
epicsThrows (( epicsMutex::invalidMutex ))
{
epicsMutexLockStatus status = epicsMutexTryLock ( this->id );
if ( status == epicsMutexLockOK ) {
@@ -183,13 +183,13 @@ bool epicsMutex::tryLock () // X aCC 361
}
void epicsMutex::unlock ()
epics_throws (())
epicsThrows (())
{
epicsMutexUnlock ( this->id );
}
void epicsMutex :: show ( unsigned level ) const
epics_throws (())
epicsThrows (())
{
epicsMutexShow ( this->id, level );
}

View File

@@ -28,19 +28,19 @@ public:
class mutexCreateFailed {}; // exception
class invalidMutex {}; // exception
epicsMutex ()
epics_throws (( mutexCreateFailed ));
epicsThrows (( mutexCreateFailed ));
~epicsMutex ()
epics_throws (());
epicsThrows (());
void show ( unsigned level ) const
epics_throws (());
epicsThrows (());
void lock () /* blocks until success */
epics_throws (( invalidMutex ));
epicsThrows (( invalidMutex ));
void unlock ()
epics_throws (());
epicsThrows (());
bool lock ( double timeOut ) /* true if successful */
epics_throws (( invalidMutex ));
epicsThrows (( invalidMutex ));
bool tryLock () /* true if successful */
epics_throws (( invalidMutex ));
epicsThrows (( invalidMutex ));
private:
epicsMutexId id;
epicsMutex ( const epicsMutex & );

View File

@@ -39,7 +39,7 @@ epicsTimerNotify::~epicsTimerNotify () {}
void epicsTimerNotify::show ( unsigned /* level */ ) const {}
epicsTimerForC::epicsTimerForC ( timerQueue &queue, epicsTimerCallback pCBIn, void *pPrivateIn ) epics_throws (()) :
epicsTimerForC::epicsTimerForC ( timerQueue &queue, epicsTimerCallback pCBIn, void *pPrivateIn ) epicsThrows (()) :
timer ( queue ), pCallBack ( pCBIn ), pPrivate ( pPrivateIn )
{
}
@@ -52,11 +52,7 @@ void epicsTimerForC::destroy ()
{
timerQueue & queueTmp ( this->queue );
this->~epicsTimerForC ();
# ifdef CXX_PLACEMENT_DELETE
epicsTimerForC::operator delete ( this, queueTmp.timerForCFreeList );
# else
queueTmp.timerForCFreeList.release ( this );
# endif
queueTmp.timerForCFreeList.release ( this );
}
epicsTimerNotify::expireStatus epicsTimerForC::expire ( const epicsTime & )
@@ -74,7 +70,7 @@ epicsTimerQueueActiveForC::~epicsTimerQueueActiveForC ()
{
}
void epicsTimerQueueActiveForC::release () epics_throws (())
void epicsTimerQueueActiveForC::release () epicsThrows (())
{
epicsSingleton < timerQueueActiveMgr >::reference pMgr =
timerQueueMgrEPICS;

View File

@@ -35,7 +35,7 @@ template class tsFreeList < timer, 0x20 >;
# pragma warning ( pop )
#endif
timer::timer ( timerQueue & queueIn ) epics_throws (()):
timer::timer ( timerQueue & queueIn ) epicsThrows (()):
queue ( queueIn ), curState ( stateLimbo ), pNotify ( 0 )
{
}

View File

@@ -41,11 +41,9 @@ public:
expireInfo getExpireInfo () const;
void show ( unsigned int level ) const;
void * operator new ( size_t size, tsFreeList < timer, 0x20 > & );
#ifdef CXX_PLACEMENT_DELETE
void operator delete ( void *, tsFreeList < timer, 0x20 > & );
#endif
epicsPlacementDeleteOperator (( void *, tsFreeList < timer, 0x20 > & ))
protected:
timer ( class timerQueue & ) epics_throws (());
timer ( class timerQueue & ) epicsThrows (());
~timer ();
timerQueue & queue;
private:
@@ -69,12 +67,10 @@ struct epicsTimerForC : public epicsTimerNotify, public timer {
public:
void destroy ();
protected:
epicsTimerForC ( timerQueue &, epicsTimerCallback, void *pPrivateIn ) epics_throws (());
epicsTimerForC ( timerQueue &, epicsTimerCallback, void *pPrivateIn ) epicsThrows (());
~epicsTimerForC ();
void * operator new ( size_t size, tsFreeList < epicsTimerForC, 0x20 > & );
#ifdef CXX_PLACEMENT_DELETE
void operator delete ( void *, tsFreeList < epicsTimerForC, 0x20 > & );
#endif
epicsPlacementDeleteOperator (( void *, tsFreeList < epicsTimerForC, 0x20 > & ))
private:
epicsTimerCallback pCallBack;
void * pPrivate;
@@ -199,7 +195,7 @@ struct epicsTimerQueueActiveForC : public timerQueueActive,
public tsDLNode < epicsTimerQueueActiveForC > {
public:
epicsTimerQueueActiveForC ( bool okToShare, unsigned priority );
void release () epics_throws (());
void release () epicsThrows (());
void * operator new ( size_t );
void operator delete ( void * );
protected: