workaround for WRS T2.2 cygnus gnu compiler bugs

This commit is contained in:
Jeff Hill
2003-02-07 18:23:48 +00:00
parent 8345d76473
commit dedb6c25f4
2 changed files with 39 additions and 16 deletions

View File

@@ -87,12 +87,14 @@ comQueSend::comQueSend ( wireSendAdapter & wireIn,
{
}
comQueSend::~comQueSend () epicsThrows (())
comQueSend::~comQueSend ()
epicsThrows (())
{
this->clear ();
}
void comQueSend::clear () epicsThrows (())
void comQueSend::clear ()
epicsThrows (())
{
comBuf *pBuf;
@@ -105,7 +107,8 @@ void comQueSend::clear () epicsThrows (())
assert ( this->nBytesPending == 0 );
}
void comQueSend::clearUncommitted () epicsThrows (())
void comQueSend::clearUncommitted ()
epicsThrows (())
{
while ( this->pFirstUncommited.valid() ) {
tsDLIter < comBuf > next = this->pFirstUncommited;
@@ -299,7 +302,8 @@ void comQueSend::insertRequestWithPayLoad (
this->commitMsg ();
}
void comQueSend::commitMsg () epicsThrows (())
void comQueSend::commitMsg ()
epicsThrows (())
{
while ( this->pFirstUncommited.valid() ) {
this->nBytesPending += this->pFirstUncommited->uncommittedBytes ();
@@ -307,3 +311,6 @@ void comQueSend::commitMsg () epicsThrows (())
this->pFirstUncommited++;
}
}

View File

@@ -82,6 +82,11 @@ private:
tsDLIter < comBuf > pFirstUncommited;
wireSendAdapter & wire;
unsigned nBytesPending;
typedef void ( comQueSend::*copyFunc_t ) (
const void *pValue, unsigned nElem )
epicsThrows (( std::bad_alloc ));
static const copyFunc_t dbrCopyVector [39];
void copy_dbr_string ( const void *pValue, unsigned nElem )
epicsThrows (( std::bad_alloc ));
void copy_dbr_short ( const void *pValue, unsigned nElem )
@@ -94,12 +99,12 @@ private:
epicsThrows (( std::bad_alloc ));
void copy_dbr_double ( const void *pValue, unsigned nElem )
epicsThrows (( std::bad_alloc ));
void pushComBuf ( comBuf & ) epicsThrows (());
typedef void ( comQueSend::*copyFunc_t ) (
const void *pValue, unsigned nElem );
static const copyFunc_t dbrCopyVector [39];
void clearUncommitted () epicsThrows (());
void pushComBuf ( comBuf & )
epicsThrows (());
comBuf * newComBuf ()
epicsThrows (( std::bad_alloc ));
void clearUncommitted ()
epicsThrows (());
//
// visual C++ versions 6 & 7 do not allow out of
@@ -118,7 +123,7 @@ private:
nCopied = 0u;
}
while ( nElem > nCopied ) {
comBuf * pComBuf = new ( this->comBufMemMgr ) comBuf;
comBuf * pComBuf = newComBuf ();
unsigned nNew = pComBuf->push
( &pVal[nCopied], nElem - nCopied );
nCopied += nNew;
@@ -138,7 +143,7 @@ private:
if ( pComBuf && pComBuf->push ( val ) ) {
return;
}
pComBuf = new ( this->comBufMemMgr ) comBuf;
pComBuf = newComBuf ();
assert ( pComBuf->push ( val ) );
this->pushComBuf ( *pComBuf );
}
@@ -149,7 +154,8 @@ private:
extern const char cacNillBytes[];
inline bool comQueSend::dbr_type_ok ( unsigned type ) epicsThrows (())
inline bool comQueSend::dbr_type_ok ( unsigned type )
epicsThrows (())
{
if ( type >= ( sizeof ( this->dbrCopyVector ) / sizeof ( this->dbrCopyVector[0] ) ) ) {
return false;
@@ -184,7 +190,8 @@ inline void comQueSend::pushString ( const char *pVal, unsigned nChar )
this->push ( pVal, nChar );
}
inline void comQueSend::pushComBuf ( comBuf & cb ) epicsThrows (())
inline void comQueSend::pushComBuf ( comBuf & cb )
epicsThrows (())
{
this->bufs.add ( cb );
if ( ! this->pFirstUncommited.valid() ) {
@@ -192,7 +199,8 @@ inline void comQueSend::pushComBuf ( comBuf & cb ) epicsThrows (())
}
}
inline unsigned comQueSend::occupiedBytes () const epicsThrows (())
inline unsigned comQueSend::occupiedBytes () const
epicsThrows (())
{
return this->nBytesPending;
}
@@ -209,7 +217,8 @@ inline bool comQueSend::flushEarlyThreshold ( unsigned nBytesThisMsg )
return ( this->nBytesPending + nBytesThisMsg > 4 * comBuf::capacityBytes () );
}
inline void comQueSend::beginMsg () epicsThrows (())
inline void comQueSend::beginMsg ()
epicsThrows (())
{
if ( this->pFirstUncommited.valid() ) {
this->clearUncommitted ();
@@ -217,4 +226,11 @@ inline void comQueSend::beginMsg () epicsThrows (())
this->pFirstUncommited = this->bufs.lastIter ();
}
// wrapping this with a function avoids WRS T2.2 Cygnus GNU compiler bugs
inline comBuf * comQueSend::newComBuf ()
epicsThrows (( std::bad_alloc ))
{
return new ( this->comBufMemMgr ) comBuf;
}
#endif // ifndef comQueSendh