From e6ab9aa7fb681964e7807f3222fbbd9a5afd4e08 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 10 Dec 2008 21:51:19 +0000 Subject: [PATCH] Clean up compiler warnings. --- src/gdd/aitConvert.cc | 14 ++++++++++++++ src/gdd/aitTypes.h | 9 ++++++++- src/gdd/gddI.h | 25 +++++++++++++------------ src/gdd/gddNewDel.h | 6 ++++-- src/gdd/gddUtils.h | 1 + src/gdd/smartGDDPointer.h | 22 +++++++++++++--------- 6 files changed, 53 insertions(+), 24 deletions(-) diff --git a/src/gdd/aitConvert.cc b/src/gdd/aitConvert.cc index d2e3ac524..860a72efe 100644 --- a/src/gdd/aitConvert.cc +++ b/src/gdd/aitConvert.cc @@ -103,12 +103,14 @@ static int aitConvertStringString(void* d,const void* s, for(i=0;i>16); low=(aitUint16)(status&0x0000ffff); } + { high = (aitUint16)(status.u >> 16); + low = (aitUint16)(status.u & 0x0000ffff); } inline void gdd::setStat(aitUint16 s) - { aitUint16* x = (aitUint16*)&status; x[0]=s; } + { status.s.aitStat = s; } inline void gdd::setSevr(aitUint16 s) - { aitUint16* x = (aitUint16*)&status; x[1]=s; } + { status.s.aitSevr = s; } inline aitUint16 gdd::getStat(void) const - { aitUint16* x = (aitUint16*)&status; return x[0]; } + { return status.s.aitStat; } inline aitUint16 gdd::getSevr(void) const - { aitUint16* x = (aitUint16*)&status; return x[1]; } -inline void gdd::getStatSevr(aitInt16& st, aitInt16& se) const - { st=getStat(); se=getSevr(); } -inline void gdd::setStatSevr(aitInt16 st, aitInt16 se) - { setStat(st); setSevr(se); } + { return status.s.aitSevr; } +inline void gdd::getStatSevr(aitInt16& stat, aitInt16& sevr) const + { stat = status.s.aitStat; sevr = status.s.aitSevr; } +inline void gdd::setStatSevr(aitInt16 stat, aitInt16 sevr) + { status.s.aitStat = stat; status.s.aitSevr = sevr; } inline gdd& gdd::operator=(const gdd& v) { memcpy(this,&v,sizeof(gdd)); return *this; } diff --git a/src/gdd/gddNewDel.h b/src/gdd/gddNewDel.h index ad18d3a3a..4029bdd3c 100644 --- a/src/gdd/gddNewDel.h +++ b/src/gdd/gddNewDel.h @@ -60,8 +60,10 @@ void gddGlobalCleanupAdd ( void * pBuf ); #define gdd_NEWDEL_FUNC(fld) \ void* operator new(size_t); \ void operator delete(void*); \ - char* newdel_next(void) { char** x=(char**)&(fld); return *x; } \ - void newdel_setNext(char* n) { char** x=(char**)&(fld); *x=n; } \ + char* newdel_next(void) { char* pfld = (char *)&fld; \ + char** x = (char**)pfld; return *x; } \ + void newdel_setNext(char* n) { char* pfld = (char *)&fld; \ + char** x=(char**)pfld; *x=n; } \ static void gddNewDelInit (void) { pNewdel_lock = new epicsMutex; } \ diff --git a/src/gdd/gddUtils.h b/src/gdd/gddUtils.h index 2636d63a6..3857ff6be 100644 --- a/src/gdd/gddUtils.h +++ b/src/gdd/gddUtils.h @@ -97,6 +97,7 @@ public: protected: aitUint16 ref_cnt; void* arg; + virtual ~gddDestructor () {} private: gdd_NEWDEL_DATA }; diff --git a/src/gdd/smartGDDPointer.h b/src/gdd/smartGDDPointer.h index 3b3ceeb4b..3ef593e20 100644 --- a/src/gdd/smartGDDPointer.h +++ b/src/gdd/smartGDDPointer.h @@ -1,16 +1,15 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ // // Smart Pointer Class for GDD -// ( automatically takes care of referencing / unreferening a gdd each time that it is used ) +// ( handles referencing / unreferencing a gdd each time it is used ) // // Author: Jeff Hill // @@ -59,7 +58,8 @@ template < class T > inline smartGDDPointerTemplate < T >::smartGDDPointerTemplate ( T & valueIn ) : pValue ( & valueIn ) { - assert ( ! this->pValue->reference () ); + gddStatus status = this->pValue->reference (); + assert ( ! status ); } template < class T > @@ -67,7 +67,8 @@ inline smartGDDPointerTemplate < T >::smartGDDPointerTemplate ( T * pValueIn ) : pValue ( pValueIn ) { if ( this->pValue != NULL ) { - assert ( ! this->pValue->reference () ); + gddStatus status = this->pValue->reference (); + assert ( ! status ); } } @@ -77,7 +78,8 @@ inline smartGDDPointerTemplate < T > :: pValue ( ptrIn.pValue ) { if ( this->pValue != NULL ) { - assert ( ! this->pValue->reference () ); + gddStatus status = this->pValue->reference (); + assert ( ! status ); } } @@ -85,7 +87,8 @@ template < class T > inline smartGDDPointerTemplate < T > :: ~smartGDDPointerTemplate () { if ( this->pValue != NULL ) { - assert ( ! this->pValue->unreference () ); + gddStatus status = this->pValue->reference (); + assert ( ! status ); } } @@ -94,7 +97,8 @@ inline void smartGDDPointerTemplate < T > :: set ( T * pNewValue ) { if ( this->pValue != pNewValue ) { if ( pNewValue ) { - assert ( ! pNewValue->reference () ); + gddStatus status = pNewValue->reference (); + assert ( ! status ); } if ( this->pValue ) { this->pValue->unreference ();