From d0c26b575e34d7e8e08896a847d418ebe24e0422 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 10 Jan 1997 21:18:56 +0000 Subject: [PATCH] code around gnu g++ inline bug when -O isnt used --- src/cas/generic/casDGClient.cc | 5 +-- src/cas/generic/casInternal.h | 17 +++++++++-- src/cas/generic/casOpaqueAddr.cc | 30 +++++++++++++----- src/cas/generic/casOpaqueAddrIL.h | 16 ---------- src/cas/generic/casPVListChan.cc | 17 +++++++++++ src/cas/generic/casPVListChanIL.h | 15 ++++----- src/cas/generic/dgInBuf.cc | 23 ++++++++++++++ src/cas/generic/dgInBufIL.h | 16 ---------- src/cas/generic/dgOutBuf.cc | 47 +++++++++++++++++++++++++++++ src/cas/generic/dgOutBufIL.h | 32 ++------------------ src/cas/generic/inBufIL.h | 8 ++--- src/cas/generic/server.h | 21 ++++++++----- src/cas/io/bsdSocket/casDGIntfIO.cc | 17 +++++++++++ src/cas/io/bsdSocket/casIOD.h | 5 ++- src/cas/io/bsdSocket/casIODIL.h | 14 ++------- 15 files changed, 177 insertions(+), 106 deletions(-) diff --git a/src/cas/generic/casDGClient.cc b/src/cas/generic/casDGClient.cc index 10fb299b4..57a8c315c 100644 --- a/src/cas/generic/casDGClient.cc +++ b/src/cas/generic/casDGClient.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.7 1996/11/02 00:54:08 jhill + * many improvements + * * Revision 1.6 1996/09/16 18:24:00 jhill * vxWorks port changes * @@ -56,8 +59,6 @@ #include // dgOutBuf inline func #include // dgInBuf inline func #include // casCtx inline func -#include // inBuf inline func -#include // outBuf inline func #include // casCoreClient inline func #include diff --git a/src/cas/generic/casInternal.h b/src/cas/generic/casInternal.h index c5691ba31..f8f396833 100644 --- a/src/cas/generic/casInternal.h +++ b/src/cas/generic/casInternal.h @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.9 1996/12/06 22:33:49 jhill + * virtual ~casPVI(), ~casPVListChan(), ~casChannelI() + * * Revision 1.8 1996/11/02 00:54:14 jhill * many improvements * @@ -364,8 +367,16 @@ union ca_addr; class casOpaqueAddr { public: - inline casOpaqueAddr(); - inline void clear(); + // + // casOpaqueAddr() + // + casOpaqueAddr(); + + // + // clear() + // + void clear(); + inline int hasBeenInitialized() const; inline casOpaqueAddr (const union ca_addr &addr); inline void set (const union ca_addr &); @@ -494,7 +505,7 @@ protected: class casPVListChan : public casChannelI, public tsDLNode { public: - inline casPVListChan (const casCtx &ctx, casChannel &chanAdapter); + casPVListChan (const casCtx &ctx, casChannel &chanAdapter); virtual ~casPVListChan(); }; diff --git a/src/cas/generic/casOpaqueAddr.cc b/src/cas/generic/casOpaqueAddr.cc index 12ea0e60f..1af1811fa 100644 --- a/src/cas/generic/casOpaqueAddr.cc +++ b/src/cas/generic/casOpaqueAddr.cc @@ -1,12 +1,28 @@ -#include -#include <> +#include - -casOpaqueAddr::checkSize sizeChecker; - -checkSize::checkSize() +// +// this needs to be here (and not in casOpaqueAddrIL.h) if we +// are to avoid undefined symbols under gcc 2.7.x without -O +// +// +// casOpaqueAddr::casOpaqueAddr() +// +casOpaqueAddr::casOpaqueAddr() { - assert( sizeof(casOpaqueAddr::opaqueAddr) >= sizeof(caAddr)); + this->clear(); } +// +// this needs to be here (and not in casOpaqueAddrIL.h) if we +// are to avoid undefined symbols under gcc 2.7.x without -O +// +// +// casOpaqueAddr::clear() +// +void casOpaqueAddr::clear() +{ + this->init = 0; +} + + diff --git a/src/cas/generic/casOpaqueAddrIL.h b/src/cas/generic/casOpaqueAddrIL.h index d20895f9a..23e5a1df2 100644 --- a/src/cas/generic/casOpaqueAddrIL.h +++ b/src/cas/generic/casOpaqueAddrIL.h @@ -2,22 +2,6 @@ #ifndef casOpaqueAddrILh #define casOpaqueAddrILh -// -// casOpaqueAddr::clear() -// -inline void casOpaqueAddr::clear() -{ - this->init = 0; -} - -// -// casOpaqueAddr::casOpaqueAddr() -// -inline casOpaqueAddr::casOpaqueAddr() -{ - this->clear(); -} - // // casOpaqueAddr::hasBeenInitialized() // diff --git a/src/cas/generic/casPVListChan.cc b/src/cas/generic/casPVListChan.cc index a9b170c37..0f5d7de27 100644 --- a/src/cas/generic/casPVListChan.cc +++ b/src/cas/generic/casPVListChan.cc @@ -30,6 +30,9 @@ * * History * $Log$ + * Revision 1.1 1996/12/06 22:36:18 jhill + * use destroyInProgress flag now functional nativeCount() + * * * */ @@ -37,6 +40,20 @@ #include #include +// +// this needs to be here (and not in dgInBufIL.h) if we +// are to avoid undefined symbols under gcc 2.7.x with -g +// +// +// casPVListChan::casPVListChan() +// +casPVListChan::casPVListChan + (const casCtx &ctx, casChannel &chanAdapterIn) : + casChannelI(ctx, chanAdapterIn) +{ + this->pv.installChannel(*this); +} + // // casPVListChan::~casPVListChan() // diff --git a/src/cas/generic/casPVListChanIL.h b/src/cas/generic/casPVListChanIL.h index e40c2ab05..161d46b0f 100644 --- a/src/cas/generic/casPVListChanIL.h +++ b/src/cas/generic/casPVListChanIL.h @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.3 1997/01/09 22:29:17 jhill + * installed hostBuild branch + * * Revision 1.2 1996/12/06 22:36:20 jhill * use destroyInProgress flag now functional nativeCount() * @@ -42,15 +45,13 @@ #ifndef casPVListChanIL_h #define casPVListChanIL_h +#include + // -// casPVListChan::casPVListChan() +// empty for now since casPVListChan::casPVListChan() +// causes undefined sym when it is inline under g++ 2.7.x +// (without -O) // -inline casPVListChan::casPVListChan - (const casCtx &ctx, casChannel &chanAdapterIn) : - casChannelI(ctx, chanAdapterIn) -{ - this->pv.installChannel(*this); -} #endif // casPVListChanIL_h diff --git a/src/cas/generic/dgInBuf.cc b/src/cas/generic/dgInBuf.cc index bce7c39f4..4b748c2d2 100644 --- a/src/cas/generic/dgInBuf.cc +++ b/src/cas/generic/dgInBuf.cc @@ -1,7 +1,19 @@ #include +#include #include +// +// this needs to be here (and not in dgInBufIL.h) if we +// are to avoid undefined symbols under gcc 2.7.x without -O +// +// dgInBuf::dgInBuf () +// +dgInBuf::dgInBuf (osiMutex &mutexIn, unsigned bufSizeIn) : + inBuf(mutexIn, bufSizeIn) +{ +} + // // dgInBuf::~dgInBuf() // (force virtual constructor) @@ -10,6 +22,17 @@ dgInBuf::~dgInBuf() { } +// +// this needs to be here (and not in dgInBufIL.h) if we +// are to avoid undefined symbols under gcc 2.7.x without -O +// +// dgInBuf::hasAddress() +// +int dgInBuf::hasAddress() const +{ + return this->from.hasBeenInitialized(); +} + // // dgInBuf::xRecv () // diff --git a/src/cas/generic/dgInBufIL.h b/src/cas/generic/dgInBufIL.h index 427b65566..bdb02a70a 100644 --- a/src/cas/generic/dgInBufIL.h +++ b/src/cas/generic/dgInBufIL.h @@ -5,22 +5,6 @@ #include #include -// -// dgInBuf::dgInBuf() -// -inline dgInBuf::dgInBuf (osiMutex &mutexIn, unsigned bufSizeIn) : - inBuf(mutexIn, bufSizeIn) -{ -} - -// -// dgInBuf::hasAddress() -// -inline int dgInBuf::hasAddress() const -{ - return this->from.hasBeenInitialized(); -} - // // dgInBuf::clear() // diff --git a/src/cas/generic/dgOutBuf.cc b/src/cas/generic/dgOutBuf.cc index 2fd4bc15b..793145110 100644 --- a/src/cas/generic/dgOutBuf.cc +++ b/src/cas/generic/dgOutBuf.cc @@ -1,6 +1,19 @@ #include #include +#include + +// +// this needs to be here (and not in dgInBufIL.h) if we +// are to avoid undefined symbols under gcc 2.7.x when +// -O is not used +// +// dgOutBuf::dgOutBuf () +// +dgOutBuf::dgOutBuf (osiMutex &mutexIn, unsigned bufSizeIn) : + outBuf(mutexIn, bufSizeIn) +{ +} // // dgOutBuf::~dgOutBuf() @@ -22,3 +35,37 @@ xSendStatus dgOutBuf::xSend (char *pBufIn, this->to.get()); } +// +// this needs to be here (and not in dgInBufIL.h) if we +// are to avoid undefined symbols under gcc 2.7.x (without -O) +// +// dgOutBuf::clear() +// +void dgOutBuf::clear() +{ + this->to.clear(); + this->outBuf::clear(); +} + +// +// this needs to be here (and not in dgInBufIL.h) if we +// are to avoid undefined symbols under gcc 2.7.x (without -O) +// +// dgOutBuf::setRecipient() +// +void dgOutBuf::setRecipient(const caAddr &addr) +{ + this->to.set(addr); +} + +// +// this needs to be here (and not in dgInBufIL.h) if we +// are to avoid undefined symbols under gcc 2.7.x (without -O) +// +// dgOutBuf::getRecipient() +// +caAddr dgOutBuf::getRecipient() +{ + return this->to.get(); +} + diff --git a/src/cas/generic/dgOutBufIL.h b/src/cas/generic/dgOutBufIL.h index 70e326078..de790c38f 100644 --- a/src/cas/generic/dgOutBufIL.h +++ b/src/cas/generic/dgOutBufIL.h @@ -6,37 +6,9 @@ #include // -// dgOutBuf::dgOutBuf() +// All of the functions in this file moved to dgOutBuf.cc because +// of inline problems with g++ 2.7.2 (without -O) // -inline dgOutBuf::dgOutBuf (osiMutex &mutexIn, unsigned bufSizeIn) : - outBuf(mutexIn, bufSizeIn) -{ -} - -// -// dgOutBuf::getRecipient() -// -inline caAddr dgOutBuf::getRecipient() -{ - return this->to.get(); -} - -// -// dgOutBuf::setRecipient() -// -inline void dgOutBuf::setRecipient(const caAddr &addr) -{ - this->to.set(addr); -} - -// -// dgOutBuf::clear() -// -inline void dgOutBuf::clear() -{ - this->to.clear(); - this->outBuf::clear(); -} #endif // dgOutBufILh diff --git a/src/cas/generic/inBufIL.h b/src/cas/generic/inBufIL.h index 3680bcd2e..027f7c5f6 100644 --- a/src/cas/generic/inBufIL.h +++ b/src/cas/generic/inBufIL.h @@ -2,16 +2,12 @@ #ifndef inBufILh #define inBufILh - // // inBuf::inBuf() // inline inBuf::inBuf(osiMutex &mutexIn, unsigned bufSizeIn) : - mutex(mutexIn), - pBuf(NULL), - bufSize(bufSizeIn), - bytesInBuffer(0u), - nextReadIndex(0u) + mutex(mutexIn), pBuf(NULL), bufSize(bufSizeIn), + bytesInBuffer(0u), nextReadIndex(0u) { } diff --git a/src/cas/generic/server.h b/src/cas/generic/server.h index afbb9e73b..7b08e9d66 100644 --- a/src/cas/generic/server.h +++ b/src/cas/generic/server.h @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.14 1996/12/11 00:57:56 jhill + * moved casEventMaskEntry here + * * Revision 1.13 1996/12/06 22:36:30 jhill * use destroyInProgress flag now functional nativeCount() * @@ -265,7 +268,11 @@ enum casFillCondition{ // class inBuf { public: - inline inBuf (osiMutex &, unsigned bufSizeIn); + // + // this needs to be here (and not in dgInBufIL.h) if we + // are to avoid undefined symbols under gcc 2.7.x without -O + // + inline inBuf(osiMutex &mutexIn, unsigned bufSizeIn); inline caStatus init(); //constructor does not return status virtual ~inBuf(); @@ -308,12 +315,12 @@ private: // class dgInBuf : public inBuf { public: - inline dgInBuf (osiMutex &mutexIn, unsigned bufSizeIn); + dgInBuf (osiMutex &mutexIn, unsigned bufSizeIn); virtual ~dgInBuf(); inline void clear(); - inline int hasAddress() const; + int hasAddress() const; caAddr getSender() const; @@ -392,15 +399,15 @@ private: // class dgOutBuf : public outBuf { public: - inline dgOutBuf (osiMutex &mutexIn, unsigned bufSizeIn); + dgOutBuf (osiMutex &mutexIn, unsigned bufSizeIn); virtual ~dgOutBuf(); - inline caAddr getRecipient(); + caAddr getRecipient(); - inline void setRecipient(const caAddr &addr); + void setRecipient(const caAddr &addr); - inline void clear(); + void clear(); xSendStatus xSend (char *pBufIn, bufSizeT nBytesAvailableToSend, bufSizeT nBytesNeedToBeSent, bufSizeT &nBytesSent); diff --git a/src/cas/io/bsdSocket/casDGIntfIO.cc b/src/cas/io/bsdSocket/casDGIntfIO.cc index e7e15106c..825dd2720 100644 --- a/src/cas/io/bsdSocket/casDGIntfIO.cc +++ b/src/cas/io/bsdSocket/casDGIntfIO.cc @@ -440,3 +440,20 @@ unsigned casDGIntfIO::serverPortNumber() return this->connectWithThisPort; } +// +// this was moved from casIODIL.h to here because +// of problems inline functions and g++ -g 2.7.2 +// +// casDGIntfIO::processDG() +// +void casDGIntfIO::processDG() +{ + assert(this->pAltOutIO); + + // + // process the request DG and send a response DG + // if it is required + // + this->client.processDG(*this,*this->pAltOutIO); +} + diff --git a/src/cas/io/bsdSocket/casIOD.h b/src/cas/io/bsdSocket/casIOD.h index eb5add5db..14811fd45 100644 --- a/src/cas/io/bsdSocket/casIOD.h +++ b/src/cas/io/bsdSocket/casIOD.h @@ -7,6 +7,9 @@ // Some BSD calls have crept in here // // $Log$ +// Revision 1.6 1996/11/02 00:54:45 jhill +// many improvements +// // Revision 1.5 1996/09/16 18:25:15 jhill // vxWorks port changes // @@ -66,7 +69,7 @@ public: virtual caStatus start()=0; // OS specific - inline void processDG(); + void processDG(); private: ELLLIST beaconAddrList; diff --git a/src/cas/io/bsdSocket/casIODIL.h b/src/cas/io/bsdSocket/casIODIL.h index aea9286dc..e5869e4f2 100644 --- a/src/cas/io/bsdSocket/casIODIL.h +++ b/src/cas/io/bsdSocket/casIODIL.h @@ -3,18 +3,10 @@ #define casIODILh // -// casDGIntfIO::processDG() +// Problems with g++ -g 2.7.2 and inline functions +// caused all functions in this file to be moved to +// casDGIntfIO.cc // -inline void casDGIntfIO::processDG() -{ - assert(this->pAltOutIO); - - // - // process the request DG and send a response DG - // if it is required - // - this->client.processDG(*this,*this->pAltOutIO); -} #endif // casIODILh